openvibe 0.58.3 → 0.60.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +50 -3019
  2. package/README.md +267 -98
  3. package/dist/core/agent-modes.d.ts +16 -0
  4. package/dist/core/agent-modes.d.ts.map +1 -0
  5. package/dist/core/agent-modes.js +88 -0
  6. package/dist/core/agent-modes.js.map +1 -0
  7. package/dist/core/agent-session.d.ts +26 -0
  8. package/dist/core/agent-session.d.ts.map +1 -1
  9. package/dist/core/agent-session.js +84 -1
  10. package/dist/core/agent-session.js.map +1 -1
  11. package/dist/core/compaction/compaction.d.ts.map +1 -1
  12. package/dist/core/compaction/compaction.js +1 -1
  13. package/dist/core/compaction/compaction.js.map +1 -1
  14. package/dist/core/context-architecture.d.ts +12 -0
  15. package/dist/core/context-architecture.d.ts.map +1 -0
  16. package/dist/core/context-architecture.js +14 -0
  17. package/dist/core/context-architecture.js.map +1 -0
  18. package/dist/core/context-manager.d.ts +162 -0
  19. package/dist/core/context-manager.d.ts.map +1 -0
  20. package/dist/core/context-manager.js +311 -0
  21. package/dist/core/context-manager.js.map +1 -0
  22. package/dist/core/context-provider-interface.d.ts +134 -0
  23. package/dist/core/context-provider-interface.d.ts.map +1 -0
  24. package/dist/core/context-provider-interface.js +6 -0
  25. package/dist/core/context-provider-interface.js.map +1 -0
  26. package/dist/core/context-provider-registry.d.ts +78 -0
  27. package/dist/core/context-provider-registry.d.ts.map +1 -0
  28. package/dist/core/context-provider-registry.js +164 -0
  29. package/dist/core/context-provider-registry.js.map +1 -0
  30. package/dist/core/index.d.ts +2 -0
  31. package/dist/core/index.d.ts.map +1 -1
  32. package/dist/core/index.js +9 -0
  33. package/dist/core/index.js.map +1 -1
  34. package/dist/core/large-context-provider.d.ts +87 -0
  35. package/dist/core/large-context-provider.d.ts.map +1 -0
  36. package/dist/core/large-context-provider.js +391 -0
  37. package/dist/core/large-context-provider.js.map +1 -0
  38. package/dist/core/skills.d.ts.map +1 -1
  39. package/dist/core/skills.js +52 -5
  40. package/dist/core/skills.js.map +1 -1
  41. package/dist/core/slash-commands.d.ts.map +1 -1
  42. package/dist/core/slash-commands.js +1 -0
  43. package/dist/core/slash-commands.js.map +1 -1
  44. package/dist/core/system-prompt.d.ts +6 -4
  45. package/dist/core/system-prompt.d.ts.map +1 -1
  46. package/dist/core/system-prompt.js +129 -63
  47. package/dist/core/system-prompt.js.map +1 -1
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +2 -0
  51. package/dist/index.js.map +1 -1
  52. package/dist/modes/interactive/components/skills-selector.d.ts +13 -0
  53. package/dist/modes/interactive/components/skills-selector.d.ts.map +1 -0
  54. package/dist/modes/interactive/components/skills-selector.js +49 -0
  55. package/dist/modes/interactive/components/skills-selector.js.map +1 -0
  56. package/dist/modes/interactive/interactive-mode.d.ts +2 -2
  57. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  58. package/dist/modes/interactive/interactive-mode.js +44 -37
  59. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  60. package/docs/system-prompt-template.md +176 -0
  61. package/examples/skills/README.md +93 -0
  62. package/examples/skills/api-design/SKILL.md +80 -0
  63. package/examples/skills/code-review/SKILL.md +68 -0
  64. package/examples/skills/git-workflow/SKILL.md +108 -0
  65. package/examples/skills/testing/SKILL.md +94 -0
  66. package/package.json +2 -2
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Context Provider Registry
3
+ * Central registry for managing context providers in the third-party architecture
4
+ */
5
+ import { getLargeContextProvider, LargeContextProvider } from "./large-context-provider.js";
6
+ /**
7
+ * Context Provider Registry Implementation
8
+ * Manages multiple context providers and routes requests to the appropriate one
9
+ */
10
+ export class ContextProviderRegistry {
11
+ providers = new Map();
12
+ defaultProvider;
13
+ static instance = null;
14
+ constructor() {
15
+ // Register the large context provider as default
16
+ this.defaultProvider = getLargeContextProvider();
17
+ this.register(this.defaultProvider);
18
+ }
19
+ /**
20
+ * Get the singleton instance
21
+ */
22
+ static getInstance() {
23
+ if (!ContextProviderRegistry.instance) {
24
+ ContextProviderRegistry.instance = new ContextProviderRegistry();
25
+ }
26
+ return ContextProviderRegistry.instance;
27
+ }
28
+ /**
29
+ * Register a context provider
30
+ */
31
+ register(provider) {
32
+ this.providers.set(provider.name, provider);
33
+ }
34
+ /**
35
+ * Unregister a context provider
36
+ */
37
+ unregister(name) {
38
+ if (name === this.defaultProvider.name) {
39
+ console.warn(`Cannot unregister default provider: ${name}`);
40
+ return;
41
+ }
42
+ this.providers.delete(name);
43
+ }
44
+ /**
45
+ * Get a provider by name
46
+ */
47
+ get(name) {
48
+ return this.providers.get(name);
49
+ }
50
+ /**
51
+ * Get all registered providers
52
+ */
53
+ getAll() {
54
+ return Array.from(this.providers.values());
55
+ }
56
+ /**
57
+ * Find the best provider for a model
58
+ */
59
+ findProvider(modelId) {
60
+ // Check all providers for explicit support
61
+ const providers = Array.from(this.providers.values());
62
+ for (const provider of providers) {
63
+ if (provider.supportsModel(modelId)) {
64
+ return provider;
65
+ }
66
+ }
67
+ // Fall back to default provider
68
+ return this.defaultProvider;
69
+ }
70
+ /**
71
+ * Get context configuration from any provider
72
+ */
73
+ getContextConfig(modelId) {
74
+ const provider = this.findProvider(modelId);
75
+ if (provider) {
76
+ return provider.getContextConfig(modelId);
77
+ }
78
+ // Default 1M context configuration
79
+ return {
80
+ contextWindow: 1000000,
81
+ maxTokens: 65536,
82
+ supportsStreaming: true,
83
+ supportsVision: true,
84
+ supportsFunctions: true,
85
+ };
86
+ }
87
+ /**
88
+ * Enhance a model with context configuration
89
+ * This is the main entry point for the third-party architecture
90
+ */
91
+ enhanceModel(model) {
92
+ const provider = this.findProvider(model.id);
93
+ const config = this.getContextConfig(model.id);
94
+ const originalContextWindow = model.contextWindow ?? 0;
95
+ const enhancedContextWindow = config.contextWindow;
96
+ const enhancedModel = {
97
+ ...model,
98
+ contextWindow: enhancedContextWindow,
99
+ maxTokens: config.maxTokens,
100
+ };
101
+ return {
102
+ model: enhancedModel,
103
+ provider: provider ?? this.defaultProvider,
104
+ metadata: {
105
+ originalContextWindow,
106
+ enhancedContextWindow,
107
+ enhanced: originalContextWindow !== enhancedContextWindow,
108
+ },
109
+ };
110
+ }
111
+ /**
112
+ * Check if a model has large context support
113
+ */
114
+ hasLargeContext(modelId) {
115
+ const config = this.getContextConfig(modelId);
116
+ return config.contextWindow >= 100000;
117
+ }
118
+ /**
119
+ * Check if a model has 1M context
120
+ */
121
+ hasMillionContext(modelId) {
122
+ const config = this.getContextConfig(modelId);
123
+ return config.contextWindow >= 1000000;
124
+ }
125
+ /**
126
+ * Get all models with 1M context
127
+ */
128
+ getMillionContextModels() {
129
+ const models = [];
130
+ const providers = Array.from(this.providers.values());
131
+ for (const provider of providers) {
132
+ if (provider instanceof LargeContextProvider) {
133
+ models.push(...provider.getKnownModels().filter((id) => provider.isMillionContextModel(id)));
134
+ }
135
+ }
136
+ return Array.from(new Set(models));
137
+ }
138
+ }
139
+ /**
140
+ * Singleton getter
141
+ */
142
+ export const getContextProviderRegistry = () => ContextProviderRegistry.getInstance();
143
+ /**
144
+ * Convenience function to enhance a model with context configuration
145
+ */
146
+ export function enhanceModelContext(model) {
147
+ const registry = ContextProviderRegistry.getInstance();
148
+ const enhancement = registry.enhanceModel(model);
149
+ return enhancement.model;
150
+ }
151
+ /**
152
+ * Convenience function to get context configuration for a model
153
+ */
154
+ export function getModelContextConfig(modelId) {
155
+ const registry = ContextProviderRegistry.getInstance();
156
+ return registry.getContextConfig(modelId);
157
+ }
158
+ /**
159
+ * Initialize the context provider registry
160
+ */
161
+ export function initializeContextProviders() {
162
+ return ContextProviderRegistry.getInstance();
163
+ }
164
+ //# sourceMappingURL=context-provider-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-provider-registry.js","sourceRoot":"","sources":["../../src/core/context-provider-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,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B,EAAc;IACnF,MAAM,QAAQ,GAAG,uBAAuB,CAAC,WAAW,EAAE,CAAC;IACvD,MAAM,WAAW,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACjD,OAAO,WAAW,CAAC,KAAK,CAAC;AAAA,CACzB;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAuB;IAC3E,MAAM,QAAQ,GAAG,uBAAuB,CAAC,WAAW,EAAE,CAAC;IACvD,OAAO,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAAA,CAC1C;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,GAA4B;IACrE,OAAO,uBAAuB,CAAC,WAAW,EAAE,CAAC;AAAA,CAC7C","sourcesContent":["/**\n * Context Provider Registry\n * Central registry for managing context providers in the third-party architecture\n */\n\nimport type { Api, Model } from \"@mariozechner/pi-ai\";\nimport type {\n\tIContextProvider,\n\tIContextProviderRegistry,\n\tIContextEnhancement,\n\tIModelContextConfig,\n} from \"./context-provider-interface.js\";\nimport { getLargeContextProvider, LargeContextProvider } from \"./large-context-provider.js\";\n\n/**\n * Context Provider Registry Implementation\n * Manages multiple context providers and routes requests to the appropriate one\n */\nexport class ContextProviderRegistry implements IContextProviderRegistry {\n\tprivate providers: Map<string, IContextProvider> = new Map();\n\tprivate defaultProvider: IContextProvider;\n\tprivate static instance: ContextProviderRegistry | null = null;\n\n\tprivate constructor() {\n\t\t// Register the large context provider as default\n\t\tthis.defaultProvider = getLargeContextProvider();\n\t\tthis.register(this.defaultProvider);\n\t}\n\n\t/**\n\t * Get the singleton instance\n\t */\n\tstatic getInstance(): ContextProviderRegistry {\n\t\tif (!ContextProviderRegistry.instance) {\n\t\t\tContextProviderRegistry.instance = new ContextProviderRegistry();\n\t\t}\n\t\treturn ContextProviderRegistry.instance;\n\t}\n\n\t/**\n\t * Register a context provider\n\t */\n\tregister(provider: IContextProvider): void {\n\t\tthis.providers.set(provider.name, provider);\n\t}\n\n\t/**\n\t * Unregister a context provider\n\t */\n\tunregister(name: string): void {\n\t\tif (name === this.defaultProvider.name) {\n\t\t\tconsole.warn(`Cannot unregister default provider: ${name}`);\n\t\t\treturn;\n\t\t}\n\t\tthis.providers.delete(name);\n\t}\n\n\t/**\n\t * Get a provider by name\n\t */\n\tget(name: string): IContextProvider | undefined {\n\t\treturn this.providers.get(name);\n\t}\n\n\t/**\n\t * Get all registered providers\n\t */\n\tgetAll(): IContextProvider[] {\n\t\treturn Array.from(this.providers.values());\n\t}\n\n\t/**\n\t * Find the best provider for a model\n\t */\n\tfindProvider(modelId: string): IContextProvider | undefined {\n\t\t// Check all providers for explicit support\n\t\tconst providers = Array.from(this.providers.values());\n\t\tfor (const provider of providers) {\n\t\t\tif (provider.supportsModel(modelId)) {\n\t\t\t\treturn provider;\n\t\t\t}\n\t\t}\n\n\t\t// Fall back to default provider\n\t\treturn this.defaultProvider;\n\t}\n\n\t/**\n\t * Get context configuration from any provider\n\t */\n\tgetContextConfig(modelId: string): IModelContextConfig {\n\t\tconst provider = this.findProvider(modelId);\n\t\tif (provider) {\n\t\t\treturn provider.getContextConfig(modelId);\n\t\t}\n\n\t\t// Default 1M context configuration\n\t\treturn {\n\t\t\tcontextWindow: 1000000,\n\t\t\tmaxTokens: 65536,\n\t\t\tsupportsStreaming: true,\n\t\t\tsupportsVision: true,\n\t\t\tsupportsFunctions: true,\n\t\t};\n\t}\n\n\t/**\n\t * Enhance a model with context configuration\n\t * This is the main entry point for the third-party architecture\n\t */\n\tenhanceModel<API extends Api>(model: Model<API>): IContextEnhancement<API> {\n\t\tconst provider = this.findProvider(model.id);\n\t\tconst config = this.getContextConfig(model.id);\n\n\t\tconst originalContextWindow = model.contextWindow ?? 0;\n\t\tconst enhancedContextWindow = config.contextWindow;\n\n\t\tconst enhancedModel: Model<API> = {\n\t\t\t...model,\n\t\t\tcontextWindow: enhancedContextWindow,\n\t\t\tmaxTokens: config.maxTokens,\n\t\t};\n\n\t\treturn {\n\t\t\tmodel: enhancedModel,\n\t\t\tprovider: provider ?? this.defaultProvider,\n\t\t\tmetadata: {\n\t\t\t\toriginalContextWindow,\n\t\t\t\tenhancedContextWindow,\n\t\t\t\tenhanced: originalContextWindow !== enhancedContextWindow,\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Check if a model has large context support\n\t */\n\thasLargeContext(modelId: string): boolean {\n\t\tconst config = this.getContextConfig(modelId);\n\t\treturn config.contextWindow >= 100000;\n\t}\n\n\t/**\n\t * Check if a model has 1M context\n\t */\n\thasMillionContext(modelId: string): boolean {\n\t\tconst config = this.getContextConfig(modelId);\n\t\treturn config.contextWindow >= 1000000;\n\t}\n\n\t/**\n\t * Get all models with 1M context\n\t */\n\tgetMillionContextModels(): string[] {\n\t\tconst models: string[] = [];\n\t\tconst providers = Array.from(this.providers.values());\n\n\t\tfor (const provider of providers) {\n\t\t\tif (provider instanceof LargeContextProvider) {\n\t\t\t\tmodels.push(...provider.getKnownModels().filter((id) => provider.isMillionContextModel(id)));\n\t\t\t}\n\t\t}\n\n\t\treturn Array.from(new Set(models));\n\t}\n}\n\n/**\n * Singleton getter\n */\nexport const getContextProviderRegistry = () => ContextProviderRegistry.getInstance();\n\n/**\n * Convenience function to enhance a model with context configuration\n */\nexport function enhanceModelContext<API extends Api>(model: Model<API>): Model<API> {\n\tconst registry = ContextProviderRegistry.getInstance();\n\tconst enhancement = registry.enhanceModel(model);\n\treturn enhancement.model;\n}\n\n/**\n * Convenience function to get context configuration for a model\n */\nexport function getModelContextConfig(modelId: string): IModelContextConfig {\n\tconst registry = ContextProviderRegistry.getInstance();\n\treturn registry.getContextConfig(modelId);\n}\n\n/**\n * Initialize the context provider registry\n */\nexport function initializeContextProviders(): ContextProviderRegistry {\n\treturn ContextProviderRegistry.getInstance();\n}\n"]}
@@ -1,10 +1,12 @@
1
1
  export { AcceleratedAPIClient, globalAcceleratedClient, } from "./accelerated-client.js";
