@gajae-code/coding-agent 0.10.0 → 0.10.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/types/cli.d.ts +1 -0
  3. package/dist/types/config/settings.d.ts +2 -0
  4. package/dist/types/coordinator/contract.d.ts +1 -1
  5. package/dist/types/coordinator-mcp/policy.d.ts +3 -0
  6. package/dist/types/coordinator-mcp/server.d.ts +17 -5
  7. package/dist/types/coordinator-mcp/session-reaper.d.ts +53 -0
  8. package/dist/types/extensibility/extensions/types.d.ts +3 -1
  9. package/dist/types/modes/components/status-line/types.d.ts +1 -1
  10. package/dist/types/modes/components/status-line.d.ts +0 -10
  11. package/dist/types/modes/print-mode.d.ts +3 -4
  12. package/dist/types/modes/rpc/rpc-client.d.ts +7 -1
  13. package/dist/types/modes/rpc/rpc-mode.d.ts +2 -1
  14. package/dist/types/modes/rpc/rpc-types.d.ts +17 -1
  15. package/dist/types/modes/utils/context-usage.d.ts +4 -19
  16. package/dist/types/session/agent-session.d.ts +14 -1
  17. package/dist/types/session/context-estimation.d.ts +31 -0
  18. package/package.json +7 -7
  19. package/src/cli.ts +1 -0
  20. package/src/config/settings.ts +96 -45
  21. package/src/coordinator/contract.ts +1 -0
  22. package/src/coordinator-mcp/policy.ts +30 -0
  23. package/src/coordinator-mcp/server.ts +294 -66
  24. package/src/coordinator-mcp/session-reaper.ts +129 -0
  25. package/src/extensibility/extensions/runner.ts +1 -1
  26. package/src/extensibility/extensions/types.ts +3 -1
  27. package/src/internal-urls/docs-index.generated.ts +4 -4
  28. package/src/main.ts +3 -5
  29. package/src/modes/acp/acp-agent.ts +2 -2
  30. package/src/modes/components/footer.ts +3 -3
  31. package/src/modes/components/status-line/segments.ts +13 -6
  32. package/src/modes/components/status-line/types.ts +1 -1
  33. package/src/modes/components/status-line.ts +4 -171
  34. package/src/modes/controllers/extension-ui-controller.ts +1 -1
  35. package/src/modes/interactive-mode.ts +16 -0
  36. package/src/modes/print-mode.ts +228 -92
  37. package/src/modes/rpc/rpc-client.ts +58 -1
  38. package/src/modes/rpc/rpc-mode.ts +286 -85
  39. package/src/modes/rpc/rpc-types.ts +15 -1
  40. package/src/modes/shared/agent-wire/command-dispatch.ts +33 -1
  41. package/src/modes/shared/agent-wire/command-validation.ts +10 -0
  42. package/src/modes/shared/agent-wire/scopes.ts +1 -0
  43. package/src/modes/utils/context-usage.ts +56 -92
  44. package/src/session/agent-session.ts +287 -85
  45. package/src/session/context-estimation.ts +91 -0
  46. package/src/slash-commands/builtin-registry.ts +12 -2
  47. package/src/slash-commands/helpers/context-report.ts +26 -4
@@ -83,6 +83,12 @@ function formatReserveText(runtime: SlashCommandRuntime, contextWindow: number,
83
83
  return "unknown";
84
84
  }
85
85
 
86
+ function contextUsageSourceLabel(source: "provider_anchor" | "heuristic" | "unknown"): string {
87
+ if (source === "provider_anchor") return "provider-reported";
88
+ if (source === "unknown") return "estimated; exact count unknown until next response";
89
+ return "estimated";
90
+ }
91
+
86
92
  /**
87
93
  * Build the `/context` ACP-mode text. Tries the rich breakdown first
88
94
  * (categories + auto-compact buffer + free slack) and falls back to the
@@ -96,11 +102,21 @@ export function buildContextReportText(runtime: SlashCommandRuntime): string {
96
102
  return "Context usage is unavailable: no model is selected for this session.";
97
103
  }
98
104
  const promptUsage = findLastAssistantUsage(history.activeMessages);
99
- const usedPct = (breakdown.usedTokens / breakdown.contextWindow) * 100;
105
+ const activeContext =
106
+ breakdown.usedTokens === null
107
+ ? `Active context: unknown / ${breakdown.contextWindow.toLocaleString()} tokens (exact count unknown until next response) (${contextUsageSourceLabel(breakdown.source)})`
108
+ : `Active context: ${breakdown.usedTokens.toLocaleString()} / ${breakdown.contextWindow.toLocaleString()} tokens (${((breakdown.usedTokens / breakdown.contextWindow) * 100).toFixed(1)}% used) (${contextUsageSourceLabel(breakdown.source)})`;
100
109
  const lines = [
101
110
  "Context usage",
102
111
  `Model: ${breakdown.model?.provider ?? "unknown"}/${breakdown.model?.id ?? "unknown"}`,
103
- `Active context: ${breakdown.usedTokens.toLocaleString()} / ${breakdown.contextWindow.toLocaleString()} tokens (${usedPct.toFixed(1)}% used)`,
112
+ activeContext,
113
+ ...(breakdown.source !== "unknown" &&
114
+ breakdown.usedTokens !== null &&
115
+ breakdown.estimatedCategoryTotal !== breakdown.usedTokens
116
+ ? [
117
+ `Estimated category total: ${breakdown.estimatedCategoryTotal.toLocaleString()} tokens (composition below is estimated)`,
118
+ ]
119
+ : []),
104
120
  `Reserve: ${formatReserveText(runtime, breakdown.contextWindow, breakdown.autoCompactBufferTokens)}`,
105
121
  "",
106
122
  "Active context breakdown (estimated)",
@@ -111,7 +127,13 @@ export function buildContextReportText(runtime: SlashCommandRuntime): string {
111
127
  if (breakdown.autoCompactBufferTokens > 0) {
112
128
  lines.push(formatTokenLine("Reserve", breakdown.autoCompactBufferTokens, breakdown.contextWindow));
113
129
  }
114
- lines.push(formatTokenLine("Free", breakdown.freeTokens, breakdown.contextWindow));
130
+ lines.push(
131
+ formatTokenLine(
132
+ breakdown.usedTokens === null ? "Free (estimated)" : "Free",
133
+ breakdown.freeTokens,
134
+ breakdown.contextWindow,
135
+ ),
136
+ );
115
137
  lines.push(
116
138
  "",
117
139
  "History",
@@ -141,7 +163,7 @@ export function buildContextReportText(runtime: SlashCommandRuntime): string {
141
163
  if (!fallback) return "Context usage is unavailable.";
142
164
  return [
143
165
  "Context usage",
144
- `Active context: ${fallback.tokens === null || fallback.tokens === undefined ? "unknown" : fallback.tokens.toLocaleString()}`,
166
+ `Active context: ${fallback.tokens === null ? "unknown" : fallback.tokens.toLocaleString()} (${contextUsageSourceLabel(fallback.source)})`,
145
167
  `Context window: ${fallback.contextWindow.toLocaleString()}`,
146
168
  "Breakdown: unknown",
147
169
  ].join("\n");