@link-assistant/agent 0.18.1 → 0.18.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/agent",
3
- "version": "0.18.1",
3
+ "version": "0.18.3",
4
4
  "description": "A minimal, public domain AI CLI agent compatible with OpenCode's JSON interface. Bun-only runtime.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -94,22 +94,47 @@ export namespace SessionSummary {
94
94
  const assistantMsg = messages.find((m) => m.info.role === 'assistant')!
95
95
  .info as MessageV2.Assistant;
96
96
 
97
- // Use the same model as the main session (--model) instead of a small model
98
- // This ensures consistent behavior and uses the model the user explicitly requested
99
- // See: https://github.com/link-assistant/agent/issues/217
100
- log.info(() => ({
101
- message: 'loading model for summarization',
102
- providerID: assistantMsg.providerID,
103
- modelID: assistantMsg.modelID,
104
- hint: 'Using same model as --model (not a small model)',
105
- }));
106
- const model = await Provider.getModel(
107
- assistantMsg.providerID,
108
- assistantMsg.modelID
109
- ).catch(() => null);
97
+ // Use the compaction model (--compaction-model, e.g. gpt-5-nano) for summarization
98
+ // to avoid doubling rate-limit pressure on the main model.
99
+ // If the compaction model is unavailable, fall back to the main model.
100
+ // See: https://github.com/link-assistant/agent/issues/223
101
+ const compactionModel = userMsg.compactionModel;
102
+ let model: Awaited<ReturnType<typeof Provider.getModel>> | null = null;
103
+
104
+ if (compactionModel && !compactionModel.useSameModel) {
105
+ model = await Provider.getModel(
106
+ compactionModel.providerID,
107
+ compactionModel.modelID
108
+ ).catch(() => null);
109
+ if (model) {
110
+ log.info(() => ({
111
+ message: 'loading model for summarization',
112
+ providerID: model!.providerID,
113
+ modelID: model!.modelID,
114
+ hint: 'Using compaction model to reduce rate-limit pressure on main model',
115
+ mainModelID: assistantMsg.modelID,
116
+ }));
117
+ }
118
+ }
119
+
120
+ if (!model) {
121
+ // Fall back to the main model if compaction model is not configured or unavailable
122
+ log.info(() => ({
123
+ message: 'loading model for summarization',
124
+ providerID: assistantMsg.providerID,
125
+ modelID: assistantMsg.modelID,
126
+ hint: compactionModel
127
+ ? 'Compaction model unavailable, falling back to main model'
128
+ : 'Using same model as --model (no compaction model configured)',
129
+ }));
130
+ model = await Provider.getModel(
131
+ assistantMsg.providerID,
132
+ assistantMsg.modelID
133
+ ).catch(() => null);
134
+ }
110
135
  if (!model) {
111
136
  log.info(() => ({
112
- message: 'could not load session model for summarization, skipping',
137
+ message: 'could not load model for summarization, skipping',
113
138
  providerID: assistantMsg.providerID,
114
139
  modelID: assistantMsg.modelID,
115
140
  }));