2
2
  export { AcceleratedStream, globalAcceleratedStream, globalStreamMerger, StreamMerger, } from "./accelerated-stream.js";
3
3
  export { AgentSession, type AgentSessionConfig, type AgentSessionEvent, type AgentSessionEventListener, type ModelCycleResult, type PromptOptions, type SessionStats, } from "./agent-session.js";
4
+ export { type AgentMode, type AgentModeConfig, AGENT_MODES, getAllModes, getAgentModeConfig, getModePromptAddition, getModeThinkingLevel, getModeTools, getClaudeSkillsPath, } from "./agent-modes.js";
4
5
  export { APIParallelExecutor, type ConcurrencyStats, detectOptimalConcurrency, globalParallelExecutor, } from "./api-concurrency.js";
5
6
  export { type BashExecutorOptions, type BashResult, executeBash, executeBashWithOperations } from "./bash-executor.js";
6
7
  export type { CompactionResult } from "./compaction/index.js";
7
8
  export { createEventBus, type EventBus, type EventBusController } from "./event-bus.js";
9
+ export { type IContextProvider, type IModelContextConfig, type IProcessedContext, type IOverflowResult, type IContextProviderRegistry, type IContextEnhancement, LargeContextProvider, getLargeContextProvider, ContextProviderRegistry, getContextProviderRegistry, enhanceModelContext, getModelContextConfig, initializeContextProviders, ContextManager, ContextMiddleware, getContextManager, initializeContextManager, type ContextConfig, type ProviderContextConfig, type GlobalContextConfig, type ContextStats, } from "./context-architecture.js";
8
10
  export { type AgentEndEvent, type AgentStartEvent, type AgentToolResult, type AgentToolUpdateCallback, type BeforeAgentStartEvent, type ContextEvent, discoverAndLoadExtensions, type ExecOptions, type ExecResult, type Extension, type ExtensionAPI, type ExtensionCommandContext, type ExtensionContext, type ExtensionError, type ExtensionEvent, type ExtensionFactory, type ExtensionFlag, type ExtensionHandler, ExtensionRunner, type ExtensionShortcut, type ExtensionUIContext, type LoadExtensionsResult, type MessageRenderer, type RegisteredCommand, type SessionBeforeCompactEvent, type SessionBeforeForkEvent, type SessionBeforeSwitchEvent, type SessionBeforeTreeEvent, type SessionCompactEvent, type SessionForkEvent, type SessionShutdownEvent, type SessionStartEvent, type SessionSwitchEvent, type SessionTreeEvent, type ToolCallEvent, type ToolDefinition, type ToolRenderResultOptions, type ToolResultEvent, type TurnEndEvent, type TurnStartEvent, wrapToolsWithExtensions, } from "./extensions/index.js";
