@calliopelabs/cli 0.6.11 → 0.7.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/README.md +455 -156
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +165 -1
- package/dist/cli.js.map +1 -1
- package/dist/storage.d.ts +25 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +77 -0
- package/dist/storage.js.map +1 -1
- package/dist/ui-cli.d.ts.map +1 -1
- package/dist/ui-cli.js +651 -32
- package/dist/ui-cli.js.map +1 -1
- package/package.json +2 -2
- package/dist/context-warnings.d.ts +0 -47
- package/dist/context-warnings.d.ts.map +0 -1
- package/dist/context-warnings.js +0 -123
- package/dist/context-warnings.js.map +0 -1
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calliope CLI - Context Warnings
|
|
3
|
-
*
|
|
4
|
-
* Utilities for proactive context limit warnings and management suggestions.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Get context limit for a model
|
|
8
|
-
*/
|
|
9
|
-
export declare function getContextLimit(model: string): number;
|
|
10
|
-
/**
|
|
11
|
-
* Warning thresholds
|
|
12
|
-
*/
|
|
13
|
-
export declare const WARNING_THRESHOLDS: {
|
|
14
|
-
notice: number;
|
|
15
|
-
warning: number;
|
|
16
|
-
critical: number;
|
|
17
|
-
};
|
|
18
|
-
export type WarningLevel = 'none' | 'notice' | 'warning' | 'critical';
|
|
19
|
-
export interface ContextStatus {
|
|
20
|
-
tokens: number;
|
|
21
|
-
limit: number;
|
|
22
|
-
percentage: number;
|
|
23
|
-
level: WarningLevel;
|
|
24
|
-
message?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Get context status with warning level
|
|
28
|
-
*/
|
|
29
|
-
export declare function getContextStatus(tokens: number, model: string): ContextStatus;
|
|
30
|
-
/**
|
|
31
|
-
* Check if context warning should be shown
|
|
32
|
-
* Returns message if warning needed, undefined otherwise
|
|
33
|
-
*/
|
|
34
|
-
export declare function checkContextWarning(currentTokens: number, previousTokens: number, model: string): string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Get suggestions for managing context
|
|
37
|
-
*/
|
|
38
|
-
export declare function getContextSuggestions(percentage: number): string[];
|
|
39
|
-
/**
|
|
40
|
-
* Format tokens for display
|
|
41
|
-
*/
|
|
42
|
-
export declare function formatTokenCount(tokens: number): string;
|
|
43
|
-
/**
|
|
44
|
-
* Get color for context percentage
|
|
45
|
-
*/
|
|
46
|
-
export declare function getContextColor(percentage: number): 'green' | 'yellow' | 'red';
|
|
47
|
-
//# sourceMappingURL=context-warnings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-warnings.d.ts","sourceRoot":"","sources":["../src/context-warnings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;CAI9B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAEtE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAyB7E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAUpB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAclE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQvD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAI9E"}
|
package/dist/context-warnings.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calliope CLI - Context Warnings
|
|
3
|
-
*
|
|
4
|
-
* Utilities for proactive context limit warnings and management suggestions.
|
|
5
|
-
*/
|
|
6
|
-
// Context window limits by model family (approximate token counts)
|
|
7
|
-
const CONTEXT_LIMITS = {
|
|
8
|
-
'claude-sonnet-4': 200000,
|
|
9
|
-
'claude-opus-4': 200000,
|
|
10
|
-
'claude-3': 200000,
|
|
11
|
-
'gpt-4o': 128000,
|
|
12
|
-
'gpt-4-turbo': 128000,
|
|
13
|
-
'gpt-4': 8192,
|
|
14
|
-
'gemini-2': 1000000,
|
|
15
|
-
'gemini-1.5-pro': 1000000,
|
|
16
|
-
'gemini-1.5-flash': 1000000,
|
|
17
|
-
'llama-3.3': 128000,
|
|
18
|
-
'llama-3.1': 128000,
|
|
19
|
-
'mistral-large': 128000,
|
|
20
|
-
'default': 32000,
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Get context limit for a model
|
|
24
|
-
*/
|
|
25
|
-
export function getContextLimit(model) {
|
|
26
|
-
const lowerModel = model.toLowerCase();
|
|
27
|
-
for (const [key, limit] of Object.entries(CONTEXT_LIMITS)) {
|
|
28
|
-
if (lowerModel.includes(key.toLowerCase())) {
|
|
29
|
-
return limit;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return CONTEXT_LIMITS.default;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Warning thresholds
|
|
36
|
-
*/
|
|
37
|
-
export const WARNING_THRESHOLDS = {
|
|
38
|
-
notice: 0.5, // 50% - just informational
|
|
39
|
-
warning: 0.75, // 75% - suggest compacting
|
|
40
|
-
critical: 0.9, // 90% - strongly suggest action
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Get context status with warning level
|
|
44
|
-
*/
|
|
45
|
-
export function getContextStatus(tokens, model) {
|
|
46
|
-
const limit = getContextLimit(model);
|
|
47
|
-
const percentage = tokens / limit;
|
|
48
|
-
let level = 'none';
|
|
49
|
-
let message;
|
|
50
|
-
if (percentage >= WARNING_THRESHOLDS.critical) {
|
|
51
|
-
level = 'critical';
|
|
52
|
-
message = `⚠️ Context at ${Math.round(percentage * 100)}% capacity! Consider: /summarize compact or /clear`;
|
|
53
|
-
}
|
|
54
|
-
else if (percentage >= WARNING_THRESHOLDS.warning) {
|
|
55
|
-
level = 'warning';
|
|
56
|
-
message = `Context at ${Math.round(percentage * 100)}%. Consider /summarize compact to free space.`;
|
|
57
|
-
}
|
|
58
|
-
else if (percentage >= WARNING_THRESHOLDS.notice) {
|
|
59
|
-
level = 'notice';
|
|
60
|
-
// No message for notice level - just color indicator in status bar
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
tokens,
|
|
64
|
-
limit,
|
|
65
|
-
percentage,
|
|
66
|
-
level,
|
|
67
|
-
message,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Check if context warning should be shown
|
|
72
|
-
* Returns message if warning needed, undefined otherwise
|
|
73
|
-
*/
|
|
74
|
-
export function checkContextWarning(currentTokens, previousTokens, model) {
|
|
75
|
-
const current = getContextStatus(currentTokens, model);
|
|
76
|
-
const previous = getContextStatus(previousTokens, model);
|
|
77
|
-
// Only show warning when crossing a threshold
|
|
78
|
-
if (current.level !== previous.level && current.level !== 'none') {
|
|
79
|
-
return current.message;
|
|
80
|
-
}
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Get suggestions for managing context
|
|
85
|
-
*/
|
|
86
|
-
export function getContextSuggestions(percentage) {
|
|
87
|
-
const suggestions = [];
|
|
88
|
-
if (percentage >= 0.9) {
|
|
89
|
-
suggestions.push('/clear - Start fresh conversation');
|
|
90
|
-
suggestions.push('/summarize compact - Compress older messages');
|
|
91
|
-
}
|
|
92
|
-
else if (percentage >= 0.75) {
|
|
93
|
-
suggestions.push('/summarize compact - Compress context');
|
|
94
|
-
suggestions.push('Use shorter messages');
|
|
95
|
-
}
|
|
96
|
-
else if (percentage >= 0.5) {
|
|
97
|
-
suggestions.push('/summarize context - View summary');
|
|
98
|
-
}
|
|
99
|
-
return suggestions;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Format tokens for display
|
|
103
|
-
*/
|
|
104
|
-
export function formatTokenCount(tokens) {
|
|
105
|
-
if (tokens >= 1000000) {
|
|
106
|
-
return `${(tokens / 1000000).toFixed(1)}M`;
|
|
107
|
-
}
|
|
108
|
-
if (tokens >= 1000) {
|
|
109
|
-
return `${(tokens / 1000).toFixed(1)}K`;
|
|
110
|
-
}
|
|
111
|
-
return String(tokens);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Get color for context percentage
|
|
115
|
-
*/
|
|
116
|
-
export function getContextColor(percentage) {
|
|
117
|
-
if (percentage >= WARNING_THRESHOLDS.critical)
|
|
118
|
-
return 'red';
|
|
119
|
-
if (percentage >= WARNING_THRESHOLDS.warning)
|
|
120
|
-
return 'yellow';
|
|
121
|
-
return 'green';
|
|
122
|
-
}
|
|
123
|
-
//# sourceMappingURL=context-warnings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-warnings.js","sourceRoot":"","sources":["../src/context-warnings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mEAAmE;AACnE,MAAM,cAAc,GAA2B;IAC7C,iBAAiB,EAAE,MAAM;IACzB,eAAe,EAAE,MAAM;IACvB,UAAU,EAAE,MAAM;IAClB,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,M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