@compilr-dev/agents 0.3.24 → 0.3.26
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/agent.d.ts +49 -74
- package/dist/agent.js +98 -106
- package/dist/costs/tracker.d.ts +1 -1
- package/dist/costs/tracker.js +1 -1
- package/dist/providers/claude.d.ts +1 -1
- package/dist/providers/claude.js +1 -1
- package/dist/providers/openrouter.d.ts +2 -2
- package/dist/providers/openrouter.js +2 -2
- package/package.json +1 -1
package/dist/agent.d.ts
CHANGED
|
@@ -348,9 +348,9 @@ export interface AgentConfig {
|
|
|
348
348
|
*/
|
|
349
349
|
checkpointOnAbort?: boolean;
|
|
350
350
|
/**
|
|
351
|
-
*
|
|
351
|
+
* Pin manager options for critical information that survives context compaction.
|
|
352
352
|
*
|
|
353
|
-
*
|
|
353
|
+
* Pins are pieces of information that:
|
|
354
354
|
* - Never get compacted - Survive all context management
|
|
355
355
|
* - Always re-injected - Present in every LLM call
|
|
356
356
|
* - Scoped - Session, persistent, or temporary
|
|
@@ -359,7 +359,7 @@ export interface AgentConfig {
|
|
|
359
359
|
* ```typescript
|
|
360
360
|
* const agent = new Agent({
|
|
361
361
|
* provider,
|
|
362
|
-
*
|
|
362
|
+
* pins: {
|
|
363
363
|
* maxAnchors: 20,
|
|
364
364
|
* maxTokens: 2000,
|
|
365
365
|
* persistPath: '~/.myapp/anchors.json',
|
|
@@ -368,6 +368,8 @@ export interface AgentConfig {
|
|
|
368
368
|
* });
|
|
369
369
|
* ```
|
|
370
370
|
*/
|
|
371
|
+
pins?: AnchorManagerOptions;
|
|
372
|
+
/** @deprecated Use `pins` instead */
|
|
371
373
|
anchors?: AnchorManagerOptions;
|
|
372
374
|
/**
|
|
373
375
|
* Guardrail options for pattern-based safety checks.
|
|
@@ -865,9 +867,9 @@ export declare class Agent {
|
|
|
865
867
|
*/
|
|
866
868
|
private readonly subAgents;
|
|
867
869
|
/**
|
|
868
|
-
*
|
|
870
|
+
* Pin manager for critical information that survives context compaction
|
|
869
871
|
*/
|
|
870
|
-
private readonly
|
|
872
|
+
private readonly pinManager?;
|
|
871
873
|
/**
|
|
872
874
|
* Guardrail manager for pattern-based safety checks
|
|
873
875
|
*/
|
|
@@ -1029,99 +1031,72 @@ export declare class Agent {
|
|
|
1029
1031
|
*/
|
|
1030
1032
|
recordUsage(model: string, provider: string, tokens: TokenUsage): void;
|
|
1031
1033
|
/**
|
|
1032
|
-
* Add
|
|
1034
|
+
* Add a pin (critical information that survives context compaction).
|
|
1033
1035
|
*
|
|
1034
|
-
*
|
|
1036
|
+
* Pins are injected into every LLM call and never get compacted.
|
|
1035
1037
|
* Use them for information that must not be forgotten.
|
|
1036
1038
|
*
|
|
1037
|
-
* @param input -
|
|
1038
|
-
* @returns The created
|
|
1039
|
+
* @param input - Pin input (uses AnchorInput type)
|
|
1040
|
+
* @returns The created pin, or undefined if pins are not enabled
|
|
1039
1041
|
*
|
|
1040
1042
|
* @example
|
|
1041
1043
|
* ```typescript
|
|
1042
|
-
*
|
|
1043
|
-
*
|
|
1044
|
-
* content: 'This session we implemented: edit tool, grep tool',
|
|
1045
|
-
* priority: 'critical',
|
|
1046
|
-
* scope: 'session',
|
|
1047
|
-
* });
|
|
1048
|
-
*
|
|
1049
|
-
* // Safety anchor - persisted across sessions
|
|
1050
|
-
* agent.addAnchor({
|
|
1051
|
-
* content: 'Never delete files in /important without confirmation',
|
|
1052
|
-
* priority: 'safety',
|
|
1053
|
-
* scope: 'persistent',
|
|
1054
|
-
* });
|
|
1055
|
-
*
|
|
1056
|
-
* // Temporary anchor - expires after 1 hour
|
|
1057
|
-
* agent.addAnchor({
|
|
1058
|
-
* content: 'Currently working on feature X',
|
|
1044
|
+
* agent.addPin({
|
|
1045
|
+
* content: 'Team roster: $default, $arch',
|
|
1059
1046
|
* priority: 'info',
|
|
1060
|
-
* scope: '
|
|
1061
|
-
* expiresAt: new Date(Date.now() + 60 * 60 * 1000),
|
|
1047
|
+
* scope: 'session',
|
|
1062
1048
|
* });
|
|
1063
1049
|
* ```
|
|
1064
1050
|
*/
|
|
1065
|
-
|
|
1051
|
+
addPin(input: AnchorInput): Anchor | undefined;
|
|
1066
1052
|
/**
|
|
1067
|
-
* Get
|
|
1053
|
+
* Get a pin by ID
|
|
1068
1054
|
*/
|
|
1069
|
-
|
|
1055
|
+
getPin(id: string): Anchor | undefined;
|
|
1070
1056
|
/**
|
|
1071
|
-
* Get all
|
|
1072
|
-
*
|
|
1073
|
-
* @param options - Query options for filtering
|
|
1074
|
-
* @returns Array of anchors
|
|
1075
|
-
*
|
|
1076
|
-
* @example
|
|
1077
|
-
* ```typescript
|
|
1078
|
-
* // Get all anchors
|
|
1079
|
-
* const all = agent.getAnchors();
|
|
1080
|
-
*
|
|
1081
|
-
* // Get only safety anchors
|
|
1082
|
-
* const safety = agent.getAnchors({ priority: 'safety' });
|
|
1083
|
-
*
|
|
1084
|
-
* // Get session anchors with specific tags
|
|
1085
|
-
* const tagged = agent.getAnchors({ scope: 'session', tags: ['files'] });
|
|
1086
|
-
* ```
|
|
1057
|
+
* Get all pins, optionally filtered
|
|
1087
1058
|
*/
|
|
1088
|
-
|
|
1059
|
+
getPins(options?: AnchorQueryOptions): Anchor[];
|
|
1089
1060
|
/**
|
|
1090
|
-
* Check if
|
|
1061
|
+
* Check if a pin exists
|
|
1091
1062
|
*/
|
|
1092
|
-
|
|
1063
|
+
hasPin(id: string): boolean;
|
|
1093
1064
|
/**
|
|
1094
|
-
* Remove
|
|
1065
|
+
* Remove a pin by ID
|
|
1095
1066
|
*
|
|
1096
|
-
* @returns true if
|
|
1067
|
+
* @returns true if pin was removed, false if not found
|
|
1097
1068
|
*/
|
|
1098
|
-
|
|
1069
|
+
removePin(id: string): boolean;
|
|
1099
1070
|
/**
|
|
1100
|
-
* Clear
|
|
1101
|
-
*
|
|
1102
|
-
* @param options - Clear options for filtering which anchors to remove
|
|
1103
|
-
* @returns Number of anchors removed
|
|
1104
|
-
*
|
|
1105
|
-
* @example
|
|
1106
|
-
* ```typescript
|
|
1107
|
-
* // Clear all session anchors
|
|
1108
|
-
* agent.clearAnchors({ scope: 'session' });
|
|
1109
|
-
*
|
|
1110
|
-
* // Clear expired temporary anchors
|
|
1111
|
-
* agent.clearAnchors({ expiredOnly: true });
|
|
1071
|
+
* Clear pins based on criteria
|
|
1112
1072
|
*
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1115
|
-
* ```
|
|
1073
|
+
* @param options - Clear options for filtering which pins to remove
|
|
1074
|
+
* @returns Number of pins removed
|
|
1116
1075
|
*/
|
|
1117
|
-
|
|
1076
|
+
clearPins(options?: AnchorClearOptions): number;
|
|
1118
1077
|
/**
|
|
1119
|
-
* Get the
|
|
1078
|
+
* Get the pin manager (if configured)
|
|
1120
1079
|
*/
|
|
1121
|
-
|
|
1080
|
+
getPinManager(): AnchorManager | undefined;
|
|
1122
1081
|
/**
|
|
1123
|
-
* Check if
|
|
1082
|
+
* Check if pins are enabled
|
|
1124
1083
|
*/
|
|
1084
|
+
hasPins(): boolean;
|
|
1085
|
+
/** @deprecated Use addPin() instead */
|
|
1086
|
+
addAnchor(input: AnchorInput): Anchor | undefined;
|
|
1087
|
+
/** @deprecated Use getPin() instead */
|
|
1088
|
+
getAnchor(id: string): Anchor | undefined;
|
|
1089
|
+
/** @deprecated Use getPins() instead */
|
|
1090
|
+
getAnchors(options?: AnchorQueryOptions): Anchor[];
|
|
1091
|
+
/** @deprecated Use hasPin() instead */
|
|
1092
|
+
hasAnchor(id: string): boolean;
|
|
1093
|
+
/** @deprecated Use removePin() instead */
|
|
1094
|
+
removeAnchor(id: string): boolean;
|
|
1095
|
+
/** @deprecated Use clearPins() instead */
|
|
1096
|
+
clearAnchors(options?: AnchorClearOptions): number;
|
|
1097
|
+
/** @deprecated Use getPinManager() instead */
|
|
1098
|
+
getAnchorManager(): AnchorManager | undefined;
|
|
1099
|
+
/** @deprecated Use hasPins() instead */
|
|
1125
1100
|
hasAnchors(): boolean;
|
|
1126
1101
|
/**
|
|
1127
1102
|
* Add a custom guardrail
|
|
@@ -1657,8 +1632,8 @@ export declare class Agent {
|
|
|
1657
1632
|
* Generate a summary of messages using the LLM provider.
|
|
1658
1633
|
* Used for context summarization when approaching limits.
|
|
1659
1634
|
*
|
|
1660
|
-
* If
|
|
1661
|
-
* information related to
|
|
1635
|
+
* If pins are configured, the summary will prioritize keeping
|
|
1636
|
+
* information related to pinned content (pin-weighted summarization).
|
|
1662
1637
|
*/
|
|
1663
1638
|
private generateSummary;
|
|
1664
1639
|
/**
|
package/dist/agent.js
CHANGED
|
@@ -69,9 +69,9 @@ export class Agent {
|
|
|
69
69
|
*/
|
|
70
70
|
subAgents = new Map();
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* Pin manager for critical information that survives context compaction
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
pinManager;
|
|
75
75
|
/**
|
|
76
76
|
* Guardrail manager for pattern-based safety checks
|
|
77
77
|
*/
|
|
@@ -145,9 +145,11 @@ export class Agent {
|
|
|
145
145
|
this.autoCheckpoint = config.autoCheckpoint ?? false;
|
|
146
146
|
this.checkpointOnAbort = config.checkpointOnAbort ?? false;
|
|
147
147
|
this._createdAt = new Date().toISOString();
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
// Pin management (backwards compat: accept `anchors` as alias for `pins`)
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
150
|
+
const pinConfig = config.pins ?? config.anchors;
|
|
151
|
+
if (pinConfig !== undefined) {
|
|
152
|
+
this.pinManager = new AnchorManager(pinConfig);
|
|
151
153
|
}
|
|
152
154
|
// Guardrail management
|
|
153
155
|
if (config.guardrails !== undefined) {
|
|
@@ -427,128 +429,118 @@ export class Agent {
|
|
|
427
429
|
this.usageTracker?.record({ model, provider, tokens });
|
|
428
430
|
}
|
|
429
431
|
// ==========================================================================
|
|
430
|
-
//
|
|
432
|
+
// Pin Management - Critical information that survives context compaction
|
|
431
433
|
// ==========================================================================
|
|
432
434
|
/**
|
|
433
|
-
* Add
|
|
435
|
+
* Add a pin (critical information that survives context compaction).
|
|
434
436
|
*
|
|
435
|
-
*
|
|
437
|
+
* Pins are injected into every LLM call and never get compacted.
|
|
436
438
|
* Use them for information that must not be forgotten.
|
|
437
439
|
*
|
|
438
|
-
* @param input -
|
|
439
|
-
* @returns The created
|
|
440
|
+
* @param input - Pin input (uses AnchorInput type)
|
|
441
|
+
* @returns The created pin, or undefined if pins are not enabled
|
|
440
442
|
*
|
|
441
443
|
* @example
|
|
442
444
|
* ```typescript
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
* content: 'This session we implemented: edit tool, grep tool',
|
|
446
|
-
* priority: 'critical',
|
|
447
|
-
* scope: 'session',
|
|
448
|
-
* });
|
|
449
|
-
*
|
|
450
|
-
* // Safety anchor - persisted across sessions
|
|
451
|
-
* agent.addAnchor({
|
|
452
|
-
* content: 'Never delete files in /important without confirmation',
|
|
453
|
-
* priority: 'safety',
|
|
454
|
-
* scope: 'persistent',
|
|
455
|
-
* });
|
|
456
|
-
*
|
|
457
|
-
* // Temporary anchor - expires after 1 hour
|
|
458
|
-
* agent.addAnchor({
|
|
459
|
-
* content: 'Currently working on feature X',
|
|
445
|
+
* agent.addPin({
|
|
446
|
+
* content: 'Team roster: $default, $arch',
|
|
460
447
|
* priority: 'info',
|
|
461
|
-
* scope: '
|
|
462
|
-
* expiresAt: new Date(Date.now() + 60 * 60 * 1000),
|
|
448
|
+
* scope: 'session',
|
|
463
449
|
* });
|
|
464
450
|
* ```
|
|
465
451
|
*/
|
|
466
|
-
|
|
467
|
-
if (!this.
|
|
452
|
+
addPin(input) {
|
|
453
|
+
if (!this.pinManager)
|
|
468
454
|
return undefined;
|
|
469
|
-
const anchor = this.
|
|
455
|
+
const anchor = this.pinManager.add(input);
|
|
470
456
|
this.onEvent?.({ type: 'anchor_added', anchor });
|
|
471
457
|
return anchor;
|
|
472
458
|
}
|
|
473
459
|
/**
|
|
474
|
-
* Get
|
|
460
|
+
* Get a pin by ID
|
|
475
461
|
*/
|
|
476
|
-
|
|
477
|
-
return this.
|
|
462
|
+
getPin(id) {
|
|
463
|
+
return this.pinManager?.get(id);
|
|
478
464
|
}
|
|
479
465
|
/**
|
|
480
|
-
* Get all
|
|
481
|
-
*
|
|
482
|
-
* @param options - Query options for filtering
|
|
483
|
-
* @returns Array of anchors
|
|
484
|
-
*
|
|
485
|
-
* @example
|
|
486
|
-
* ```typescript
|
|
487
|
-
* // Get all anchors
|
|
488
|
-
* const all = agent.getAnchors();
|
|
489
|
-
*
|
|
490
|
-
* // Get only safety anchors
|
|
491
|
-
* const safety = agent.getAnchors({ priority: 'safety' });
|
|
492
|
-
*
|
|
493
|
-
* // Get session anchors with specific tags
|
|
494
|
-
* const tagged = agent.getAnchors({ scope: 'session', tags: ['files'] });
|
|
495
|
-
* ```
|
|
466
|
+
* Get all pins, optionally filtered
|
|
496
467
|
*/
|
|
497
|
-
|
|
498
|
-
return this.
|
|
468
|
+
getPins(options) {
|
|
469
|
+
return this.pinManager?.getAll(options) ?? [];
|
|
499
470
|
}
|
|
500
471
|
/**
|
|
501
|
-
* Check if
|
|
472
|
+
* Check if a pin exists
|
|
502
473
|
*/
|
|
503
|
-
|
|
504
|
-
return this.
|
|
474
|
+
hasPin(id) {
|
|
475
|
+
return this.pinManager?.has(id) ?? false;
|
|
505
476
|
}
|
|
506
477
|
/**
|
|
507
|
-
* Remove
|
|
478
|
+
* Remove a pin by ID
|
|
508
479
|
*
|
|
509
|
-
* @returns true if
|
|
480
|
+
* @returns true if pin was removed, false if not found
|
|
510
481
|
*/
|
|
511
|
-
|
|
512
|
-
if (!this.
|
|
482
|
+
removePin(id) {
|
|
483
|
+
if (!this.pinManager)
|
|
513
484
|
return false;
|
|
514
|
-
const removed = this.
|
|
485
|
+
const removed = this.pinManager.remove(id);
|
|
515
486
|
if (removed) {
|
|
516
487
|
this.onEvent?.({ type: 'anchor_removed', anchorId: id });
|
|
517
488
|
}
|
|
518
489
|
return removed;
|
|
519
490
|
}
|
|
520
491
|
/**
|
|
521
|
-
* Clear
|
|
522
|
-
*
|
|
523
|
-
* @param options - Clear options for filtering which anchors to remove
|
|
524
|
-
* @returns Number of anchors removed
|
|
492
|
+
* Clear pins based on criteria
|
|
525
493
|
*
|
|
526
|
-
* @
|
|
527
|
-
*
|
|
528
|
-
* // Clear all session anchors
|
|
529
|
-
* agent.clearAnchors({ scope: 'session' });
|
|
530
|
-
*
|
|
531
|
-
* // Clear expired temporary anchors
|
|
532
|
-
* agent.clearAnchors({ expiredOnly: true });
|
|
533
|
-
*
|
|
534
|
-
* // Clear anchors with specific tags
|
|
535
|
-
* agent.clearAnchors({ tags: ['auto'] });
|
|
536
|
-
* ```
|
|
494
|
+
* @param options - Clear options for filtering which pins to remove
|
|
495
|
+
* @returns Number of pins removed
|
|
537
496
|
*/
|
|
538
|
-
|
|
539
|
-
return this.
|
|
497
|
+
clearPins(options) {
|
|
498
|
+
return this.pinManager?.clear(options) ?? 0;
|
|
540
499
|
}
|
|
541
500
|
/**
|
|
542
|
-
* Get the
|
|
501
|
+
* Get the pin manager (if configured)
|
|
543
502
|
*/
|
|
544
|
-
|
|
545
|
-
return this.
|
|
503
|
+
getPinManager() {
|
|
504
|
+
return this.pinManager;
|
|
546
505
|
}
|
|
547
506
|
/**
|
|
548
|
-
* Check if
|
|
507
|
+
* Check if pins are enabled
|
|
549
508
|
*/
|
|
509
|
+
hasPins() {
|
|
510
|
+
return this.pinManager !== undefined;
|
|
511
|
+
}
|
|
512
|
+
// --- Deprecated aliases (use pin methods instead) --------------------------
|
|
513
|
+
/** @deprecated Use addPin() instead */
|
|
514
|
+
addAnchor(input) {
|
|
515
|
+
return this.addPin(input);
|
|
516
|
+
}
|
|
517
|
+
/** @deprecated Use getPin() instead */
|
|
518
|
+
getAnchor(id) {
|
|
519
|
+
return this.getPin(id);
|
|
520
|
+
}
|
|
521
|
+
/** @deprecated Use getPins() instead */
|
|
522
|
+
getAnchors(options) {
|
|
523
|
+
return this.getPins(options);
|
|
524
|
+
}
|
|
525
|
+
/** @deprecated Use hasPin() instead */
|
|
526
|
+
hasAnchor(id) {
|
|
527
|
+
return this.hasPin(id);
|
|
528
|
+
}
|
|
529
|
+
/** @deprecated Use removePin() instead */
|
|
530
|
+
removeAnchor(id) {
|
|
531
|
+
return this.removePin(id);
|
|
532
|
+
}
|
|
533
|
+
/** @deprecated Use clearPins() instead */
|
|
534
|
+
clearAnchors(options) {
|
|
535
|
+
return this.clearPins(options);
|
|
536
|
+
}
|
|
537
|
+
/** @deprecated Use getPinManager() instead */
|
|
538
|
+
getAnchorManager() {
|
|
539
|
+
return this.getPinManager();
|
|
540
|
+
}
|
|
541
|
+
/** @deprecated Use hasPins() instead */
|
|
550
542
|
hasAnchors() {
|
|
551
|
-
return this.
|
|
543
|
+
return this.hasPins();
|
|
552
544
|
}
|
|
553
545
|
// ==========================================================================
|
|
554
546
|
// Guardrail Management - Pattern-based safety checks
|
|
@@ -1535,25 +1527,25 @@ export class Agent {
|
|
|
1535
1527
|
// Build messages: system prompt + history + new user message
|
|
1536
1528
|
let messages = [];
|
|
1537
1529
|
// Add system message if present
|
|
1538
|
-
// NOTE:
|
|
1530
|
+
// NOTE: Pins are appended to the system prompt (not a separate message)
|
|
1539
1531
|
// to avoid multiple system messages which can confuse Claude's role identity
|
|
1540
1532
|
let systemContent = this.systemPrompt;
|
|
1541
|
-
// Inject
|
|
1542
|
-
if (this.
|
|
1543
|
-
const
|
|
1544
|
-
if (
|
|
1545
|
-
// Insert
|
|
1533
|
+
// Inject pins into the system prompt (not as separate message)
|
|
1534
|
+
if (this.pinManager && this.pinManager.size > 0) {
|
|
1535
|
+
const pinsContent = this.pinManager.format();
|
|
1536
|
+
if (pinsContent) {
|
|
1537
|
+
// Insert pins BEFORE the role ending (if present) so role reinforcement stays at the end
|
|
1546
1538
|
const roleEndingMarker = '## YOUR ASSIGNED ROLE:';
|
|
1547
1539
|
const roleEndingIndex = systemContent.indexOf(roleEndingMarker);
|
|
1548
1540
|
if (roleEndingIndex > 0) {
|
|
1549
|
-
// Insert
|
|
1541
|
+
// Insert pins before the role ending
|
|
1550
1542
|
const beforeRole = systemContent.substring(0, roleEndingIndex);
|
|
1551
1543
|
const roleEnding = systemContent.substring(roleEndingIndex);
|
|
1552
|
-
systemContent = `${beforeRole}\n\n---\n\n##
|
|
1544
|
+
systemContent = `${beforeRole}\n\n---\n\n## Pinned Context (Critical Information)\n\n${pinsContent}\n\n---\n\n${roleEnding}`;
|
|
1553
1545
|
}
|
|
1554
1546
|
else {
|
|
1555
|
-
// No role ending, just append
|
|
1556
|
-
systemContent = `${systemContent}\n\n---\n\n##
|
|
1547
|
+
// No role ending, just append pins
|
|
1548
|
+
systemContent = `${systemContent}\n\n---\n\n## Pinned Context (Critical Information)\n\n${pinsContent}`;
|
|
1557
1549
|
}
|
|
1558
1550
|
}
|
|
1559
1551
|
}
|
|
@@ -2498,25 +2490,25 @@ export class Agent {
|
|
|
2498
2490
|
* Generate a summary of messages using the LLM provider.
|
|
2499
2491
|
* Used for context summarization when approaching limits.
|
|
2500
2492
|
*
|
|
2501
|
-
* If
|
|
2502
|
-
* information related to
|
|
2493
|
+
* If pins are configured, the summary will prioritize keeping
|
|
2494
|
+
* information related to pinned content (pin-weighted summarization).
|
|
2503
2495
|
*/
|
|
2504
2496
|
async generateSummary(messages) {
|
|
2505
|
-
// Build
|
|
2497
|
+
// Build pin context if available (for weighted summarization)
|
|
2506
2498
|
let anchorContext = '';
|
|
2507
|
-
if (this.
|
|
2508
|
-
const
|
|
2509
|
-
if (
|
|
2510
|
-
const
|
|
2499
|
+
if (this.pinManager && this.pinManager.size > 0) {
|
|
2500
|
+
const pins = this.pinManager.getAll();
|
|
2501
|
+
if (pins.length > 0) {
|
|
2502
|
+
const pinItems = pins.map((a) => `- [${a.priority}] ${a.content}`).join('\n');
|
|
2511
2503
|
anchorContext = `
|
|
2512
|
-
## PRIORITY CONTEXT (
|
|
2504
|
+
## PRIORITY CONTEXT (Pinned)
|
|
2513
2505
|
|
|
2514
|
-
The following are
|
|
2515
|
-
PRIORITIZE keeping information that relates to these
|
|
2506
|
+
The following are pinned items that should be preserved in context. When summarizing,
|
|
2507
|
+
PRIORITIZE keeping information that relates to these pins:
|
|
2516
2508
|
|
|
2517
|
-
${
|
|
2509
|
+
${pinItems}
|
|
2518
2510
|
|
|
2519
|
-
Ensure the summary captures any conversation details related to these
|
|
2511
|
+
Ensure the summary captures any conversation details related to these pinned items.
|
|
2520
2512
|
`;
|
|
2521
2513
|
}
|
|
2522
2514
|
}
|
|
@@ -2525,7 +2517,7 @@ Ensure the summary captures any conversation details related to these anchors.
|
|
|
2525
2517
|
2. Important context established
|
|
2526
2518
|
3. Tasks completed or in progress
|
|
2527
2519
|
4. Any relevant file paths or code snippets mentioned
|
|
2528
|
-
${anchorContext ? '5. Information related to the priority
|
|
2520
|
+
${anchorContext ? '5. Information related to the pinned priority items below' : ''}
|
|
2529
2521
|
${anchorContext}
|
|
2530
2522
|
Keep the summary under 500 words.
|
|
2531
2523
|
|
package/dist/costs/tracker.d.ts
CHANGED
package/dist/costs/tracker.js
CHANGED
package/dist/providers/claude.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
9
|
* const provider = createOpenRouterProvider({
|
|
10
|
-
* model: 'anthropic/claude-
|
|
10
|
+
* model: 'anthropic/claude-sonnet-4-6',
|
|
11
11
|
* apiKey: process.env.OPENROUTER_API_KEY
|
|
12
12
|
* });
|
|
13
13
|
* ```
|
|
@@ -88,7 +88,7 @@ export declare class OpenRouterProvider extends OpenAICompatibleProvider {
|
|
|
88
88
|
*
|
|
89
89
|
* // With custom model and site attribution
|
|
90
90
|
* const provider = createOpenRouterProvider({
|
|
91
|
-
* model: 'anthropic/claude-
|
|
91
|
+
* model: 'anthropic/claude-sonnet-4-6',
|
|
92
92
|
* siteUrl: 'https://myapp.com',
|
|
93
93
|
* siteName: 'My App'
|
|
94
94
|
* });
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
9
|
* const provider = createOpenRouterProvider({
|
|
10
|
-
* model: 'anthropic/claude-
|
|
10
|
+
* model: 'anthropic/claude-sonnet-4-6',
|
|
11
11
|
* apiKey: process.env.OPENROUTER_API_KEY
|
|
12
12
|
* });
|
|
13
13
|
* ```
|
|
@@ -128,7 +128,7 @@ export class OpenRouterProvider extends OpenAICompatibleProvider {
|
|
|
128
128
|
*
|
|
129
129
|
* // With custom model and site attribution
|
|
130
130
|
* const provider = createOpenRouterProvider({
|
|
131
|
-
* model: 'anthropic/claude-
|
|
131
|
+
* model: 'anthropic/claude-sonnet-4-6',
|
|
132
132
|
* siteUrl: 'https://myapp.com',
|
|
133
133
|
* siteName: 'My App'
|
|
134
134
|
* });
|