9
11
  export { detectCPUCores, detectGPUCount, globalMultiGPUExecutor, MultiGPUExecutor, } from "./multi-gpu-executor.js";
10
12
  export { hasConfiguredModels as checkOnboarding, runOnboarding } from "./onboarding.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,wBAAwB,EACxB,sBAAsB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACvH,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACxF,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,yBAAyB,EACzB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,uBAAuB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,IAAI,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACxF,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EACN,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,mBAAmB,GACnB,MAAM,kBAAkB,CAAC","sourcesContent":["export {\n\tAcceleratedAPIClient,\n\tglobalAcceleratedClient,\n} from \"./accelerated-client.js\";\nexport {\n\tAcceleratedStream,\n\tglobalAcceleratedStream,\n\tglobalStreamMerger,\n\tStreamMerger,\n} from \"./accelerated-stream.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype PromptOptions,\n\ttype SessionStats,\n} from \"./agent-session.js\";\nexport {\n\tAPIParallelExecutor,\n\ttype ConcurrencyStats,\n\tdetectOptimalConcurrency,\n\tglobalParallelExecutor,\n} from \"./api-concurrency.js\";\nexport { type BashExecutorOptions, type BashResult, executeBash, executeBashWithOperations } from \"./bash-executor.js\";\nexport type { CompactionResult } from \"./compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./event-bus.js\";\nexport {\n\ttype AgentEndEvent,\n\ttype AgentStartEvent,\n\ttype AgentToolResult,\n\ttype AgentToolUpdateCallback,\n\ttype BeforeAgentStartEvent,\n\ttype ContextEvent,\n\tdiscoverAndLoadExtensions,\n\ttype ExecOptions,\n\ttype ExecResult,\n\ttype Extension,\n\ttype ExtensionAPI,\n\ttype ExtensionCommandContext,\n\ttype ExtensionContext,\n\ttype ExtensionError,\n\ttype ExtensionEvent,\n\ttype ExtensionFactory,\n\ttype ExtensionFlag,\n\ttype ExtensionHandler,\n\tExtensionRunner,\n\ttype ExtensionShortcut,\n\ttype ExtensionUIContext,\n\ttype LoadExtensionsResult,\n\ttype MessageRenderer,\n\ttype RegisteredCommand,\n\ttype SessionBeforeCompactEvent,\n\ttype SessionBeforeForkEvent,\n\ttype SessionBeforeSwitchEvent,\n\ttype SessionBeforeTreeEvent,\n\ttype SessionCompactEvent,\n\ttype SessionForkEvent,\n\ttype SessionShutdownEvent,\n\ttype SessionStartEvent,\n\ttype SessionSwitchEvent,\n\ttype SessionTreeEvent,\n\ttype ToolCallEvent,\n\ttype ToolDefinition,\n\ttype ToolRenderResultOptions,\n\ttype ToolResultEvent,\n\ttype TurnEndEvent,\n\ttype TurnStartEvent,\n\twrapToolsWithExtensions,\n} from \"./extensions/index.js\";\nexport {\n\tdetectCPUCores,\n\tdetectGPUCount,\n\tglobalMultiGPUExecutor,\n\tMultiGPUExecutor,\n} from \"./multi-gpu-executor.js\";\nexport { hasConfiguredModels as checkOnboarding, runOnboarding } from \"./onboarding.js\";\nexport type { BrandSettings, ModelConfig, UserConfig } from \"./user-config.js\";\nexport {\n\tgetActiveModel,\n\thasConfiguredModels,\n\tloadUserConfig,\n\tsaveUserConfig,\n\tsetModel,\n\tupdateBrandSettings,\n} from \"./user-config.js\";\n"]}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,wBAAwB,EACxB,sBAAsB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACvH,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGxF,OAAO,EAEN,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EAExB,oBAAoB,EACpB,uBAAuB,EAEvB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAE1B,cAAc,EACd,iBA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AAmB,EACnB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,mBAAmB,GACnB,MAAM,kBAAkB,CAAC","sourcesContent":["export {\n\tAcceleratedAPIClient,\n\tglobalAcceleratedClient,\n} from \"./accelerated-client.js\";\nexport {\n\tAcceleratedStream,\n\tglobalAcceleratedStream,\n\tglobalStreamMerger,\n\tStreamMerger,\n} from \"./accelerated-stream.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype PromptOptions,\n\ttype SessionStats,\n} from \"./agent-session.js\";\nexport {\n\ttype AgentMode,\n\ttype AgentModeConfig,\n\tAGENT_MODES,\n\tgetAllModes,\n\tgetAgentModeConfig,\n\tgetModePromptAddition,\n\tgetModeThinkingLevel,\n\tgetModeTools,\n\tgetClaudeSkillsPath,\n} from \"./agent-modes.js\";\nexport {\n\tAPIParallelExecutor,\n\ttype ConcurrencyStats,\n\tdetectOptimalConcurrency,\n\tglobalParallelExecutor,\n} from \"./api-concurrency.js\";\nexport { type BashExecutorOptions, type BashResult, executeBash, executeBashWithOperations } from \"./bash-executor.js\";\nexport type { CompactionResult } from \"./compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./event-bus.js\";\n\n// Context Architecture - Third-party large context support (1M tokens)\nexport {\n\t// Interfaces\n\ttype IContextProvider,\n\ttype IModelContextConfig,\n\ttype IProcessedContext,\n\ttype IOverflowResult,\n\ttype IContextProviderRegistry,\n\ttype IContextEnhancement,\n\t// Main implementation\n\tLargeContextProvider,\n\tgetLargeContextProvider,\n\t// Registry\n\tContextProviderRegistry,\n\tgetContextProviderRegistry,\n\tenhanceModelContext,\n\tgetModelContextConfig,\n\tinitializeContextProviders,\n\t// Context Manager\n\tContextManager,\n\tContextMiddleware,\n\tgetContextManager,\n\tinitializeContextManager,\n\ttype ContextConfig,\n\ttype ProviderContextConfig,\n\ttype GlobalContextConfig,\n\ttype ContextStats,\n} from \"./context-architecture.js\";\n\nexport {\n\ttype AgentEndEvent,\n\ttype AgentStartEvent,\n\ttype AgentToolResult,\n\ttype AgentToolUpdateCallback,\n\ttype BeforeAgentStartEvent,\n\ttype ContextEvent,\n\tdiscoverAndLoadExtensions,\n\ttype ExecOptions,\n\ttype ExecResult,\n\ttype Extension,\n\ttype ExtensionAPI,\n\ttype ExtensionCommandContext,\n\ttype ExtensionContext,\n\ttype ExtensionError,\n\ttype ExtensionEvent,\n\ttype ExtensionFactory,\n\ttype ExtensionFlag,\n\ttype ExtensionHandler,\n\tExtensionRunner,\n\ttype ExtensionShortcut,\n\ttype ExtensionUIContext,\n\ttype LoadExtensionsResult,\n\ttype MessageRenderer,\n\ttype RegisteredCommand,\n\ttype SessionBeforeCompactEvent,\n\ttype SessionBeforeForkEvent,\n\ttype SessionBeforeSwitchEvent,\n\ttype SessionBeforeTreeEvent,\n\ttype SessionCompactEvent,\n\ttype SessionForkEvent,\n\ttype SessionShutdownEvent,\n\ttype SessionStartEvent,\n\ttype SessionSwitchEvent,\n\ttype SessionTreeEvent,\n\ttype ToolCallEvent,\n\ttype ToolDefinition,\n\ttype ToolRenderResultOptions,\n\ttype ToolResultEvent,\n\ttype TurnEndEvent,\n\ttype TurnStartEvent,\n\twrapToolsWithExtensions,\n} from \"./extensions/index.js\";\nexport {\n\tdetectCPUCores,\n\tdetectGPUCount,\n\tglobalMultiGPUExecutor,\n\tMultiGPUExecutor,\n} from \"./multi-gpu-executor.js\";\nexport { hasConfiguredModels as checkOnboarding, runOnboarding } from \"./onboarding.js\";\nexport type { BrandSettings, ModelConfig, UserConfig } from \"./user-config.js\";\nexport {\n\tgetActiveModel,\n\thasConfiguredModels,\n\tloadUserConfig,\n\tsaveUserConfig,\n\tsetModel,\n\tupdateBrandSettings,\n} from \"./user-config.js\";\n"]}
