@codelia/core 0.1.66 → 0.1.67

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/index.cjs CHANGED
@@ -62,7 +62,7 @@ module.exports = __toCommonJS(index_exports);
62
62
  var import_config = require("@codelia/config");
63
63
 
64
64
  // src/models/openai.ts
65
- var OPENAI_DEFAULT_MODEL = "gpt-5.3-codex";
65
+ var OPENAI_DEFAULT_MODEL = "gpt-5.5";
66
66
  var OPENAI_DEFAULT_REASONING_EFFORT = "medium";
67
67
  var GPT_5_4_CAPPED_INPUT_TOKENS = 272e3;
68
68
  var OPENAI_MODELS = [
@@ -109,6 +109,50 @@ var OPENAI_MODELS = [
109
109
  maxInputTokens: 942e3,
110
110
  maxOutputTokens: 128e3
111
111
  },
112
+ {
113
+ id: "gpt-5.4-pro",
114
+ provider: "openai",
115
+ contextWindow: 105e4,
116
+ maxInputTokens: 922e3,
117
+ maxOutputTokens: 128e3
118
+ },
119
+ {
120
+ id: "gpt-5.4-pro-2026-03-05",
121
+ provider: "openai",
122
+ contextWindow: 105e4,
123
+ maxInputTokens: 922e3,
124
+ maxOutputTokens: 128e3
125
+ },
126
+ {
127
+ id: "gpt-5.4-mini",
128
+ provider: "openai",
129
+ contextWindow: 4e5,
130
+ maxInputTokens: 272e3,
131
+ maxOutputTokens: 128e3,
132
+ supportsFast: true
133
+ },
134
+ {
135
+ id: "gpt-5.4-mini-2026-03-17",
136
+ provider: "openai",
137
+ contextWindow: 4e5,
138
+ maxInputTokens: 272e3,
139
+ maxOutputTokens: 128e3,
140
+ supportsFast: true
141
+ },
142
+ {
143
+ id: "gpt-5.4-nano",
144
+ provider: "openai",
145
+ contextWindow: 4e5,
146
+ maxInputTokens: 272e3,
147
+ maxOutputTokens: 128e3
148
+ },
149
+ {
150
+ id: "gpt-5.4-nano-2026-03-17",
151
+ provider: "openai",
152
+ contextWindow: 4e5,
153
+ maxInputTokens: 272e3,
154
+ maxOutputTokens: 128e3
155
+ },
112
156
  {
113
157
  id: "gpt-5.3-codex",
114
158
  provider: "openai"
@@ -441,13 +485,12 @@ function applyModelMetadata(registry, index) {
441
485
  const fullId = `${provider}/${modelId}`;
442
486
  const spec = resolveModel(next, fullId, provider) ?? resolveModel(next, modelId, provider);
443
487
  if (!spec) continue;
444
- const limits = entry.limits;
445
- if (!limits) continue;
446
488
  next.modelsById[spec.id] = {
447
489
  ...spec,
448
- contextWindow: spec.contextWindow ?? limits.contextWindow,
449
- maxInputTokens: spec.maxInputTokens ?? limits.inputTokens,
450
- maxOutputTokens: spec.maxOutputTokens ?? limits.outputTokens
490
+ contextWindow: spec.contextWindow ?? entry.limits?.contextWindow,
491
+ maxInputTokens: spec.maxInputTokens ?? entry.limits?.inputTokens,
492
+ maxOutputTokens: spec.maxOutputTokens ?? entry.limits?.outputTokens,
493
+ supportsFast: spec.supportsFast ?? entry.capabilities?.supportsFast
451
494
  };
452
495
  }
453
496
  }
@@ -1441,14 +1484,16 @@ var Agent = class {
1441
1484
  }
1442
1485
  this.history.enqueueUserMessage(message);
1443
1486
  let iterations = 0;
1487
+ const runTools = [...this.tools, ...options.tools ?? []];
1488
+ const runToolChoice = options.toolChoice ?? this.toolChoice;
1444
1489
  while (iterations < this.maxIterations) {
1445
1490
  iterations++;
1446
1491
  throwIfAborted(signal);
1447
1492
  await this.trimToolOutputs();
1448
1493
  throwIfAborted(signal);
1449
1494
  const invokeInput = this.history.prepareInvokeInput({
1450
- tools: [...this.tools.map((t) => t.definition), ...this.hostedTools],
1451
- toolChoice: this.toolChoice
1495
+ tools: [...runTools.map((t) => t.definition), ...this.hostedTools],
1496
+ toolChoice: runToolChoice
1452
1497
  });
1453
1498
  const invokeContext = this.buildInvokeContext(session);
1454
1499
  const seq = this.recordLlmRequest(session, invokeInput, invokeContext);
@@ -1564,7 +1609,11 @@ var Agent = class {
1564
1609
  const startTime = Date.now();
1565
1610
  try {
1566
1611
  throwIfAborted(signal);
1567
- const execution = await this.executeToolCall(toolCall, signal);
1612
+ const execution = await this.executeToolCall(
1613
+ toolCall,
1614
+ runTools,
1615
+ signal
1616
+ );
1568
1617
  const rawOutput = stringifyContent(execution.message.content, {
1569
1618
  mode: "display"
1570
1619
  });
@@ -1705,9 +1754,9 @@ ${assistantTexts.join("\n").trim()}`;
1705
1754
  return "[Max Iterations Reached]\n\nSummary unavailable due to an internal error.";
1706
1755
  }
1707
1756
  }
1708
- async executeToolCall(toolCall, signal) {
1757
+ async executeToolCall(toolCall, tools, signal) {
1709
1758
  const toolName = toolCall.function.name;
1710
- const tool = this.tools.find((t) => t.name === toolName);
1759
+ const tool = tools.find((t) => t.name === toolName);
1711
1760
  if (!tool) {
1712
1761
  return {
1713
1762
  message: {
package/dist/index.d.cts CHANGED
@@ -197,6 +197,9 @@ type ModelLimits = {
197
197
  inputTokens?: number;
198
198
  outputTokens?: number;
199
199
  };
200
+ type ModelCapabilities = {
201
+ supportsFast?: boolean;
202
+ };
200
203
  type ModelEntry = {
201
204
  provider: string;
202
205
  modelId: string;
@@ -204,6 +207,7 @@ type ModelEntry = {
204
207
  lastUpdated?: string;
205
208
  cost?: ModelCost;
206
209
  limits?: ModelLimits;
210
+ capabilities?: ModelCapabilities;
207
211
  };
208
212
  type ModelMetadataIndex = {
209
213
  models: Record<string, Record<string, ModelEntry>>;
@@ -545,6 +549,8 @@ type AgentRunOptions = {
545
549
  session?: AgentSession;
546
550
  signal?: AbortSignal;
547
551
  forceCompaction?: boolean;
552
+ tools?: Tool[];
553
+ toolChoice?: ToolChoice;
548
554
  };
549
555
  type AgentOptions = {
550
556
  llm: BaseChatModel;
@@ -788,7 +794,7 @@ declare const ANTHROPIC_MODELS: ModelSpec[];
788
794
 
789
795
  declare const GOOGLE_MODELS: ModelSpec[];
790
796
 
791
- declare const OPENAI_DEFAULT_MODEL = "gpt-5.3-codex";
797
+ declare const OPENAI_DEFAULT_MODEL = "gpt-5.5";
792
798
  declare const OPENAI_DEFAULT_REASONING_EFFORT = "medium";
793
799
  declare const OPENAI_MODELS: ModelSpec[];
794
800
 
@@ -803,4 +809,4 @@ declare class TaskComplete extends Error {
803
809
  constructor(finalMessage?: string);
804
810
  }
805
811
 
806
- export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatOpenAI, ChatOpenRouter, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ResolveStorageOptions, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
812
+ export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatOpenAI, ChatOpenRouter, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, type ModelCapabilities, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ResolveStorageOptions, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, type ToolResult, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
package/dist/index.d.ts CHANGED
@@ -197,6 +197,9 @@ type ModelLimits = {
197
197
  inputTokens?: number;
198
198
  outputTokens?: number;
199
199
  };
200
+ type ModelCapabilities = {
201
+ supportsFast?: boolean;
202
+ };
200
203
  type ModelEntry = {
201
204
  provider: string;
202
205
  modelId: string;
@@ -204,6 +207,7 @@ type ModelEntry = {
204
207
  lastUpdated?: string;
205
208
  cost?: ModelCost;
206
209
  limits?: ModelLimits;
210
+ capabilities?: ModelCapabilities;
207
211
  };
208
212
  type ModelMetadataIndex = {
209
213
  models: Record<string, Record<string, ModelEntry>>;
@@ -545,6 +549,8 @@ type AgentRunOptions = {
545
549
  session?: AgentSession;
546
550
  signal?: AbortSignal;
547
551
  forceCompaction?: boolean;
552
+ tools?: Tool[];
553
+ toolChoice?: ToolChoice;
548
554
  };
549
555
  type AgentOptions = {
550
556
  llm: BaseChatModel;
@@ -788,7 +794,7 @@ declare const ANTHROPIC_MODELS: ModelSpec[];
788
794
 
789
795
  declare const GOOGLE_MODELS: ModelSpec[];
790
796
 
791
- declare const OPENAI_DEFAULT_MODEL = "gpt-5.3-codex";
797
+ declare const OPENAI_DEFAULT_MODEL = "gpt-5.5";
792
798
  declare const OPENAI_DEFAULT_REASONING_EFFORT = "medium";
793
799
  declare const OPENAI_MODELS: ModelSpec[];
794
800
 
@@ -803,4 +809,4 @@ declare class TaskComplete extends Error {
803
809
  constructor(finalMessage?: string);
804
810
  }
805
811
 
806
- export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatOpenAI, ChatOpenRouter, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ResolveStorageOptions, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
812
+ export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatOpenAI, ChatOpenRouter, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, type ModelCapabilities, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ResolveStorageOptions, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, type ToolResult, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { configRegistry } from "@codelia/config";
3
3
 
4
4
  // src/models/openai.ts
5
- var OPENAI_DEFAULT_MODEL = "gpt-5.3-codex";
5
+ var OPENAI_DEFAULT_MODEL = "gpt-5.5";
6
6
  var OPENAI_DEFAULT_REASONING_EFFORT = "medium";
7
7
  var GPT_5_4_CAPPED_INPUT_TOKENS = 272e3;
8
8
  var OPENAI_MODELS = [
@@ -49,6 +49,50 @@ var OPENAI_MODELS = [
49
49
  maxInputTokens: 942e3,
50
50
  maxOutputTokens: 128e3
51
51
  },
52
+ {
53
+ id: "gpt-5.4-pro",
54
+ provider: "openai",
55
+ contextWindow: 105e4,
56
+ maxInputTokens: 922e3,
57
+ maxOutputTokens: 128e3
58
+ },
59
+ {
60
+ id: "gpt-5.4-pro-2026-03-05",
61
+ provider: "openai",
62
+ contextWindow: 105e4,
63
+ maxInputTokens: 922e3,
64
+ maxOutputTokens: 128e3
65
+ },
66
+ {
67
+ id: "gpt-5.4-mini",
68
+ provider: "openai",
69
+ contextWindow: 4e5,
70
+ maxInputTokens: 272e3,
71
+ maxOutputTokens: 128e3,
72
+ supportsFast: true
73
+ },
74
+ {
75
+ id: "gpt-5.4-mini-2026-03-17",
76
+ provider: "openai",
77
+ contextWindow: 4e5,
78
+ maxInputTokens: 272e3,
79
+ maxOutputTokens: 128e3,
80
+ supportsFast: true
81
+ },
82
+ {
83
+ id: "gpt-5.4-nano",
84
+ provider: "openai",
85
+ contextWindow: 4e5,
86
+ maxInputTokens: 272e3,
87
+ maxOutputTokens: 128e3
88
+ },
89
+ {
90
+ id: "gpt-5.4-nano-2026-03-17",
91
+ provider: "openai",
92
+ contextWindow: 4e5,
93
+ maxInputTokens: 272e3,
94
+ maxOutputTokens: 128e3
95
+ },
52
96
  {
53
97
  id: "gpt-5.3-codex",
54
98
  provider: "openai"
@@ -381,13 +425,12 @@ function applyModelMetadata(registry, index) {
381
425
  const fullId = `${provider}/${modelId}`;
382
426
  const spec = resolveModel(next, fullId, provider) ?? resolveModel(next, modelId, provider);
383
427
  if (!spec) continue;
384
- const limits = entry.limits;
385
- if (!limits) continue;
386
428
  next.modelsById[spec.id] = {
387
429
  ...spec,
388
- contextWindow: spec.contextWindow ?? limits.contextWindow,
389
- maxInputTokens: spec.maxInputTokens ?? limits.inputTokens,
390
- maxOutputTokens: spec.maxOutputTokens ?? limits.outputTokens
430
+ contextWindow: spec.contextWindow ?? entry.limits?.contextWindow,
431
+ maxInputTokens: spec.maxInputTokens ?? entry.limits?.inputTokens,
432
+ maxOutputTokens: spec.maxOutputTokens ?? entry.limits?.outputTokens,
433
+ supportsFast: spec.supportsFast ?? entry.capabilities?.supportsFast
391
434
  };
392
435
  }
393
436
  }
@@ -1381,14 +1424,16 @@ var Agent = class {
1381
1424
  }
1382
1425
  this.history.enqueueUserMessage(message);
1383
1426
  let iterations = 0;
1427
+ const runTools = [...this.tools, ...options.tools ?? []];
1428
+ const runToolChoice = options.toolChoice ?? this.toolChoice;
1384
1429
  while (iterations < this.maxIterations) {
1385
1430
  iterations++;
1386
1431
  throwIfAborted(signal);
1387
1432
  await this.trimToolOutputs();
1388
1433
  throwIfAborted(signal);
1389
1434
  const invokeInput = this.history.prepareInvokeInput({
1390
- tools: [...this.tools.map((t) => t.definition), ...this.hostedTools],
1391
- toolChoice: this.toolChoice
1435
+ tools: [...runTools.map((t) => t.definition), ...this.hostedTools],
1436
+ toolChoice: runToolChoice
1392
1437
  });
1393
1438
  const invokeContext = this.buildInvokeContext(session);
1394
1439
  const seq = this.recordLlmRequest(session, invokeInput, invokeContext);
@@ -1504,7 +1549,11 @@ var Agent = class {
1504
1549
  const startTime = Date.now();
1505
1550
  try {
1506
1551
  throwIfAborted(signal);
1507
- const execution = await this.executeToolCall(toolCall, signal);
1552
+ const execution = await this.executeToolCall(
1553
+ toolCall,
1554
+ runTools,
1555
+ signal
1556
+ );
1508
1557
  const rawOutput = stringifyContent(execution.message.content, {
1509
1558
  mode: "display"
1510
1559
  });
@@ -1645,9 +1694,9 @@ ${assistantTexts.join("\n").trim()}`;
1645
1694
  return "[Max Iterations Reached]\n\nSummary unavailable due to an internal error.";
1646
1695
  }
1647
1696
  }
1648
- async executeToolCall(toolCall, signal) {
1697
+ async executeToolCall(toolCall, tools, signal) {
1649
1698
  const toolName = toolCall.function.name;
1650
- const tool = this.tools.find((t) => t.name === toolName);
1699
+ const tool = tools.find((t) => t.name === toolName);
1651
1700
  if (!tool) {
1652
1701
  return {
1653
1702
  message: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/core",
3
- "version": "0.1.66",
3
+ "version": "0.1.67",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -25,8 +25,8 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@anthropic-ai/sdk": "^0.78.0",
28
- "@codelia/config": "0.1.66",
29
- "@codelia/shared-types": "0.1.66",
28
+ "@codelia/config": "0.1.67",
29
+ "@codelia/shared-types": "0.1.67",
30
30
  "@google-cloud/vertexai": "^1.10.0",
31
31
  "@google/genai": "^1.43.0",
32
32
  "json-schema": "^0.4.0",