@link-assistant/agent 0.13.5 → 0.16.0
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 +11 -1
- package/src/flag/flag.ts +34 -0
- package/src/index.js +19 -17
- package/src/provider/provider.ts +115 -32
- package/src/session/message-v2.ts +19 -0
- package/src/session/processor.ts +17 -0
- package/src/session/summary.ts +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@link-assistant/agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
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",
|
|
@@ -54,8 +54,18 @@
|
|
|
54
54
|
"@actions/core": "^1.11.1",
|
|
55
55
|
"@actions/github": "^6.0.1",
|
|
56
56
|
"@agentclientprotocol/sdk": "^0.5.1",
|
|
57
|
+
"@ai-sdk/amazon-bedrock": "^3.0.74",
|
|
58
|
+
"@ai-sdk/anthropic": "^2.0.58",
|
|
59
|
+
"@ai-sdk/azure": "^2.0.91",
|
|
60
|
+
"@ai-sdk/google": "^2.0.52",
|
|
61
|
+
"@ai-sdk/google-vertex": "^3.0.98",
|
|
62
|
+
"@ai-sdk/groq": "^2.0.34",
|
|
57
63
|
"@ai-sdk/mcp": "^0.0.8",
|
|
64
|
+
"@ai-sdk/mistral": "^2.0.27",
|
|
65
|
+
"@ai-sdk/openai": "^2.0.89",
|
|
66
|
+
"@ai-sdk/openai-compatible": "^1.0.32",
|
|
58
67
|
"@ai-sdk/xai": "^2.0.33",
|
|
68
|
+
"@openrouter/ai-sdk-provider": "^1.5.4",
|
|
59
69
|
"@clack/prompts": "^0.11.0",
|
|
60
70
|
"@hono/standard-validator": "^0.2.0",
|
|
61
71
|
"@hono/zod-validator": "^0.7.5",
|
package/src/flag/flag.ts
CHANGED
|
@@ -82,6 +82,40 @@ export namespace Flag {
|
|
|
82
82
|
GENERATE_TITLE = value;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
// Output response model information in step-finish parts
|
|
86
|
+
// Enabled by default - includes model info (providerID, requestedModelID, respondedModelID) in output
|
|
87
|
+
// Can be disabled with AGENT_OUTPUT_RESPONSE_MODEL=false
|
|
88
|
+
// See: https://github.com/link-assistant/agent/issues/179
|
|
89
|
+
export let OUTPUT_RESPONSE_MODEL = (() => {
|
|
90
|
+
const value = (
|
|
91
|
+
getEnv(
|
|
92
|
+
'LINK_ASSISTANT_AGENT_OUTPUT_RESPONSE_MODEL',
|
|
93
|
+
'AGENT_OUTPUT_RESPONSE_MODEL'
|
|
94
|
+
) ?? ''
|
|
95
|
+
).toLowerCase();
|
|
96
|
+
if (value === 'false' || value === '0') return false;
|
|
97
|
+
return true; // Default to true
|
|
98
|
+
})();
|
|
99
|
+
|
|
100
|
+
// Allow setting output-response-model mode programmatically (e.g., from CLI --output-response-model flag)
|
|
101
|
+
export function setOutputResponseModel(value: boolean) {
|
|
102
|
+
OUTPUT_RESPONSE_MODEL = value;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Session summarization configuration
|
|
106
|
+
// When disabled, session summaries will not be generated
|
|
107
|
+
// This saves tokens and prevents rate limit issues with free tier models
|
|
108
|
+
// See: https://github.com/link-assistant/agent/issues/179
|
|
109
|
+
export let SUMMARIZE_SESSION = truthyCompat(
|
|
110
|
+
'LINK_ASSISTANT_AGENT_SUMMARIZE_SESSION',
|
|
111
|
+
'AGENT_SUMMARIZE_SESSION'
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
// Allow setting summarize-session mode programmatically (e.g., from CLI --summarize-session flag)
|
|
115
|
+
export function setSummarizeSession(value: boolean) {
|
|
116
|
+
SUMMARIZE_SESSION = value;
|
|
117
|
+
}
|
|
118
|
+
|
|
85
119
|
// Retry timeout configuration
|
|
86
120
|
// Maximum total time to keep retrying for the same error type (default: 7 days in seconds)
|
|
87
121
|
// For different error types, the timer resets
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { Flag } from './flag/flag.ts';
|
|
3
3
|
import { setProcessName } from './cli/process-name.ts';
|
|
4
4
|
setProcessName('agent');
|
|
5
|
-
|
|
6
5
|
import { Server } from './server/server.ts';
|
|
7
6
|
import { Instance } from './project/instance.ts';
|
|
8
7
|
import { Log } from './util/log.ts';
|
|
@@ -743,6 +742,16 @@ async function main() {
|
|
|
743
742
|
type: 'number',
|
|
744
743
|
description:
|
|
745
744
|
'Maximum total retry time in seconds for rate limit errors (default: 604800 = 7 days)',
|
|
745
|
+
})
|
|
746
|
+
.option('output-response-model', {
|
|
747
|
+
type: 'boolean',
|
|
748
|
+
description: 'Include model info in step_finish output',
|
|
749
|
+
default: true,
|
|
750
|
+
})
|
|
751
|
+
.option('summarize-session', {
|
|
752
|
+
type: 'boolean',
|
|
753
|
+
description: 'Generate AI session summaries',
|
|
754
|
+
default: false,
|
|
746
755
|
}),
|
|
747
756
|
handler: async (argv) => {
|
|
748
757
|
// Check both CLI flag and environment variable for compact JSON mode
|
|
@@ -906,37 +915,30 @@ async function main() {
|
|
|
906
915
|
await runAgentMode(argv, request);
|
|
907
916
|
},
|
|
908
917
|
})
|
|
909
|
-
// Initialize logging early for all CLI commands
|
|
910
|
-
// This prevents debug output from appearing in CLI unless --verbose is used
|
|
918
|
+
// Initialize logging and flags early for all CLI commands
|
|
911
919
|
.middleware(async (argv) => {
|
|
912
|
-
// Set global compact JSON setting (CLI flag or environment variable)
|
|
913
920
|
const isCompact = argv['compact-json'] === true || Flag.COMPACT_JSON();
|
|
914
921
|
if (isCompact) {
|
|
915
922
|
setCompactJson(true);
|
|
916
923
|
}
|
|
917
|
-
|
|
918
|
-
// Set verbose flag if requested
|
|
919
924
|
if (argv.verbose) {
|
|
920
925
|
Flag.setVerbose(true);
|
|
921
926
|
}
|
|
922
|
-
|
|
923
|
-
// Set dry-run flag if requested
|
|
924
927
|
if (argv['dry-run']) {
|
|
925
928
|
Flag.setDryRun(true);
|
|
926
929
|
}
|
|
927
|
-
|
|
928
|
-
// Set generate-title flag if explicitly enabled
|
|
929
|
-
// Default is false to save tokens and prevent rate limit issues
|
|
930
|
-
// See: https://github.com/link-assistant/agent/issues/157
|
|
931
930
|
if (argv['generate-title'] === true) {
|
|
932
931
|
Flag.setGenerateTitle(true);
|
|
933
932
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
933
|
+
// output-response-model is enabled by default, only set if explicitly disabled
|
|
934
|
+
if (argv['output-response-model'] === false) {
|
|
935
|
+
Flag.setOutputResponseModel(false);
|
|
936
|
+
}
|
|
937
|
+
if (argv['summarize-session'] === true) {
|
|
938
|
+
Flag.setSummarizeSession(true);
|
|
939
|
+
}
|
|
938
940
|
await Log.init({
|
|
939
|
-
print: Flag.OPENCODE_VERBOSE,
|
|
941
|
+
print: Flag.OPENCODE_VERBOSE,
|
|
940
942
|
level: Flag.OPENCODE_VERBOSE ? 'DEBUG' : 'INFO',
|
|
941
943
|
compactJson: isCompact,
|
|
942
944
|
});
|
package/src/provider/provider.ts
CHANGED
|
@@ -18,9 +18,48 @@ import { createEchoModel } from './echo';
|
|
|
18
18
|
import { createCacheModel } from './cache';
|
|
19
19
|
import { RetryFetch } from './retry-fetch';
|
|
20
20
|
|
|
21
|
+
// Direct imports for bundled providers - these are pre-installed to avoid runtime installation hangs
|
|
22
|
+
// @see https://github.com/link-assistant/agent/issues/173
|
|
23
|
+
// @see https://github.com/oven-sh/bun/issues/5831 (bun install hangs sporadically)
|
|
24
|
+
import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
|
|
25
|
+
import { createAnthropic } from '@ai-sdk/anthropic';
|
|
26
|
+
import { createAzure } from '@ai-sdk/azure';
|
|
27
|
+
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
28
|
+
import { createVertex } from '@ai-sdk/google-vertex';
|
|
29
|
+
import { createOpenAI } from '@ai-sdk/openai';
|
|
30
|
+
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
|
31
|
+
import { createOpenRouter } from '@openrouter/ai-sdk-provider';
|
|
32
|
+
import { createXai } from '@ai-sdk/xai';
|
|
33
|
+
import { createMistral } from '@ai-sdk/mistral';
|
|
34
|
+
import { createGroq } from '@ai-sdk/groq';
|
|
35
|
+
|
|
21
36
|
export namespace Provider {
|
|
22
37
|
const log = Log.create({ service: 'provider' });
|
|
23
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Bundled providers - these are pre-installed and imported statically
|
|
41
|
+
* to avoid runtime package installation which can hang or timeout.
|
|
42
|
+
*
|
|
43
|
+
* When a provider's npm package is in this map, we use the pre-installed
|
|
44
|
+
* version instead of dynamically installing via `bun add`.
|
|
45
|
+
*
|
|
46
|
+
* @see https://github.com/link-assistant/agent/issues/173
|
|
47
|
+
* @see https://github.com/Kilo-Org/kilo (reference implementation)
|
|
48
|
+
*/
|
|
49
|
+
const BUNDLED_PROVIDERS: Record<string, (options: any) => SDK> = {
|
|
50
|
+
'@ai-sdk/amazon-bedrock': createAmazonBedrock,
|
|
51
|
+
'@ai-sdk/anthropic': createAnthropic,
|
|
52
|
+
'@ai-sdk/azure': createAzure,
|
|
53
|
+
'@ai-sdk/google': createGoogleGenerativeAI,
|
|
54
|
+
'@ai-sdk/google-vertex': createVertex,
|
|
55
|
+
'@ai-sdk/openai': createOpenAI,
|
|
56
|
+
'@ai-sdk/openai-compatible': createOpenAICompatible,
|
|
57
|
+
'@openrouter/ai-sdk-provider': createOpenRouter,
|
|
58
|
+
'@ai-sdk/xai': createXai,
|
|
59
|
+
'@ai-sdk/mistral': createMistral,
|
|
60
|
+
'@ai-sdk/groq': createGroq,
|
|
61
|
+
};
|
|
62
|
+
|
|
24
63
|
type CustomLoader = (provider: ModelsDev.Provider) => Promise<{
|
|
25
64
|
autoload: boolean;
|
|
26
65
|
getModel?: (
|
|
@@ -1128,37 +1167,7 @@ export namespace Provider {
|
|
|
1128
1167
|
const existing = s.sdk.get(key);
|
|
1129
1168
|
if (existing) return existing;
|
|
1130
1169
|
|
|
1131
|
-
|
|
1132
|
-
if (!pkg.startsWith('file://')) {
|
|
1133
|
-
log.info(() => ({
|
|
1134
|
-
message: 'installing provider package',
|
|
1135
|
-
providerID: provider.id,
|
|
1136
|
-
pkg,
|
|
1137
|
-
version: 'latest',
|
|
1138
|
-
}));
|
|
1139
|
-
installedPath = await BunProc.install(pkg, 'latest');
|
|
1140
|
-
log.info(() => ({
|
|
1141
|
-
message: 'provider package installed successfully',
|
|
1142
|
-
providerID: provider.id,
|
|
1143
|
-
pkg,
|
|
1144
|
-
installedPath,
|
|
1145
|
-
}));
|
|
1146
|
-
} else {
|
|
1147
|
-
log.info(() => ({ message: 'loading local provider', pkg }));
|
|
1148
|
-
installedPath = pkg;
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
// The `google-vertex-anthropic` provider points to the `@ai-sdk/google-vertex` package.
|
|
1152
|
-
// Ref: https://github.com/sst/models.dev/blob/0a87de42ab177bebad0620a889e2eb2b4a5dd4ab/providers/google-vertex-anthropic/provider.toml
|
|
1153
|
-
// However, the actual export is at the subpath `@ai-sdk/google-vertex/anthropic`.
|
|
1154
|
-
// Ref: https://ai-sdk.dev/providers/ai-sdk-providers/google-vertex#google-vertex-anthropic-provider-usage
|
|
1155
|
-
// In addition, Bun's dynamic import logic does not support subpath imports,
|
|
1156
|
-
// so we patch the import path to load directly from `dist`.
|
|
1157
|
-
const modPath =
|
|
1158
|
-
provider.id === 'google-vertex-anthropic'
|
|
1159
|
-
? `${installedPath}/dist/anthropic/index.mjs`
|
|
1160
|
-
: installedPath;
|
|
1161
|
-
const mod = await import(modPath);
|
|
1170
|
+
// Apply timeout wrapper to options if timeout is specified
|
|
1162
1171
|
if (options['timeout'] !== undefined && options['timeout'] !== null) {
|
|
1163
1172
|
// Preserve custom fetch if it exists, wrap it with timeout logic
|
|
1164
1173
|
const customFetch = options['fetch'];
|
|
@@ -1192,6 +1201,58 @@ export namespace Provider {
|
|
|
1192
1201
|
sessionID: provider.id,
|
|
1193
1202
|
});
|
|
1194
1203
|
|
|
1204
|
+
// Check if we have a bundled provider first - this avoids runtime package installation
|
|
1205
|
+
// which can hang or timeout due to known Bun issues
|
|
1206
|
+
// @see https://github.com/link-assistant/agent/issues/173
|
|
1207
|
+
// @see https://github.com/oven-sh/bun/issues/5831
|
|
1208
|
+
const bundledFn = BUNDLED_PROVIDERS[pkg];
|
|
1209
|
+
if (bundledFn) {
|
|
1210
|
+
log.info(() => ({
|
|
1211
|
+
message: 'using bundled provider (no installation needed)',
|
|
1212
|
+
providerID: provider.id,
|
|
1213
|
+
pkg,
|
|
1214
|
+
}));
|
|
1215
|
+
const loaded = bundledFn({
|
|
1216
|
+
name: provider.id,
|
|
1217
|
+
...options,
|
|
1218
|
+
});
|
|
1219
|
+
s.sdk.set(key, loaded);
|
|
1220
|
+
return loaded as SDK;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
// Fall back to dynamic installation for non-bundled providers
|
|
1224
|
+
let installedPath: string;
|
|
1225
|
+
if (!pkg.startsWith('file://')) {
|
|
1226
|
+
log.info(() => ({
|
|
1227
|
+
message: 'installing provider package (not bundled)',
|
|
1228
|
+
providerID: provider.id,
|
|
1229
|
+
pkg,
|
|
1230
|
+
version: 'latest',
|
|
1231
|
+
}));
|
|
1232
|
+
installedPath = await BunProc.install(pkg, 'latest');
|
|
1233
|
+
log.info(() => ({
|
|
1234
|
+
message: 'provider package installed successfully',
|
|
1235
|
+
providerID: provider.id,
|
|
1236
|
+
pkg,
|
|
1237
|
+
installedPath,
|
|
1238
|
+
}));
|
|
1239
|
+
} else {
|
|
1240
|
+
log.info(() => ({ message: 'loading local provider', pkg }));
|
|
1241
|
+
installedPath = pkg;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
// The `google-vertex-anthropic` provider points to the `@ai-sdk/google-vertex` package.
|
|
1245
|
+
// Ref: https://github.com/sst/models.dev/blob/0a87de42ab177bebad0620a889e2eb2b4a5dd4ab/providers/google-vertex-anthropic/provider.toml
|
|
1246
|
+
// However, the actual export is at the subpath `@ai-sdk/google-vertex/anthropic`.
|
|
1247
|
+
// Ref: https://ai-sdk.dev/providers/ai-sdk-providers/google-vertex#google-vertex-anthropic-provider-usage
|
|
1248
|
+
// In addition, Bun's dynamic import logic does not support subpath imports,
|
|
1249
|
+
// so we patch the import path to load directly from `dist`.
|
|
1250
|
+
const modPath =
|
|
1251
|
+
provider.id === 'google-vertex-anthropic'
|
|
1252
|
+
? `${installedPath}/dist/anthropic/index.mjs`
|
|
1253
|
+
: installedPath;
|
|
1254
|
+
const mod = await import(modPath);
|
|
1255
|
+
|
|
1195
1256
|
const fn = mod[Object.keys(mod).find((key) => key.startsWith('create'))!];
|
|
1196
1257
|
const loaded = fn({
|
|
1197
1258
|
name: provider.id,
|
|
@@ -1297,11 +1358,25 @@ export namespace Provider {
|
|
|
1297
1358
|
}
|
|
1298
1359
|
}
|
|
1299
1360
|
|
|
1361
|
+
/**
|
|
1362
|
+
* Get a small/cheap model for auxiliary tasks like title generation and summarization.
|
|
1363
|
+
* This is NOT the primary model for user requests - it's used for background tasks.
|
|
1364
|
+
*
|
|
1365
|
+
* Note: Logs from this function may show a different model than what the user specified.
|
|
1366
|
+
* This is by design - we use cheaper models for auxiliary tasks to save tokens/costs.
|
|
1367
|
+
*
|
|
1368
|
+
* @see https://github.com/link-assistant/agent/issues/179
|
|
1369
|
+
*/
|
|
1300
1370
|
export async function getSmallModel(providerID: string) {
|
|
1301
1371
|
const cfg = await Config.get();
|
|
1302
1372
|
|
|
1303
1373
|
if (cfg.small_model) {
|
|
1304
1374
|
const parsed = parseModel(cfg.small_model);
|
|
1375
|
+
log.info(() => ({
|
|
1376
|
+
message: 'using configured small_model for auxiliary task',
|
|
1377
|
+
modelID: parsed.modelID,
|
|
1378
|
+
providerID: parsed.providerID,
|
|
1379
|
+
}));
|
|
1305
1380
|
return getModel(parsed.providerID, parsed.modelID);
|
|
1306
1381
|
}
|
|
1307
1382
|
|
|
@@ -1339,7 +1414,15 @@ export namespace Provider {
|
|
|
1339
1414
|
}
|
|
1340
1415
|
for (const item of priority) {
|
|
1341
1416
|
for (const model of Object.keys(provider.info.models)) {
|
|
1342
|
-
if (model.includes(item))
|
|
1417
|
+
if (model.includes(item)) {
|
|
1418
|
+
log.info(() => ({
|
|
1419
|
+
message: 'selected small model for auxiliary task',
|
|
1420
|
+
modelID: model,
|
|
1421
|
+
providerID,
|
|
1422
|
+
hint: 'This model is used for title/summary generation, not primary requests',
|
|
1423
|
+
}));
|
|
1424
|
+
return getModel(providerID, model);
|
|
1425
|
+
}
|
|
1343
1426
|
}
|
|
1344
1427
|
}
|
|
1345
1428
|
}
|
|
@@ -224,6 +224,22 @@ export namespace MessageV2 {
|
|
|
224
224
|
});
|
|
225
225
|
export type StepStartPart = z.infer<typeof StepStartPart>;
|
|
226
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Model information for output parts.
|
|
229
|
+
* Included when --output-response-model flag is enabled.
|
|
230
|
+
* @see https://github.com/link-assistant/agent/issues/179
|
|
231
|
+
*/
|
|
232
|
+
export const ModelInfo = z
|
|
233
|
+
.object({
|
|
234
|
+
providerID: z.string(),
|
|
235
|
+
requestedModelID: z.string(),
|
|
236
|
+
respondedModelID: z.string().optional(),
|
|
237
|
+
})
|
|
238
|
+
.meta({
|
|
239
|
+
ref: 'ModelInfo',
|
|
240
|
+
});
|
|
241
|
+
export type ModelInfo = z.infer<typeof ModelInfo>;
|
|
242
|
+
|
|
227
243
|
export const StepFinishPart = PartBase.extend({
|
|
228
244
|
type: z.literal('step-finish'),
|
|
229
245
|
reason: z.string(),
|
|
@@ -238,6 +254,9 @@ export namespace MessageV2 {
|
|
|
238
254
|
write: z.number(),
|
|
239
255
|
}),
|
|
240
256
|
}),
|
|
257
|
+
// Model info included when --output-response-model is enabled
|
|
258
|
+
// @see https://github.com/link-assistant/agent/issues/179
|
|
259
|
+
model: ModelInfo.optional(),
|
|
241
260
|
}).meta({
|
|
242
261
|
ref: 'StepFinishPart',
|
|
243
262
|
});
|
package/src/session/processor.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { SessionSummary } from './summary';
|
|
|
16
16
|
import { Bus } from '../bus';
|
|
17
17
|
import { SessionRetry } from './retry';
|
|
18
18
|
import { SessionStatus } from './status';
|
|
19
|
+
import { Flag } from '../flag/flag';
|
|
19
20
|
|
|
20
21
|
export namespace SessionProcessor {
|
|
21
22
|
const DOOM_LOOP_THRESHOLD = 3;
|
|
@@ -261,6 +262,21 @@ export namespace SessionProcessor {
|
|
|
261
262
|
input.assistantMessage.finish = finishReason;
|
|
262
263
|
input.assistantMessage.cost += usage.cost;
|
|
263
264
|
input.assistantMessage.tokens = usage.tokens;
|
|
265
|
+
|
|
266
|
+
// Build model info if --output-response-model flag is enabled
|
|
267
|
+
// @see https://github.com/link-assistant/agent/issues/179
|
|
268
|
+
const modelInfo: MessageV2.ModelInfo | undefined =
|
|
269
|
+
Flag.OUTPUT_RESPONSE_MODEL
|
|
270
|
+
? {
|
|
271
|
+
providerID: input.providerID,
|
|
272
|
+
requestedModelID: input.model.id,
|
|
273
|
+
// Get respondedModelID from finish-step response if available
|
|
274
|
+
// AI SDK includes response.modelId when available from provider
|
|
275
|
+
respondedModelID:
|
|
276
|
+
(value as any).response?.modelId ?? undefined,
|
|
277
|
+
}
|
|
278
|
+
: undefined;
|
|
279
|
+
|
|
264
280
|
await Session.updatePart({
|
|
265
281
|
id: Identifier.ascending('part'),
|
|
266
282
|
reason: finishReason,
|
|
@@ -270,6 +286,7 @@ export namespace SessionProcessor {
|
|
|
270
286
|
type: 'step-finish',
|
|
271
287
|
tokens: usage.tokens,
|
|
272
288
|
cost: usage.cost,
|
|
289
|
+
model: modelInfo,
|
|
273
290
|
});
|
|
274
291
|
await Session.updateMessage(input.assistantMessage);
|
|
275
292
|
if (snapshot) {
|
package/src/session/summary.ts
CHANGED
|
@@ -13,6 +13,7 @@ import path from 'path';
|
|
|
13
13
|
import { Instance } from '../project/instance';
|
|
14
14
|
import { Storage } from '../storage/storage';
|
|
15
15
|
import { Bus } from '../bus';
|
|
16
|
+
import { Flag } from '../flag/flag';
|
|
16
17
|
|
|
17
18
|
export namespace SessionSummary {
|
|
18
19
|
const log = Log.create({ service: 'session.summary' });
|
|
@@ -79,6 +80,16 @@ export namespace SessionSummary {
|
|
|
79
80
|
};
|
|
80
81
|
await Session.updateMessage(userMsg);
|
|
81
82
|
|
|
83
|
+
// Skip AI-powered summarization if disabled (default)
|
|
84
|
+
// See: https://github.com/link-assistant/agent/issues/179
|
|
85
|
+
if (!Flag.SUMMARIZE_SESSION) {
|
|
86
|
+
log.info(() => ({
|
|
87
|
+
message: 'session summarization disabled',
|
|
88
|
+
hint: 'Enable with --summarize-session flag or AGENT_SUMMARIZE_SESSION=true',
|
|
89
|
+
}));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
82
93
|
const assistantMsg = messages.find((m) => m.info.role === 'assistant')!
|
|
83
94
|
.info as MessageV2.Assistant;
|
|
84
95
|
const small = await Provider.getSmallModel(assistantMsg.providerID);
|