@@ -1,9 +1,18 @@
1
1
  export { AcceleratedAPIClient, globalAcceleratedClient, } from "./accelerated-client.js";
2
2
  export { AcceleratedStream, globalAcceleratedStream, globalStreamMerger, StreamMerger, } from "./accelerated-stream.js";
3
3
  export { AgentSession, } from "./agent-session.js";
4
+ export { AGENT_MODES, getAllModes, getAgentModeConfig, getModePromptAddition, getModeThinkingLevel, getModeTools, getClaudeSkillsPath, } from "./agent-modes.js";
4
5
  export { APIParallelExecutor, detectOptimalConcurrency, globalParallelExecutor, } from "./api-concurrency.js";
5
6
  export { executeBash, executeBashWithOperations } from "./bash-executor.js";
6
7
  export { createEventBus } from "./event-bus.js";
8
+ // Context Architecture - Third-party large context support (1M tokens)
9
+ export {
10
+ // Main implementation
11
+ LargeContextProvider, getLargeContextProvider,
12
+ // Registry
13
+ ContextProviderRegistry, getContextProviderRegistry, enhanceModelContext, getModelContextConfig, initializeContextProviders,
14
+ // Context Manager
15
+ ContextManager, ContextMiddleware, getContextManager, initializeContextManager, } from "./context-architecture.js";
7
16
  export { discoverAndLoadExtensions, ExtensionRunner, wrapToolsWithExtensions, } from "./extensions/index.js";
8
17
  export { detectCPUCores, detectGPUCount, globalMultiGPUExecutor, MultiGPUExecutor, } from "./multi-gpu-executor.js";
9
18
  export { hasConfiguredModels as checkOnboarding, runOnboarding } from "./onboarding.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,YAAY,GAOZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,mBAAmB,EAEnB,wBAAwB,EACxB,sBAAsB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA6C,WAAW,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEvH,OAAO,EAAE,cAAc,EAA0C,MAAM,gBAAgB,CAAC;AACxF,OAAO,EAON,yBAAyB,EAYzB,eAAe,EAsBf,uBAAuB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,IAAI,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAExF,OAAO,EACN,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,mBAAmB,GACnB,MAAM,kBAAkB,CAAC","sourcesContent":["export {\n\tAcceleratedAPIClient,\n\tglobalAcceleratedClient,\n} from \"./accelerated-client.js\";\nexport {\n\tAcceleratedStream,\n\tglobalAcceleratedStream,\n\tglobalStreamMerger,\n\tStreamMerger,\n} from \"./accelerated-stream.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype PromptOptions,\n\ttype SessionStats,\n} from \"./agent-session.js\";\nexport {\n\tAPIParallelExecutor,\n\ttype ConcurrencyStats,\n\tdetectOptimalConcurrency,\n\tglobalParallelExecutor,\n} from \"./api-concurrency.js\";\nexport { type BashExecutorOptions, type BashResult, executeBash, executeBashWithOperations } from \"./bash-executor.js\";\nexport type { CompactionResult } from \"./compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./event-bus.js\";\nexport {\n\ttype AgentEndEvent,\n\ttype AgentStartEvent,\n\ttype AgentToolResult,\n\ttype AgentToolUpdateCallback,\n\ttype BeforeAgentStartEvent,\n\ttype ContextEvent,\n\tdiscoverAndLoadExtensions,\n\ttype ExecOptions,\n\ttype ExecResult,\n\ttype Extension,\n\ttype ExtensionAPI,\n\ttype ExtensionCommandContext,\n\ttype ExtensionContext,\n\ttype ExtensionError,\n\ttype ExtensionEvent,\n\ttype ExtensionFactory,\n\ttype ExtensionFlag,\n\ttype ExtensionHandler,\n\tExtensionRunner,\n\ttype ExtensionShortcut,\n\ttype ExtensionUIContext,\n\ttype LoadExtensionsResult,\n\ttype MessageRenderer,\n\ttype RegisteredCommand,\n\ttype SessionBeforeCompactEvent,\n\ttype SessionBeforeForkEvent,\n\ttype SessionBeforeSwitchEvent,\n\ttype SessionBeforeTreeEvent,\n\ttype SessionCompactEvent,\n\ttype SessionForkEvent,\n\ttype SessionShutdownEvent,\n\ttype SessionStartEvent,\n\ttype SessionSwitchEvent,\n\ttype SessionTreeEvent,\n\ttype ToolCallEvent,\n\ttype ToolDefinition,\n\ttype ToolRenderResultOptions,\n\ttype ToolResultEvent,\n\ttype TurnEndEvent,\n\ttype TurnStartEvent,\n\twrapToolsWithExtensions,\n} from \"./extensions/index.js\";\nexport {\n\tdetectCPUCores,\n\tdetectGPUCount,\n\tglobalMultiGPUExecutor,\n\tMultiGPUExecutor,\n} from \"./multi-gpu-executor.js\";\nexport { hasConfiguredModels as checkOnboarding, runOnboarding } from \"./onboarding.js\";\nexport type { BrandSettings, ModelConfig, UserConfig } from \"./user-config.js\";\nexport {\n\tgetActiveModel,\n\thasConfiguredModels,\n\tloadUserConfig,\n\tsaveUserConfig,\n\tsetModel,\n\tupdateBrandSettings,\n} from \"./user-config.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,YAAY,GAOZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGN,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,mBAAmB,EAEnB,wBAAwB,EACxB,sBAAsB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA6C,WAAW,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEvH,OAAO,EAAE,cAAc,EAA0C,MAAM,gBAAgB,CAAC;AAExF,uEAAuE;AACvE,OAAO;AAQN,sBAAsB;AACtB,oBAAoB,EACpB,uBAAuB;AACvB,WAAW;AACX,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B;AAC1B,kBAAkB;AAClB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,GAKxB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAON,yBAAyB,EAYzB,eAAe,EAsBf,uBAAuB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,IAAI,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAExF,OAAO,EACN,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,mBAAmB,GACnB,MAAM,kBAAkB,CAAC","sourcesContent":["export {\n\tAcceleratedAPIClient,\n\tglobalAcceleratedClient,\n} from \"./accelerated-client.js\";\nexport {\n\tAcceleratedStream,\n\tglobalAcceleratedStream,\n\tglobalStreamMerger,\n\tStreamMerger,\n} from \"./accelerated-stream.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype PromptOptions,\n\ttype SessionStats,\n} from \"./agent-session.js\";\nexport {\n\ttype AgentMode,\n\ttype AgentModeConfig,\n\tAGENT_MODES,\n\tgetAllModes,\n\tgetAgentModeConfig,\n\tgetModePromptAddition,\n\tgetModeThinkingLevel,\n\tgetModeTools,\n\tgetClaudeSkillsPath,\n} from \"./agent-modes.js\";\nexport {\n\tAPIParallelExecutor,\n\ttype ConcurrencyStats,\n\tdetectOptimalConcurrency,\n\tglobalParallelExecutor,\n} from \"./api-concurrency.js\";\nexport { type BashExecutorOptions, type BashResult, executeBash, executeBashWithOperations } from \"./bash-executor.js\";\nexport type { CompactionResult } from \"./compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./event-bus.js\";\n\n// Context Architecture - Third-party large context support (1M tokens)\nexport {\n\t// Interfaces\n\ttype IContextProvider,\n\ttype IModelContextConfig,\n\ttype IProcessedContext,\n\ttype IOverflowResult,\n\ttype IContextProviderRegistry,\n\ttype IContextEnhancement,\n\t// Main implementation\n\tLargeContextProvider,\n\tgetLargeContextProvider,\n\t// Registry\n\tContextProviderRegistry,\n\tgetContextProviderRegistry,\n\tenhanceModelContext,\n\tgetModelContextConfig,\n\tinitializeContextProviders,\n\t// Context Manager\n\tContextManager,\n\tContextMiddleware,\n\tgetContextManager,\n\tinitializeContextManager,\n\ttype ContextConfig,\n\ttype ProviderContextConfig,\n\ttype GlobalContextConfig,\n\ttype ContextStats,\n} from \"./context-architecture.js\";\n\nexport {\n\ttype AgentEndEvent,\n\ttype AgentStartEvent,\n\ttype AgentToolResult,\n\ttype AgentToolUpdateCallback,\n\ttype BeforeAgentStartEvent,\n\ttype ContextEvent,\n\tdiscoverAndLoadExtensions,\n\ttype ExecOptions,\n\ttype ExecResult,\n\ttype Extension,\n\ttype ExtensionAPI,\n\ttype ExtensionCommandContext,\n\ttype ExtensionContext,\n\ttype ExtensionError,\n\ttype ExtensionEvent,\n\ttype ExtensionFactory,\n\ttype ExtensionFlag,\n\ttype ExtensionHandler,\n\tExtensionRunner,\n\ttype ExtensionShortcut,\n\ttype ExtensionUIContext,\n\ttype LoadExtensionsResult,\n\ttype MessageRenderer,\n\ttype RegisteredCommand,\n\ttype SessionBeforeCompactEvent,\n\ttype SessionBeforeForkEvent,\n\ttype SessionBeforeSwitchEvent,\n\ttype SessionBeforeTreeEvent,\n\ttype SessionCompactEvent,\n\ttype SessionForkEvent,\n\ttype SessionShutdownEvent,\n\ttype SessionStartEvent,\n\ttype SessionSwitchEvent,\n\ttype SessionTreeEvent,\n\ttype ToolCallEvent,\n\ttype ToolDefinition,\n\ttype ToolRenderResultOptions,\n\ttype ToolResultEvent,\n\ttype TurnEndEvent,\n\ttype TurnStartEvent,\n\twrapToolsWithExtensions,\n} from \"./extensions/index.js\";\nexport {\n\tdetectCPUCores,\n\tdetectGPUCount,\n\tglobalMultiGPUExecutor,\n\tMultiGPUExecutor,\n} from \"./multi-gpu-executor.js\";\nexport { hasConfiguredModels as checkOnboarding, runOnboarding } from \"./onboarding.js\";\nexport type { BrandSettings, ModelConfig, UserConfig } from \"./user-config.js\";\nexport {\n\tgetActiveModel,\n\thasConfiguredModels,\n\tloadUserConfig,\n\tsaveUserConfig,\n\tsetModel,\n\tupdateBrandSettings,\n} from \"./user-config.js\";\n"]}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Large Context Provider Implementation
3
+ * Provides 1M context window support for compatible models
4
+ * This is a third-party architecture implementation
5
+ */
6
+ import type { Api, Model } from "@mariozechner/pi-ai";
7
+ import type { IContextProvider, IModelContextConfig, IOverflowResult, IProcessedContext } from "./context-provider-interface.js";
8
+ /**
9
+ * Model capability flags
10
+ */
11
+ interface ModelCapabilities {
12
+ supportsStreaming: boolean;
13
+ supportsVision: boolean;
14
+ supportsFunctions: boolean;
15
+ }
16
+ /**
17
+ * Large context model definitions
18
+ */
19
+ export declare const LARGE_CONTEXT_DEFINITIONS: Record<string, {
20
+ contextWindow: number;
21
+ maxTokens: number;
22
+ capabilities: ModelCapabilities;
23
+ }>;
24
+ /**
25
+ * Large Context Provider
26
+ * Implements the IContextProvider interface for 1M context support
27
+ */
28
+ export declare class LargeContextProvider implements IContextProvider {
29
+ readonly name = "large-context";
30
+ readonly version = "1.0.0";
31
+ private customModels;
32
+ /**
33
+ * Check if this provider supports a given model
34
+ */
35
+ supportsModel(modelId: string): boolean;
36
+ /**
37
+ * Get context window for a model
38
+ */
39
+ getContextWindow(modelId: string): number;
40
+ /**
41
+ * Get max output tokens for a model
42
+ */
43
+ getMaxTokens(modelId: string): number;
44
+ /**
45
+ * Get full context configuration for a model
46
+ */
47
+ getContextConfig(modelId: string): IModelContextConfig;
48
+ /**
49
+ * Process messages before sending to API
50
+ */
51
+ processMessages(messages: unknown[], modelId: string): IProcessedContext;
52
+ /**
53
+ * Handle context overflow
54
+ */
55
+ handleOverflow(messages: unknown[], modelId: string, tokenCount: number): IOverflowResult;
56
+ /**
57
+ * Register a custom model with context configuration
58
+ */
59
+ registerCustomModel(modelId: string, config: {
60
+ contextWindow: number;
61
+ maxTokens: number;
62
+ supportsVision?: boolean;
63
+ supportsFunctions?: boolean;
64
+ }): void;
65
+ /**
66
+ * Enhance a model with large context configuration
67
+ */
68
+ enhanceModel<API extends Api>(model: Model<API>): Model<API>;
69
+ /**
70
+ * Get all known large context models
71
+ */
72
+ getKnownModels(): string[];
73
+ /**
74
+ * Check if a model has 1M context
75
+ */
76
+ isMillionContextModel(modelId: string): boolean;
77
+ /**
78
+ * Normalize model ID for matching
79
+ */
80
+ private normalizeModelId;
81
+ }
82
+ /**
83
+ * Get the singleton instance
84
+ */
85
+ export declare function getLargeContextProvider(): LargeContextProvider;
86
+ export {};
87
+ //# sourceMappingURL=large-context-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"large-context-provider.d.ts","sourceRoot":"","sources":["../../src/core/large-context-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EACX,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,MAAM,iCAAiC,CAAC;AAEzC;;GAEG;AACH,UAAU,iBAAiB;IAC1B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,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AE,CAEzB;IAED;;OAEG;IACH,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG9C;IAED;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAGxB;AAOD;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,oBAAoB,CAK9D","sourcesContent":["/**\n * Large Context Provider Implementation\n * Provides 1M context window support for compatible models\n * This is a third-party architecture implementation\n */\n\nimport type { Api, Model } from \"@mariozechner/pi-ai\";\nimport type {\n\tIContextProvider,\n\tIModelContextConfig,\n\tIOverflowResult,\n\tIProcessedContext,\n} from \"./context-provider-interface.js\";\n\n/**\n * Model capability flags\n */\ninterface ModelCapabilities {\n\tsupportsStreaming: boolean;\n\tsupportsVision: boolean;\n\tsupportsFunctions: boolean;\n}\n\n/**\n * Large context model definitions\n */\nexport const LARGE_CONTEXT_DEFINITIONS: Record<\n\tstring,\n\t{\n\t\tcontextWindow: number;\n\t\tmaxTokens: number;\n\t\tcapabilities: ModelCapabilities;\n\t}\n> = {\n\t// ═══════════════════════════════════════════════════════════════\n\t// Google Gemini - 1M Context\n\t// ═══════════════════════════════════════════════════════════════\n\t\"gemini-1.5-pro\": {\n\t\tcontextWindow: 1000000,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"gemini-1.5-flash\": {\n\t\tcontextWindow: 1000000,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"gemini-2.0-flash\": {\n\t\tcontextWindow: 1000000,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"gemini-2.0-pro\": {\n\t\tcontextWindow: 1000000,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\n\t// ═══════════════════════════════════════════════════════════════\n\t// Anthropic Claude - 200K Context\n\t// ═══════════════════════════════════════════════════════════════\n\t\"claude-3-opus-20240229\": {\n\t\tcontextWindow: 200000,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"claude-3-sonnet-20240229\": {\n\t\tcontextWindow: 200000,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"claude-3-haiku-20240307\": {\n\t\tcontextWindow: 200000,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"claude-3-5-sonnet-20241022\": {\n\t\tcontextWindow: 200000,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"claude-3-5-haiku-20241022\": {\n\t\tcontextWindow: 200000,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"claude-sonnet-4-20250514\": {\n\t\tcontextWindow: 200000,\n\t\tmaxTokens: 16384,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\n\t// ═══════════════════════════════════════════════════════════════\n\t// OpenAI - 128K Context\n\t// ═══════════════════════════════════════════════════════════════\n\t\"gpt-4-turbo\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"gpt-4-turbo-preview\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"gpt-4o\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 16384,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"gpt-4o-mini\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 16384,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"gpt-4-0125-preview\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\n\t// ═══════════════════════════════════════════════════════════════\n\t// DeepSeek - 64K Context\n\t// ═══════════════════════════════════════════════════════════════\n\t\"deepseek-chat\": {\n\t\tcontextWindow: 64000,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"deepseek-coder\": {\n\t\tcontextWindow: 64000,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"deepseek-reasoner\": {\n\t\tcontextWindow: 64000,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\n\t// ═══════════════════════════════════════════════════════════════\n\t// Alibaba Qwen - Up to 1M Context\n\t// ═══════════════════════════════════════════════════════════════\n\t\"qwen-2.5-72b-instruct\": {\n\t\tcontextWindow: 131072,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"qwen-2.5-32b-instruct\": {\n\t\tcontextWindow: 131072,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"qwen-max\": {\n\t\tcontextWindow: 1000000,\n\t\tmaxTokens: 65536,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"qwen-max-longcontext\": {\n\t\tcontextWindow: 1000000,\n\t\tmaxTokens: 65536,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\n\t// ═══════════════════════════════════════════════════════════════\n\t// Moonshot Kimi - Up to 128K Context\n\t// ═══════════════════════════════════════════════════════════════\n\t\"moonshot-v1-8k\": {\n\t\tcontextWindow: 8192,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"moonshot-v1-32k\": {\n\t\tcontextWindow: 32768,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"moonshot-v1-128k\": {\n\t\tcontextWindow: 131072,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\n\t// ═══════════════════════════════════════════════════════════════\n\t// Meta Llama 3.1 - 128K Context\n\t// ═══════════════════════════════════════════════════════════════\n\t\"llama-3.1-405b-instruct\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 16384,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"llama-3.1-70b-instruct\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 16384,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"llama-3.1-8b-instruct\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 16384,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\n\t// ═══════════════════════════════════════════════════════════════\n\t// Mistral - Up to 128K Context\n\t// ═══════════════════════════════════════════════════════════════\n\t\"mistral-large-2407\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"mistral-large-2402\": {\n\t\tcontextWindow: 32000,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\n\t// ═══════════════════════════════════════════════════════════════\n\t// 01.AI Yi - Up to 32K Context\n\t// ═══════════════════════════════════════════════════════════════\n\t\"yi-lightning\": {\n\t\tcontextWindow: 16384,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"yi-large\": {\n\t\tcontextWindow: 32768,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\n\t// ═══════════════════════════════════════════════════════════════\n\t// Zhipu GLM - 128K Context\n\t// ═══════════════════════════════════════════════════════════════\n\t\"glm-4\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\t\"glm-4-plus\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 4096,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: true, supportsFunctions: true },\n\t},\n\n\t// ═══════════════════════════════════════════════════════════════\n\t// Groq Models - Varies\n\t// ═══════════════════════════════════════════════════════════════\n\t\"llama-3.3-70b-versatile\": {\n\t\tcontextWindow: 128000,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: true },\n\t},\n\t\"llama-3.3-70b-specdec\": {\n\t\tcontextWindow: 8192,\n\t\tmaxTokens: 8192,\n\t\tcapabilities: { supportsStreaming: true, supportsVision: false, supportsFunctions: false },\n\t},\n};\n\n/**\n * Large Context Provider\n * Implements the IContextProvider interface for 1M context support\n */\nexport class LargeContextProvider implements IContextProvider {\n\treadonly name = \"large-context\";\n\treadonly version = \"1.0.0\";\n\n\tprivate customModels: Map<string, { contextWindow: number; maxTokens: number; capabilities: ModelCapabilities }> =\n\t\tnew Map();\n\n\t/**\n\t * Check if this provider supports a given model\n\t */\n\tsupportsModel(modelId: string): boolean {\n\t\tconst normalized = this.normalizeModelId(modelId);\n\t\treturn normalized in LARGE_CONTEXT_DEFINITIONS || this.customModels.has(normalized);\n\t}\n\n\t/**\n\t * Get context window for a model\n\t */\n\tgetContextWindow(modelId: string): number {\n\t\treturn this.getContextConfig(modelId).contextWindow;\n\t}\n\n\t/**\n\t * Get max output tokens for a model\n\t */\n\tgetMaxTokens(modelId: string): number {\n\t\treturn this.getContextConfig(modelId).maxTokens;\n\t}\n\n\t/**\n\t * Get full context configuration for a model\n\t */\n\tgetContextConfig(modelId: string): IModelContextConfig {\n\t\tconst normalized = this.normalizeModelId(modelId);\n\n\t\t// Check custom models first\n\t\tconst custom = this.customModels.get(normalized);\n\t\tif (custom) {\n\t\t\treturn {\n\t\t\t\tcontextWindow: custom.contextWindow,\n\t\t\t\tmaxTokens: custom.maxTokens,\n\t\t\t\tsupportsStreaming: custom.capabilities.supportsStreaming,\n\t\t\t\tsupportsVision: custom.capabilities.supportsVision,\n\t\t\t\tsupportsFunctions: custom.capabilities.supportsFunctions,\n\t\t\t};\n\t\t}\n\n\t\t// Check known models\n\t\tconst definition = LARGE_CONTEXT_DEFINITIONS[normalized];\n\t\tif (definition) {\n\t\t\treturn {\n\t\t\t\tcontextWindow: definition.contextWindow,\n\t\t\t\tmaxTokens: definition.maxTokens,\n\t\t\t\tsupportsStreaming: definition.capabilities.supportsStreaming,\n\t\t\t\tsupportsVision: definition.capabilities.supportsVision,\n\t\t\t\tsupportsFunctions: definition.capabilities.supportsFunctions,\n\t\t\t};\n\t\t}\n\n\t\t// Default: 1M context for unknown models\n\t\treturn {\n\t\t\tcontextWindow: 1000000,\n\t\t\tmaxTokens: 65536,\n\t\t\tsupportsStreaming: true,\n\t\t\tsupportsVision: true,\n\t\t\tsupportsFunctions: true,\n\t\t};\n\t}\n\n\t/**\n\t * Process messages before sending to API\n\t */\n\tprocessMessages(messages: unknown[], modelId: string): IProcessedContext {\n\t\tconst config = this.getContextConfig(modelId);\n\t\tconst messageStr = JSON.stringify(messages);\n\t\tconst estimatedTokens = Math.ceil(messageStr.length / 4);\n\n\t\treturn {\n\t\t\tmessages,\n\t\t\ttokenCount: estimatedTokens,\n\t\t\tmodified: false,\n\t\t\tmetadata: {\n\t\t\t\ttruncated: estimatedTokens > config.contextWindow,\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Handle context overflow\n\t */\n\thandleOverflow(messages: unknown[], modelId: string, tokenCount: number): IOverflowResult {\n\t\tconst config = this.getContextConfig(modelId);\n\n\t\tif (tokenCount <= config.contextWindow) {\n\t\t\treturn { action: \"truncate\", messages };\n\t\t}\n\n\t\t// For large context models, try to keep as much as possible\n\t\tif (config.contextWindow >= 100000) {\n\t\t\t// For 1M context, we likely have enough space\n\t\t\treturn {\n\t\t\t\taction: \"truncate\",\n\t\t\t\tmessages,\n\t\t\t\tmetadata: {\n\t\t\t\t\toriginalTokens: tokenCount,\n\t\t\t\t\tcontextWindow: config.contextWindow,\n\t\t\t\t\tkeepRatio: config.contextWindow / tokenCount,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\taction: \"summarize\",\n\t\t\tmetadata: {\n\t\t\t\toriginalTokens: tokenCount,\n\t\t\t\tcontextWindow: config.contextWindow,\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Register a custom model with context configuration\n\t */\n\tregisterCustomModel(\n\t\tmodelId: string,\n\t\tconfig: {\n\t\t\tcontextWindow: number;\n\t\t\tmaxTokens: number;\n\t\t\tsupportsVision?: boolean;\n\t\t\tsupportsFunctions?: boolean;\n\t\t},\n\t): void {\n\t\tconst normalized = this.normalizeModelId(modelId);\n\t\tthis.customModels.set(normalized, {\n\t\t\tcontextWindow: config.contextWindow,\n\t\t\tmaxTokens: config.maxTokens,\n\t\t\tcapabilities: {\n\t\t\t\tsupportsStreaming: true,\n\t\t\t\tsupportsVision: config.supportsVision ?? true,\n\t\t\t\tsupportsFunctions: config.supportsFunctions ?? true,\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Enhance a model with large context configuration\n\t */\n\tenhanceModel<API extends Api>(model: Model<API>): Model<API> {\n\t\tconst config = this.getContextConfig(model.id);\n\n\t\treturn {\n\t\t\t...model,\n\t\t\tcontextWindow: config.contextWindow,\n\t\t\tmaxTokens: config.maxTokens,\n\t\t};\n\t}\n\n\t/**\n\t * Get all known large context models\n\t */\n\tgetKnownModels(): string[] {\n\t\treturn Object.keys(LARGE_CONTEXT_DEFINITIONS);\n\t}\n\n\t/**\n\t * Check if a model has 1M context\n\t */\n\tisMillionContextModel(modelId: string): boolean {\n\t\tconst config = this.getContextConfig(modelId);\n\t\treturn config.contextWindow >= 1000000;\n\t}\n\n\t/**\n\t * Normalize model ID for matching\n\t */\n\tprivate normalizeModelId(modelId: string): string {\n\t\treturn modelId.toLowerCase().trim();\n\t}\n}\n\n/**\n * Singleton instance\n */\nlet largeContextProviderInstance: LargeContextProvider | null = null;\n\n/**\n * Get the singleton instance\n */\nexport function getLargeContextProvider(): LargeContextProvider {\n\tif (!largeContextProviderInstance) {\n\t\tlargeContextProviderInstance = new LargeContextProvider();\n\t}\n\treturn largeContextProviderInstance;\n}\n"]}