@fgv/ts-extras 5.1.0-44 → 5.1.0-45

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 (75) hide show
  1. package/dist/packlets/ai-assist/apiClient.js +38 -14
  2. package/dist/packlets/ai-assist/apiClient.js.map +1 -1
  3. package/dist/packlets/ai-assist/index.js +1 -1
  4. package/dist/packlets/ai-assist/index.js.map +1 -1
  5. package/dist/packlets/ai-assist/jsonResponse.js +16 -5
  6. package/dist/packlets/ai-assist/jsonResponse.js.map +1 -1
  7. package/dist/packlets/ai-assist/model.js +94 -0
  8. package/dist/packlets/ai-assist/model.js.map +1 -1
  9. package/dist/packlets/ai-assist/registry.js +18 -3
  10. package/dist/packlets/ai-assist/registry.js.map +1 -1
  11. package/dist/packlets/ai-assist/streamingAdapters/anthropic.js +17 -6
  12. package/dist/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -1
  13. package/dist/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js +5 -5
  14. package/dist/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js.map +1 -1
  15. package/dist/packlets/ai-assist/streamingAdapters/common.js.map +1 -1
  16. package/dist/packlets/ai-assist/streamingAdapters/gemini.js +4 -1
  17. package/dist/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -1
  18. package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js +6 -1
  19. package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -1
  20. package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js +5 -1
  21. package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -1
  22. package/dist/packlets/ai-assist/streamingAdapters/proxy.js +6 -1
  23. package/dist/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -1
  24. package/dist/packlets/ai-assist/streamingClient.js +6 -6
  25. package/dist/packlets/ai-assist/streamingClient.js.map +1 -1
  26. package/dist/ts-extras.d.ts +143 -1
  27. package/lib/packlets/ai-assist/apiClient.d.ts +9 -0
  28. package/lib/packlets/ai-assist/apiClient.d.ts.map +1 -1
  29. package/lib/packlets/ai-assist/apiClient.js +37 -13
  30. package/lib/packlets/ai-assist/apiClient.js.map +1 -1
  31. package/lib/packlets/ai-assist/index.d.ts +1 -1
  32. package/lib/packlets/ai-assist/index.d.ts.map +1 -1
  33. package/lib/packlets/ai-assist/index.js +6 -1
  34. package/lib/packlets/ai-assist/index.js.map +1 -1
  35. package/lib/packlets/ai-assist/jsonResponse.d.ts +7 -0
  36. package/lib/packlets/ai-assist/jsonResponse.d.ts.map +1 -1
  37. package/lib/packlets/ai-assist/jsonResponse.js +16 -5
  38. package/lib/packlets/ai-assist/jsonResponse.js.map +1 -1
  39. package/lib/packlets/ai-assist/model.d.ts +101 -1
  40. package/lib/packlets/ai-assist/model.d.ts.map +1 -1
  41. package/lib/packlets/ai-assist/model.js +98 -1
  42. package/lib/packlets/ai-assist/model.js.map +1 -1
  43. package/lib/packlets/ai-assist/registry.d.ts.map +1 -1
  44. package/lib/packlets/ai-assist/registry.js +18 -3
  45. package/lib/packlets/ai-assist/registry.js.map +1 -1
  46. package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts +1 -1
  47. package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts.map +1 -1
  48. package/lib/packlets/ai-assist/streamingAdapters/anthropic.js +17 -6
  49. package/lib/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -1
  50. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.d.ts +9 -0
  51. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.d.ts.map +1 -1
  52. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js +4 -4
  53. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js.map +1 -1
  54. package/lib/packlets/ai-assist/streamingAdapters/common.d.ts +9 -0
  55. package/lib/packlets/ai-assist/streamingAdapters/common.d.ts.map +1 -1
  56. package/lib/packlets/ai-assist/streamingAdapters/common.js.map +1 -1
  57. package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts +1 -1
  58. package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts.map +1 -1
  59. package/lib/packlets/ai-assist/streamingAdapters/gemini.js +4 -1
  60. package/lib/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -1
  61. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts +1 -1
  62. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts.map +1 -1
  63. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js +6 -1
  64. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -1
  65. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts +1 -1
  66. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts.map +1 -1
  67. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js +5 -1
  68. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -1
  69. package/lib/packlets/ai-assist/streamingAdapters/proxy.d.ts.map +1 -1
  70. package/lib/packlets/ai-assist/streamingAdapters/proxy.js +6 -1
  71. package/lib/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -1
  72. package/lib/packlets/ai-assist/streamingClient.d.ts.map +1 -1
  73. package/lib/packlets/ai-assist/streamingClient.js +5 -5
  74. package/lib/packlets/ai-assist/streamingClient.js.map +1 -1
  75. package/package.json +7 -7
@@ -4,11 +4,14 @@
4
4
  * @packageDocumentation
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.anthropicEffortToBudgetTokens = exports.SMART_JSON_PROMPT_HINT = exports.generateJsonCompletion = exports.fencedStringifiedJson = exports.extractJsonText = exports.resolveEffectiveTools = exports.modelSpec = exports.modelSpecKey = exports.aiAssistSettings = exports.aiAssistProviderConfig = exports.aiToolEnablement = exports.aiClientToolConfig = exports.aiToolAnnotations = exports.aiServerToolConfig = exports.aiWebSearchToolConfig = exports.aiServerToolType = exports.aiProviderId = exports.executeClientToolTurn = exports.callProxiedCompletionStream = exports.callProviderCompletionStream = exports.callProxiedEmbedding = exports.callProviderEmbedding = exports.callProxiedListModels = exports.callProviderListModels = exports.callProxiedImageGeneration = exports.callProviderImageGeneration = exports.callProxiedCompletion = exports.callProviderCompletion = exports.DEFAULT_MODEL_CAPABILITY_CONFIG = exports.supportsEmbedding = exports.resolveEmbeddingCapability = exports.supportsImageGeneration = exports.resolveImageCapability = exports.getProviderDescriptor = exports.getProviderDescriptors = exports.allProviderIds = exports.validateResolvedOptions = exports.resolveImageOptions = exports.toDataUrl = exports.isResponsesOnlyModel = exports.resolveProviderModel = exports.resolveModelAlias = exports.MODEL_ALIAS_SIGIL = exports.resolveModel = exports.MODEL_SPEC_BASE_KEY = exports.allModelSpecKeys = exports.DEFAULT_AI_ASSIST = exports.allModelCapabilities = exports.AiPrompt = void 0;
7
+ exports.fencedStringifiedJson = exports.extractJsonText = exports.resolveEffectiveTools = exports.modelSpec = exports.modelSpecKey = exports.aiAssistSettings = exports.aiAssistProviderConfig = exports.aiToolEnablement = exports.aiClientToolConfig = exports.aiToolAnnotations = exports.aiServerToolConfig = exports.aiWebSearchToolConfig = exports.aiServerToolType = exports.aiProviderId = exports.executeClientToolTurn = exports.callProxiedCompletionStream = exports.callProviderCompletionStream = exports.callProxiedEmbedding = exports.callProviderEmbedding = exports.callProxiedListModels = exports.callProviderListModels = exports.callProxiedImageGeneration = exports.callProviderImageGeneration = exports.callProxiedCompletion = exports.callProviderCompletion = exports.DEFAULT_MODEL_CAPABILITY_CONFIG = exports.supportsEmbedding = exports.resolveEmbeddingCapability = exports.supportsImageGeneration = exports.resolveImageCapability = exports.getProviderDescriptor = exports.getProviderDescriptors = exports.allProviderIds = exports.validateResolvedOptions = exports.resolveImageOptions = exports.toDataUrl = exports.usesMaxCompletionTokensField = exports.isAdaptiveThinkingModel = exports.isResponsesOnlyModel = exports.resolveProviderModel = exports.resolveModelAlias = exports.MODEL_ALIAS_SIGIL = exports.resolveModel = exports.MODEL_SPEC_BASE_KEY = exports.allModelSpecKeys = exports.providerApiKeySecretName = exports.DEFAULT_AI_ASSIST = exports.DEFAULT_ANTHROPIC_MAX_TOKENS = exports.allModelCapabilities = exports.AiPrompt = void 0;
8
+ exports.anthropicEffortToBudgetTokens = exports.SMART_JSON_PROMPT_HINT = exports.generateJsonCompletion = void 0;
8
9
  var model_1 = require("./model");
9
10
  Object.defineProperty(exports, "AiPrompt", { enumerable: true, get: function () { return model_1.AiPrompt; } });
10
11
  Object.defineProperty(exports, "allModelCapabilities", { enumerable: true, get: function () { return model_1.allModelCapabilities; } });
12
+ Object.defineProperty(exports, "DEFAULT_ANTHROPIC_MAX_TOKENS", { enumerable: true, get: function () { return model_1.DEFAULT_ANTHROPIC_MAX_TOKENS; } });
11
13
  Object.defineProperty(exports, "DEFAULT_AI_ASSIST", { enumerable: true, get: function () { return model_1.DEFAULT_AI_ASSIST; } });
14
+ Object.defineProperty(exports, "providerApiKeySecretName", { enumerable: true, get: function () { return model_1.providerApiKeySecretName; } });
12
15
  Object.defineProperty(exports, "allModelSpecKeys", { enumerable: true, get: function () { return model_1.allModelSpecKeys; } });
13
16
  Object.defineProperty(exports, "MODEL_SPEC_BASE_KEY", { enumerable: true, get: function () { return model_1.MODEL_SPEC_BASE_KEY; } });
14
17
  Object.defineProperty(exports, "resolveModel", { enumerable: true, get: function () { return model_1.resolveModel; } });
@@ -16,6 +19,8 @@ Object.defineProperty(exports, "MODEL_ALIAS_SIGIL", { enumerable: true, get: fun
16
19
  Object.defineProperty(exports, "resolveModelAlias", { enumerable: true, get: function () { return model_1.resolveModelAlias; } });
17
20
  Object.defineProperty(exports, "resolveProviderModel", { enumerable: true, get: function () { return model_1.resolveProviderModel; } });
18
21
  Object.defineProperty(exports, "isResponsesOnlyModel", { enumerable: true, get: function () { return model_1.isResponsesOnlyModel; } });
22
+ Object.defineProperty(exports, "isAdaptiveThinkingModel", { enumerable: true, get: function () { return model_1.isAdaptiveThinkingModel; } });
23
+ Object.defineProperty(exports, "usesMaxCompletionTokensField", { enumerable: true, get: function () { return model_1.usesMaxCompletionTokensField; } });
19
24
  Object.defineProperty(exports, "toDataUrl", { enumerable: true, get: function () { return model_1.toDataUrl; } });
20
25
  var imageOptionsResolver_1 = require("./imageOptionsResolver");
21
26
  Object.defineProperty(exports, "resolveImageOptions", { enumerable: true, get: function () { return imageOptionsResolver_1.resolveImageOptions; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/ai-assist/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iCA6FiB;AA5Ff,iGAAA,QAAQ,OAAA;AAER,6GAAA,oBAAoB,OAAA;AA4BpB,0GAAA,iBAAiB,OAAA;AAqCjB,yGAAA,gBAAgB,OAAA;AAChB,4GAAA,mBAAmB,OAAA;AACnB,qGAAA,YAAY,OAAA;AAEZ,0GAAA,iBAAiB,OAAA;AACjB,0GAAA,iBAAiB,OAAA;AACjB,6GAAA,oBAAoB,OAAA;AACpB,6GAAA,oBAAoB,OAAA;AACpB,kGAAA,SAAS,OAAA;AAmBX,+DAIgC;AAF9B,2HAAA,mBAAmB,OAAA;AACnB,+HAAA,uBAAuB,OAAA;AAGzB,uCASoB;AARlB,0GAAA,cAAc,OAAA;AACd,kHAAA,sBAAsB,OAAA;AACtB,iHAAA,qBAAqB,OAAA;AACrB,kHAAA,sBAAsB,OAAA;AACtB,mHAAA,uBAAuB,OAAA;AACvB,sHAAA,0BAA0B,OAAA;AAC1B,6GAAA,iBAAiB,OAAA;AACjB,2HAAA,+BAA+B,OAAA;AAGjC,yCAUqB;AATnB,mHAAA,sBAAsB,OAAA;AACtB,kHAAA,qBAAqB,OAAA;AACrB,wHAAA,2BAA2B,OAAA;AAC3B,uHAAA,0BAA0B,OAAA;AAC1B,mHAAA,sBAAsB,OAAA;AACtB,kHAAA,qBAAqB,OAAA;AAMvB,qDAI2B;AAHzB,wHAAA,qBAAqB,OAAA;AACrB,uHAAA,oBAAoB,OAAA;AAItB,qDAQ2B;AAPzB,+HAAA,4BAA4B,OAAA;AAC5B,8HAAA,2BAA2B,OAAA;AAE3B,wHAAA,qBAAqB,OAAA;AAMvB,2CAYsB;AAXpB,0GAAA,YAAY,OAAA;AACZ,8GAAA,gBAAgB,OAAA;AAChB,mHAAA,qBAAqB,OAAA;AACrB,gHAAA,kBAAkB,OAAA;AAClB,+GAAA,iBAAiB,OAAA;AACjB,gHAAA,kBAAkB,OAAA;AAClB,8GAAA,gBAAgB,OAAA;AAChB,oHAAA,sBAAsB,OAAA;AACtB,8GAAA,gBAAgB,OAAA;AAChB,0GAAA,YAAY,OAAA;AACZ,uGAAA,SAAS,OAAA;AAGX,6CAAsD;AAA7C,oHAAA,qBAAqB,OAAA;AAE9B,+CAMwB;AALtB,+GAAA,eAAe,OAAA;AACf,qHAAA,qBAAqB,OAAA;AAMvB,mDAM0B;AALxB,wHAAA,sBAAsB,OAAA;AACtB,wHAAA,sBAAsB,OAAA;AAMxB,qEAAwG;AAA/F,wIAAA,6BAA6B,OAAA","sourcesContent":["/**\n * AI assist packlet - provider registry, prompt class, settings, and API client.\n * @packageDocumentation\n */\n\nexport {\n AiPrompt,\n type AiModelCapability,\n allModelCapabilities,\n type AiProviderId,\n type AiServerToolType,\n type AiServerToolConfig,\n type AiToolConfig,\n type IAiWebSearchToolConfig,\n type IAiClientToolConfig,\n type IAiToolAnnotations,\n type IAiClientTool,\n type IAiClientToolCallSummary,\n type IAiClientToolContinuation,\n type IAiClientToolTurnResult,\n type IAiToolEnablement,\n type IAiCompletionResponse,\n type IChatMessage,\n type IChatRequest,\n type AiApiFormat,\n type AiImageApiFormat,\n type AiEmbeddingApiFormat,\n type AiEmbeddingTaskType,\n type IAiEmbeddingModelCapability,\n type IAiEmbeddingParams,\n type IAiEmbeddingUsage,\n type IAiEmbeddingResult,\n type IAiImageModelCapability,\n type IAiProviderDescriptor,\n type IAiAssistProviderConfig,\n type IAiAssistSettings,\n DEFAULT_AI_ASSIST,\n type IAiAssistKeyStore,\n type IAiImageAttachment,\n type IAiImageData,\n type AiImageSize,\n type AiImageQuality,\n type GptImageSize,\n type GptImageQuality,\n type GptImageModelNames,\n type GrokImagineModelNames,\n type GeminiFlashImageModelNames,\n type IGptImageGenerationConfig,\n type IGrokImagineImageGenerationConfig,\n type IGeminiFlashImageGenerationConfig,\n type IGptImageModelOptions,\n type IGrokImagineModelOptions,\n type IGeminiFlashImageModelOptions,\n type IOtherModelOptions,\n type IModelFamilyConfig,\n type IAiImageGenerationOptions,\n type IAiImageGenerationParams,\n type IAiGeneratedImage,\n type IAiImageGenerationResponse,\n type IAiModelCapabilityRule,\n type IAiModelCapabilityConfig,\n type IAiModelInfo,\n type IAiStreamEvent,\n type IAiStreamTextDelta,\n type IAiStreamToolEvent,\n type IAiStreamToolUseStart,\n type IAiStreamToolUseDelta,\n type IAiStreamToolUseComplete,\n type IAiStreamDone,\n type IAiStreamError,\n type ModelSpec,\n type ModelSpecKey,\n type IModelSpecMap,\n allModelSpecKeys,\n MODEL_SPEC_BASE_KEY,\n resolveModel,\n type IModelAliasMap,\n MODEL_ALIAS_SIGIL,\n resolveModelAlias,\n resolveProviderModel,\n isResponsesOnlyModel,\n toDataUrl,\n type AiThinkingMode,\n type IThinkingConfig,\n type IThinkingProviderConfig,\n type IAnthropicThinkingOptions,\n type IOpenAiThinkingOptions,\n type IGeminiThinkingOptions,\n type IXAiThinkingOptions,\n type IOtherThinkingOptions,\n type IAnthropicThinkingConfig,\n type IOpenAiThinkingConfig,\n type IGeminiThinkingConfig,\n type IXAiThinkingConfig,\n type AnthropicThinkingModelNames,\n type OpenAiThinkingModelNames,\n type GeminiThinkingModelNames,\n type XAiThinkingModelNames\n} from './model';\n\nexport {\n type IResolvedImageOptions,\n resolveImageOptions,\n validateResolvedOptions\n} from './imageOptionsResolver';\n\nexport {\n allProviderIds,\n getProviderDescriptors,\n getProviderDescriptor,\n resolveImageCapability,\n supportsImageGeneration,\n resolveEmbeddingCapability,\n supportsEmbedding,\n DEFAULT_MODEL_CAPABILITY_CONFIG\n} from './registry';\n\nexport {\n callProviderCompletion,\n callProxiedCompletion,\n callProviderImageGeneration,\n callProxiedImageGeneration,\n callProviderListModels,\n callProxiedListModels,\n type IProviderCompletionParams,\n type IProviderImageGenerationParams,\n type IProviderListModelsParams\n} from './apiClient';\n\nexport {\n callProviderEmbedding,\n callProxiedEmbedding,\n type IProviderEmbeddingParams\n} from './embeddingClient';\n\nexport {\n callProviderCompletionStream,\n callProxiedCompletionStream,\n type IProviderCompletionStreamParams,\n executeClientToolTurn,\n type IExecuteClientToolTurnParams,\n type IExecuteClientToolTurnResult,\n type IToolExecutionDecision\n} from './streamingClient';\n\nexport {\n aiProviderId,\n aiServerToolType,\n aiWebSearchToolConfig,\n aiServerToolConfig,\n aiToolAnnotations,\n aiClientToolConfig,\n aiToolEnablement,\n aiAssistProviderConfig,\n aiAssistSettings,\n modelSpecKey,\n modelSpec\n} from './converters';\n\nexport { resolveEffectiveTools } from './toolFormats';\n\nexport {\n extractJsonText,\n fencedStringifiedJson,\n type IFencedStringifiedJsonExtractorOptions,\n type IFencedStringifiedJsonOptions,\n type JsonTextExtractor\n} from './jsonResponse';\n\nexport {\n generateJsonCompletion,\n SMART_JSON_PROMPT_HINT,\n type IGenerateJsonCompletionParams,\n type IGenerateJsonCompletionResult,\n type JsonPromptHint\n} from './jsonCompletion';\n\nexport { anthropicEffortToBudgetTokens, type IResolvedThinkingConfig } from './thinkingOptionsResolver';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/ai-assist/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,iCAiGiB;AAhGf,iGAAA,QAAQ,OAAA;AAER,6GAAA,oBAAoB,OAAA;AAcpB,qHAAA,4BAA4B,OAAA;AAe5B,0GAAA,iBAAiB,OAAA;AAEjB,iHAAA,wBAAwB,OAAA;AAoCxB,yG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SAAS,OAAA;AAGX,6CAAsD;AAA7C,oHAAA,qBAAqB,OAAA;AAE9B,+CAMwB;AALtB,+GAAA,eAAe,OAAA;AACf,qHAAA,qBAAqB,OAAA;AAMvB,mDAM0B;AALxB,wHAAA,sBAAsB,OAAA;AACtB,wHAAA,sBAAsB,OAAA;AAMxB,qEAAwG;AAA/F,wIAAA,6BAA6B,OAAA","sourcesContent":["/**\n * AI assist packlet - provider registry, prompt class, settings, and API client.\n * @packageDocumentation\n */\n\nexport {\n AiPrompt,\n type AiModelCapability,\n allModelCapabilities,\n type AiProviderId,\n type AiServerToolType,\n type AiServerToolConfig,\n type AiToolConfig,\n type IAiWebSearchToolConfig,\n type IAiClientToolConfig,\n type IAiToolAnnotations,\n type IAiClientTool,\n type IAiClientToolCallSummary,\n type IAiClientToolContinuation,\n type IAiClientToolTurnResult,\n type IAiToolEnablement,\n type IAiCompletionResponse,\n DEFAULT_ANTHROPIC_MAX_TOKENS,\n type IChatMessage,\n type IChatRequest,\n type AiApiFormat,\n type AiImageApiFormat,\n type AiEmbeddingApiFormat,\n type AiEmbeddingTaskType,\n type IAiEmbeddingModelCapability,\n type IAiEmbeddingParams,\n type IAiEmbeddingUsage,\n type IAiEmbeddingResult,\n type IAiImageModelCapability,\n type IAiProviderDescriptor,\n type IAiAssistProviderConfig,\n type IAiAssistSettings,\n DEFAULT_AI_ASSIST,\n type IAiAssistKeyStore,\n providerApiKeySecretName,\n type IAiImageAttachment,\n type IAiImageData,\n type AiImageSize,\n type AiImageQuality,\n type GptImageSize,\n type GptImageQuality,\n type GptImageModelNames,\n type GrokImagineModelNames,\n type GeminiFlashImageModelNames,\n type IGptImageGenerationConfig,\n type IGrokImagineImageGenerationConfig,\n type IGeminiFlashImageGenerationConfig,\n type IGptImageModelOptions,\n type IGrokImagineModelOptions,\n type IGeminiFlashImageModelOptions,\n type IOtherModelOptions,\n type IModelFamilyConfig,\n type IAiImageGenerationOptions,\n type IAiImageGenerationParams,\n type IAiGeneratedImage,\n type IAiImageGenerationResponse,\n type IAiModelCapabilityRule,\n type IAiModelCapabilityConfig,\n type IAiModelInfo,\n type IAiStreamEvent,\n type IAiStreamTextDelta,\n type IAiStreamToolEvent,\n type IAiStreamToolUseStart,\n type IAiStreamToolUseDelta,\n type IAiStreamToolUseComplete,\n type IAiStreamDone,\n type IAiStreamError,\n type ModelSpec,\n type ModelSpecKey,\n type IModelSpecMap,\n allModelSpecKeys,\n MODEL_SPEC_BASE_KEY,\n resolveModel,\n type IModelAliasMap,\n MODEL_ALIAS_SIGIL,\n resolveModelAlias,\n resolveProviderModel,\n isResponsesOnlyModel,\n isAdaptiveThinkingModel,\n usesMaxCompletionTokensField,\n toDataUrl,\n type AiThinkingMode,\n type IThinkingConfig,\n type IThinkingProviderConfig,\n type IAnthropicThinkingOptions,\n type IOpenAiThinkingOptions,\n type IGeminiThinkingOptions,\n type IXAiThinkingOptions,\n type IOtherThinkingOptions,\n type IAnthropicThinkingConfig,\n type IOpenAiThinkingConfig,\n type IGeminiThinkingConfig,\n type IXAiThinkingConfig,\n type AnthropicThinkingModelNames,\n type OpenAiThinkingModelNames,\n type GeminiThinkingModelNames,\n type XAiThinkingModelNames\n} from './model';\n\nexport {\n type IResolvedImageOptions,\n resolveImageOptions,\n validateResolvedOptions\n} from './imageOptionsResolver';\n\nexport {\n allProviderIds,\n getProviderDescriptors,\n getProviderDescriptor,\n resolveImageCapability,\n supportsImageGeneration,\n resolveEmbeddingCapability,\n supportsEmbedding,\n DEFAULT_MODEL_CAPABILITY_CONFIG\n} from './registry';\n\nexport {\n callProviderCompletion,\n callProxiedCompletion,\n callProviderImageGeneration,\n callProxiedImageGeneration,\n callProviderListModels,\n callProxiedListModels,\n type IProviderCompletionParams,\n type IProviderImageGenerationParams,\n type IProviderListModelsParams\n} from './apiClient';\n\nexport {\n callProviderEmbedding,\n callProxiedEmbedding,\n type IProviderEmbeddingParams\n} from './embeddingClient';\n\nexport {\n callProviderCompletionStream,\n callProxiedCompletionStream,\n type IProviderCompletionStreamParams,\n executeClientToolTurn,\n type IExecuteClientToolTurnParams,\n type IExecuteClientToolTurnResult,\n type IToolExecutionDecision\n} from './streamingClient';\n\nexport {\n aiProviderId,\n aiServerToolType,\n aiWebSearchToolConfig,\n aiServerToolConfig,\n aiToolAnnotations,\n aiClientToolConfig,\n aiToolEnablement,\n aiAssistProviderConfig,\n aiAssistSettings,\n modelSpecKey,\n modelSpec\n} from './converters';\n\nexport { resolveEffectiveTools } from './toolFormats';\n\nexport {\n extractJsonText,\n fencedStringifiedJson,\n type IFencedStringifiedJsonExtractorOptions,\n type IFencedStringifiedJsonOptions,\n type JsonTextExtractor\n} from './jsonResponse';\n\nexport {\n generateJsonCompletion,\n SMART_JSON_PROMPT_HINT,\n type IGenerateJsonCompletionParams,\n type IGenerateJsonCompletionResult,\n type JsonPromptHint\n} from './jsonCompletion';\n\nexport { anthropicEffortToBudgetTokens, type IResolvedThinkingConfig } from './thinkingOptionsResolver';\n"]}
@@ -31,6 +31,13 @@ export type JsonTextExtractor = (text: string) => Result<string>;
31
31
  *
32
32
  * Out of scope: repairing malformed JSON, handling smart quotes, etc.
33
33
  *
34
+ * When an object or array opens but never closes before the end of input —
35
+ * the shape a response truncated by a token cap leaves behind — the failure
36
+ * names that specifically (distinct from the generic "no JSON-shaped
37
+ * substring found" for input that never looked like JSON at all) and points
38
+ * at `IAiCompletionResponse.truncated` and the `maxTokens` request option as
39
+ * the likely cause and fix.
40
+ *
34
41
  * @param text - Raw model output.
35
42
  * @returns A `Result<string>` containing the JSON-shaped substring, or a
36
43
  * `Failure` if no JSON-shaped substring was found.
@@ -1 +1 @@
1
- {"version":3,"file":"jsonResponse.d.ts","sourceRoot":"","sources":["../../../src/packlets/ai-assist/jsonResponse.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAc,KAAK,SAAS,EAAQ,MAAM,EAAW,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAoC,KAAK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AEF;;;GAGG;AACH,MAAM,WAAW,sCAAsC;IACrD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAC;CACxC;AAED;;;;;GAKG;AACH,MAAM,WAAW,6BAA6B,CAAC,CAAC,CAAE,SAAQ,sCAAsC;IAC9F,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,sCAAsC,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;AAC9G;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,6BAA6B,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC"}
@@ -92,11 +92,11 @@ function findBalancedJsonSubstring(text) {
92
92
  else if (ch === close) {
93
93
  depth--;
94
94
  if (depth === 0) {
95
- return text.slice(start, i + 1);
95
+ return { kind: 'found', value: text.slice(start, i + 1) };
96
96
  }
97
97
  }
98
98
  }
99
- return undefined;
99
+ return start >= 0 ? { kind: 'unclosed', depth } : { kind: 'none' };
100
100
  }
101
101
  /**
102
102
  * Default {@link AiAssist.JsonTextExtractor | extractor} for LLM responses. Tolerates:
@@ -108,6 +108,13 @@ function findBalancedJsonSubstring(text) {
108
108
  *
109
109
  * Out of scope: repairing malformed JSON, handling smart quotes, etc.
110
110
  *
111
+ * When an object or array opens but never closes before the end of input —
112
+ * the shape a response truncated by a token cap leaves behind — the failure
113
+ * names that specifically (distinct from the generic "no JSON-shaped
114
+ * substring found" for input that never looked like JSON at all) and points
115
+ * at `IAiCompletionResponse.truncated` and the `maxTokens` request option as
116
+ * the likely cause and fix.
117
+ *
111
118
  * @param text - Raw model output.
112
119
  * @returns A `Result<string>` containing the JSON-shaped substring, or a
113
120
  * `Failure` if no JSON-shaped substring was found.
@@ -132,9 +139,13 @@ const extractJsonText = (text) => {
132
139
  if (JSON_KEYWORD.test(candidate) || JSON_NUMBER.test(candidate) || JSON_STRING.test(candidate)) {
133
140
  return (0, ts_utils_1.succeed)(candidate);
134
141
  }
135
- const balanced = findBalancedJsonSubstring(candidate);
136
- if (balanced !== undefined) {
137
- return (0, ts_utils_1.succeed)(balanced);
142
+ const scan = findBalancedJsonSubstring(candidate);
143
+ if (scan.kind === 'found') {
144
+ return (0, ts_utils_1.succeed)(scan.value);
145
+ }
146
+ if (scan.kind === 'unclosed') {
147
+ return (0, ts_utils_1.fail)(`extractJsonText: JSON structure opened but never closed (depth ${scan.depth} at end of input) — ` +
148
+ 'response may have been truncated (check IAiCompletionResponse.truncated / raise maxTokens).');
138
149
  }
139
150
  return (0, ts_utils_1.fail)('extractJsonText: no JSON-shaped substring found.');
140
151
  };
@@ -1 +1 @@
1
- {"version":3,"file":"jsonResponse.js","sourceRoot":"","sources":["../../../src/packlets/ai-assist/jsonResponse.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;;;AA4LZ,sDAcC;AAxMD;;;;;;;;;;;;;GAaG;AAEH,4CAAkG;AAClG,oDAAqF;AAUrF,MAAM,YAAY,GAAW,8CAA8C,CAAC;AAC5E,MAAM,GAAG,GAAW,SAAS,CAAC;AAC9B,uEAAuE;AACvE,4EAA4E;AAC5E,MAAM,WAAW,GAAW,+CAA+C,CAAC;AAC5E,4CAA4C;AAC5C,MAAM,WAAW,GAAW,gEAAgE,CAAC;AAC7F,MAAM,YAAY,GAAW,uBAAuB,CAAC;AAEr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AW,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/F,OAAO,IAAA,kBAAO,EAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,QAAQ,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC;IACtD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,IAAA,kBAAO,EAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,IAAA,eAAI,EAAC,kDAAkD,CAAC,CAAC;AAClE,CAAC,CAAC;AA7BW,QAAA,eAAe,mBA6B1B;AAuDF,SAAgB,qBAAqB,CACnC,OAAmF;;IAEnF,MAAM,SAAS,GAAsB,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,mCAAI,uBAAe,CAAC;IAC3E,MAAM,KAAK,GAAI,OAAwD,aAAxD,OAAO,uBAAP,OAAO,CAAmD,KAAK,CAAC;IAC/E,MAAM,MAAM,GACV,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,yBAAkB,CAAC,eAAe,CAAI,KAAK,CAAC,CAAC,CAAC,CAAC,yBAAkB,CAAC,eAAe,EAAE,CAAC;IAE5G,OAAO,IAAI,qBAAU,CAAC,aAAa,CAAgB,CAAC,IAAa,EAAyB,EAAE;QAC1F,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAA,eAAI,EAAC,gDAAgD,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) 2026 Erik Fortune\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n/**\n * JSON-tolerant extraction and converters for LLM responses.\n *\n * Models commonly wrap JSON output in Markdown code fences, add a\n * \"Sure, here's the JSON:\" preamble, or trail off with prose after the\n * closing brace. These helpers normalize that quirk on the read side so every\n * AiAssist consumer can reach a validated `T` from raw model text without\n * reimplementing the same fence-stripping logic.\n *\n * Scope: strip wrappers (fences, prose, BOM, whitespace). Out of scope: repair\n * malformed JSON (missing commas, unquoted keys, smart quotes, etc.).\n *\n * @packageDocumentation\n */\n\nimport { Conversion, type Converter, fail, Result, succeed, type Validator } from '@fgv/ts-utils';\nimport { Converters as JsonBaseConverters, type JsonValue } from '@fgv/ts-json-base';\n\n/**\n * A function that pulls a JSON-shaped substring out of arbitrary model text.\n * Implementations strip whatever wrappers the model added (fences, preamble,\n * trailing prose) and return the JSON-shaped substring ready for `JSON.parse`.\n * @public\n */\nexport type JsonTextExtractor = (text: string) => Result<string>;\n\nconst FENCED_BLOCK: RegExp = /```[A-Za-z0-9_-]*\\s*\\r?\\n([\\s\\S]*?)\\r?\\n?```/;\nconst BOM: RegExp = /^\\uFEFF/;\n// Full RFC 8259 grammar so the extractor only succeeds when the entire\n// candidate parses as a JSON primitive (instead of just starting like one).\nconst JSON_NUMBER: RegExp = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$/;\n// eslint-disable-next-line no-control-regex\nconst JSON_STRING: RegExp = /^\"(?:[^\"\\\\\\u0000-\\u001F]|\\\\(?:[\"\\\\/bfnrt]|u[0-9a-fA-F]{4}))*\"$/;\nconst JSON_KEYWORD: RegExp = /^(?:true|false|null)$/;\n\nfunction stripBom(text: string): string {\n return text.replace(BOM, '');\n}\n\nfunction findBalancedJsonSubstring(text: string): string | undefined {\n // Walk the text once tracking string state. The first '{' or '[' that is\n // *outside* a quoted string is the candidate start; from there, count\n // matching close characters while ignoring delimiters that appear inside\n // strings.\n let inString = false;\n let escape = false;\n let start = -1;\n let open = '';\n let close = '';\n let depth = 0;\n for (let i = 0; i < text.length; i++) {\n const ch = text.charAt(i);\n if (inString) {\n if (escape) {\n escape = false;\n } else if (ch === '\\\\') {\n escape = true;\n } else if (ch === '\"') {\n inString = false;\n }\n continue;\n }\n if (ch === '\"') {\n inString = true;\n continue;\n }\n if (start < 0) {\n if (ch === '{' || ch === '[') {\n start = i;\n open = ch;\n close = ch === '{' ? '}' : ']';\n depth = 1;\n }\n continue;\n }\n if (ch === open) {\n depth++;\n } else if (ch === close) {\n depth--;\n if (depth === 0) {\n return text.slice(start, i + 1);\n }\n }\n }\n return undefined;\n}\n\n/**\n * Default {@link AiAssist.JsonTextExtractor | extractor} for LLM responses. Tolerates:\n *\n * - Leading/trailing whitespace and a leading byte-order mark.\n * - Markdown code fences (with or without a language tag).\n * - Conversational preamble before the first `{` or `[`.\n * - Trailing prose after the matched closing `}` or `]`.\n *\n * Out of scope: repairing malformed JSON, handling smart quotes, etc.\n *\n * @param text - Raw model output.\n * @returns A `Result<string>` containing the JSON-shaped substring, or a\n * `Failure` if no JSON-shaped substring was found.\n * @public\n */\nexport const extractJsonText: JsonTextExtractor = (text: string): Result<string> => {\n if (typeof text !== 'string') {\n return fail('extractJsonText: input must be a string.');\n }\n const stripped = stripBom(text).trim();\n if (stripped.length === 0) {\n return fail('extractJsonText: input is empty.');\n }\n\n const fenced = FENCED_BLOCK.exec(stripped);\n const candidate = fenced ? fenced[1].trim() : stripped;\n\n if (candidate.length === 0) {\n return fail('extractJsonText: no JSON content found.');\n }\n\n // Whole-candidate primitive check runs before the brace scan so that a\n // valid JSON string containing braces (e.g. `\"text with { }\"`) is returned\n // intact instead of being mangled into the first balanced `{ }` match.\n if (JSON_KEYWORD.test(candidate) || JSON_NUMBER.test(candidate) || JSON_STRING.test(candidate)) {\n return succeed(candidate);\n }\n\n const balanced = findBalancedJsonSubstring(candidate);\n if (balanced !== undefined) {\n return succeed(balanced);\n }\n\n return fail('extractJsonText: no JSON-shaped substring found.');\n};\n\n/**\n * Options shared by every {@link AiAssist.fencedStringifiedJson} call.\n * @public\n */\nexport interface IFencedStringifiedJsonExtractorOptions {\n /**\n * Optional pre-parse extractor. Defaults to {@link AiAssist.extractJsonText}.\n * Provide a custom extractor to handle response shapes the default does not\n * understand.\n */\n readonly extractor?: JsonTextExtractor;\n}\n\n/**\n * Options for the validating overload of {@link AiAssist.fencedStringifiedJson}.\n * `inner` is required so the typed `Converter<T>` return value can never lie\n * about the runtime shape.\n * @public\n */\nexport interface IFencedStringifiedJsonOptions<T> extends IFencedStringifiedJsonExtractorOptions {\n /** Inner converter or validator applied to the parsed JSON value. */\n readonly inner: Converter<T> | Validator<T>;\n}\n\n/**\n * Creates a `Converter` that accepts raw LLM response text, runs it through a\n * tolerant extractor (default: {@link AiAssist.extractJsonText}), parses the\n * extracted substring as JSON, and applies an optional inner converter or\n * validator.\n *\n * @example\n * ```ts\n * const converter = fencedStringifiedJson({ inner: myShapeConverter });\n * const result = converter.convert(llmText); // Result<MyShape>\n * ```\n *\n * @param options - Optional extractor; omit to keep the default. Without an\n * `inner` step, the converter resolves to the parsed `JsonValue`.\n * @returns A `Converter<JsonValue>`.\n * @public\n */\nexport function fencedStringifiedJson(options?: IFencedStringifiedJsonExtractorOptions): Converter<JsonValue>;\n/**\n * Creates a `Converter` that accepts raw LLM response text, runs it through a\n * tolerant extractor (default: {@link AiAssist.extractJsonText}), parses the\n * extracted substring as JSON, and applies the supplied inner converter or\n * validator.\n *\n * @param options - Required `inner` converter/validator and optional extractor.\n * @returns A `Converter<T>`.\n * @public\n */\nexport function fencedStringifiedJson<T>(options: IFencedStringifiedJsonOptions<T>): Converter<T>;\nexport function fencedStringifiedJson<T>(\n options?: IFencedStringifiedJsonExtractorOptions | IFencedStringifiedJsonOptions<T>\n): Converter<T | JsonValue> {\n const extractor: JsonTextExtractor = options?.extractor ?? extractJsonText;\n const inner = (options as IFencedStringifiedJsonOptions<T> | undefined)?.inner;\n const parser: Converter<T | JsonValue> =\n inner !== undefined ? JsonBaseConverters.stringifiedJson<T>(inner) : JsonBaseConverters.stringifiedJson();\n\n return new Conversion.BaseConverter<T | JsonValue>((from: unknown): Result<T | JsonValue> => {\n if (typeof from !== 'string') {\n return fail('fencedStringifiedJson: input must be a string.');\n }\n return extractor(from).onSuccess((extracted) => parser.convert(extracted));\n });\n}\n"]}
1
+ {"version":3,"file":"jsonResponse.js","sourceRoot":"","sources":["../../../src/packlets/ai-assist/jsonResponse.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;;;AA0NZ,sDAcC;AAtOD;;;;;;;;;;;;;GAaG;AAEH,4CAAkG;AAClG,oDAAqF;AAUrF,MAAM,YAAY,GAAW,8CAA8C,CAAC;AAC5E,MAAM,GAAG,GAAW,SAAS,CAAC;AAC9B,uEAAuE;AACvE,4EAA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IAE5G,OAAO,IAAI,qBAAU,CAAC,aAAa,CAAgB,CAAC,IAAa,EAAyB,EAAE;QAC1F,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAA,eAAI,EAAC,gDAAgD,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) 2026 Erik Fortune\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n/**\n * JSON-tolerant extraction and converters for LLM responses.\n *\n * Models commonly wrap JSON output in Markdown code fences, add a\n * \"Sure, here's the JSON:\" preamble, or trail off with prose after the\n * closing brace. These helpers normalize that quirk on the read side so every\n * AiAssist consumer can reach a validated `T` from raw model text without\n * reimplementing the same fence-stripping logic.\n *\n * Scope: strip wrappers (fences, prose, BOM, whitespace). Out of scope: repair\n * malformed JSON (missing commas, unquoted keys, smart quotes, etc.).\n *\n * @packageDocumentation\n */\n\nimport { Conversion, type Converter, fail, Result, succeed, type Validator } from '@fgv/ts-utils';\nimport { Converters as JsonBaseConverters, type JsonValue } from '@fgv/ts-json-base';\n\n/**\n * A function that pulls a JSON-shaped substring out of arbitrary model text.\n * Implementations strip whatever wrappers the model added (fences, preamble,\n * trailing prose) and return the JSON-shaped substring ready for `JSON.parse`.\n * @public\n */\nexport type JsonTextExtractor = (text: string) => Result<string>;\n\nconst FENCED_BLOCK: RegExp = /```[A-Za-z0-9_-]*\\s*\\r?\\n([\\s\\S]*?)\\r?\\n?```/;\nconst BOM: RegExp = /^\\uFEFF/;\n// Full RFC 8259 grammar so the extractor only succeeds when the entire\n// candidate parses as a JSON primitive (instead of just starting like one).\nconst JSON_NUMBER: RegExp = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$/;\n// eslint-disable-next-line no-control-regex\nconst JSON_STRING: RegExp = /^\"(?:[^\"\\\\\\u0000-\\u001F]|\\\\(?:[\"\\\\/bfnrt]|u[0-9a-fA-F]{4}))*\"$/;\nconst JSON_KEYWORD: RegExp = /^(?:true|false|null)$/;\n\nfunction stripBom(text: string): string {\n return text.replace(BOM, '');\n}\n\n/**\n * Outcome of a {@link findBalancedJsonSubstring} scan.\n *\n * - `'found'`: a balanced JSON-shaped substring was located; `value` is it.\n * - `'unclosed'`: an object or array opened but the matching close never\n * arrived before the end of input — the classic truncated-response shape;\n * `depth` is the unresolved depth at end of input, counting only the\n * opening delimiter's type (the scan tracks the candidate's own `{`/`}`\n * or `[`/`]` pair, not total mixed-delimiter nesting).\n * - `'none'`: no `{` or `[` was ever seen outside a quoted string.\n * @internal\n */\ntype BalancedJsonScanResult =\n | { readonly kind: 'found'; readonly value: string }\n | { readonly kind: 'unclosed'; readonly depth: number }\n | { readonly kind: 'none' };\n\nfunction findBalancedJsonSubstring(text: string): BalancedJsonScanResult {\n // Walk the text once tracking string state. The first '{' or '[' that is\n // *outside* a quoted string is the candidate start; from there, count\n // matching close characters while ignoring delimiters that appear inside\n // strings.\n let inString = false;\n let escape = false;\n let start = -1;\n let open = '';\n let close = '';\n let depth = 0;\n for (let i = 0; i < text.length; i++) {\n const ch = text.charAt(i);\n if (inString) {\n if (escape) {\n escape = false;\n } else if (ch === '\\\\') {\n escape = true;\n } else if (ch === '\"') {\n inString = false;\n }\n continue;\n }\n if (ch === '\"') {\n inString = true;\n continue;\n }\n if (start < 0) {\n if (ch === '{' || ch === '[') {\n start = i;\n open = ch;\n close = ch === '{' ? '}' : ']';\n depth = 1;\n }\n continue;\n }\n if (ch === open) {\n depth++;\n } else if (ch === close) {\n depth--;\n if (depth === 0) {\n return { kind: 'found', value: text.slice(start, i + 1) };\n }\n }\n }\n return start >= 0 ? { kind: 'unclosed', depth } : { kind: 'none' };\n}\n\n/**\n * Default {@link AiAssist.JsonTextExtractor | extractor} for LLM responses. Tolerates:\n *\n * - Leading/trailing whitespace and a leading byte-order mark.\n * - Markdown code fences (with or without a language tag).\n * - Conversational preamble before the first `{` or `[`.\n * - Trailing prose after the matched closing `}` or `]`.\n *\n * Out of scope: repairing malformed JSON, handling smart quotes, etc.\n *\n * When an object or array opens but never closes before the end of input —\n * the shape a response truncated by a token cap leaves behind — the failure\n * names that specifically (distinct from the generic \"no JSON-shaped\n * substring found\" for input that never looked like JSON at all) and points\n * at `IAiCompletionResponse.truncated` and the `maxTokens` request option as\n * the likely cause and fix.\n *\n * @param text - Raw model output.\n * @returns A `Result<string>` containing the JSON-shaped substring, or a\n * `Failure` if no JSON-shaped substring was found.\n * @public\n */\nexport const extractJsonText: JsonTextExtractor = (text: string): Result<string> => {\n if (typeof text !== 'string') {\n return fail('extractJsonText: input must be a string.');\n }\n const stripped = stripBom(text).trim();\n if (stripped.length === 0) {\n return fail('extractJsonText: input is empty.');\n }\n\n const fenced = FENCED_BLOCK.exec(stripped);\n const candidate = fenced ? fenced[1].trim() : stripped;\n\n if (candidate.length === 0) {\n return fail('extractJsonText: no JSON content found.');\n }\n\n // Whole-candidate primitive check runs before the brace scan so that a\n // valid JSON string containing braces (e.g. `\"text with { }\"`) is returned\n // intact instead of being mangled into the first balanced `{ }` match.\n if (JSON_KEYWORD.test(candidate) || JSON_NUMBER.test(candidate) || JSON_STRING.test(candidate)) {\n return succeed(candidate);\n }\n\n const scan = findBalancedJsonSubstring(candidate);\n if (scan.kind === 'found') {\n return succeed(scan.value);\n }\n if (scan.kind === 'unclosed') {\n return fail(\n `extractJsonText: JSON structure opened but never closed (depth ${scan.depth} at end of input) — ` +\n 'response may have been truncated (check IAiCompletionResponse.truncated / raise maxTokens).'\n );\n }\n\n return fail('extractJsonText: no JSON-shaped substring found.');\n};\n\n/**\n * Options shared by every {@link AiAssist.fencedStringifiedJson} call.\n * @public\n */\nexport interface IFencedStringifiedJsonExtractorOptions {\n /**\n * Optional pre-parse extractor. Defaults to {@link AiAssist.extractJsonText}.\n * Provide a custom extractor to handle response shapes the default does not\n * understand.\n */\n readonly extractor?: JsonTextExtractor;\n}\n\n/**\n * Options for the validating overload of {@link AiAssist.fencedStringifiedJson}.\n * `inner` is required so the typed `Converter<T>` return value can never lie\n * about the runtime shape.\n * @public\n */\nexport interface IFencedStringifiedJsonOptions<T> extends IFencedStringifiedJsonExtractorOptions {\n /** Inner converter or validator applied to the parsed JSON value. */\n readonly inner: Converter<T> | Validator<T>;\n}\n\n/**\n * Creates a `Converter` that accepts raw LLM response text, runs it through a\n * tolerant extractor (default: {@link AiAssist.extractJsonText}), parses the\n * extracted substring as JSON, and applies an optional inner converter or\n * validator.\n *\n * @example\n * ```ts\n * const converter = fencedStringifiedJson({ inner: myShapeConverter });\n * const result = converter.convert(llmText); // Result<MyShape>\n * ```\n *\n * @param options - Optional extractor; omit to keep the default. Without an\n * `inner` step, the converter resolves to the parsed `JsonValue`.\n * @returns A `Converter<JsonValue>`.\n * @public\n */\nexport function fencedStringifiedJson(options?: IFencedStringifiedJsonExtractorOptions): Converter<JsonValue>;\n/**\n * Creates a `Converter` that accepts raw LLM response text, runs it through a\n * tolerant extractor (default: {@link AiAssist.extractJsonText}), parses the\n * extracted substring as JSON, and applies the supplied inner converter or\n * validator.\n *\n * @param options - Required `inner` converter/validator and optional extractor.\n * @returns A `Converter<T>`.\n * @public\n */\nexport function fencedStringifiedJson<T>(options: IFencedStringifiedJsonOptions<T>): Converter<T>;\nexport function fencedStringifiedJson<T>(\n options?: IFencedStringifiedJsonExtractorOptions | IFencedStringifiedJsonOptions<T>\n): Converter<T | JsonValue> {\n const extractor: JsonTextExtractor = options?.extractor ?? extractJsonText;\n const inner = (options as IFencedStringifiedJsonOptions<T> | undefined)?.inner;\n const parser: Converter<T | JsonValue> =\n inner !== undefined ? JsonBaseConverters.stringifiedJson<T>(inner) : JsonBaseConverters.stringifiedJson();\n\n return new Conversion.BaseConverter<T | JsonValue>((from: unknown): Result<T | JsonValue> => {\n if (typeof from !== 'string') {\n return fail('fencedStringifiedJson: input must be a string.');\n }\n return extractor(from).onSuccess((extracted) => parser.convert(extracted));\n });\n}\n"]}
@@ -532,6 +532,53 @@ export declare function resolveProviderModel(descriptor: IAiProviderDescriptor,
532
532
  * @public
533
533
  */
534
534
  export declare function isResponsesOnlyModel(descriptor: IAiProviderDescriptor, modelId: string): boolean;
535
+ /**
536
+ * Determines whether a concrete (already-resolved) Anthropic model id uses the adaptive
537
+ * thinking wire shape (`thinking: { type: 'adaptive' }` + top-level `output_config.effort`)
538
+ * rather than the legacy manual-budget shape (`thinking: { type: 'enabled', budget_tokens }`).
539
+ *
540
+ * @remarks
541
+ * Matches `modelId` against the descriptor's
542
+ * {@link IAiProviderDescriptor.adaptiveThinkingModelPrefixes} using the same
543
+ * exact-or-dash-bounded matcher semantics as the model-specific blocks in
544
+ * `mergeThinkingConfig` (an entry matches when it equals the resolved model or when the
545
+ * resolved model starts with the entry followed by a `-`) — a plain prefix match would risk a
546
+ * false positive against an unrelated model sharing the same leading characters. A provider
547
+ * that declares no list (the common case — this is Anthropic-specific) always returns `false`.
548
+ * Consulted by the completion (`callProviderCompletion`), streaming
549
+ * (`callProviderCompletionStream`), and client-tool (`executeClientToolTurn`) Anthropic
550
+ * dispatch sites so every Anthropic wire-request path picks the correct thinking shape for the
551
+ * resolved model.
552
+ *
553
+ * @param descriptor - The provider descriptor supplying the prefix list.
554
+ * @param modelId - The resolved concrete model id to test.
555
+ * @returns `true` when `modelId` exactly matches or is dash-bounded-prefixed by any declared
556
+ * adaptive-thinking prefix.
557
+ * @public
558
+ */
559
+ export declare function isAdaptiveThinkingModel(descriptor: IAiProviderDescriptor, modelId: string): boolean;
560
+ /**
561
+ * Determines whether a provider's OpenAI-compatible Chat Completions request
562
+ * should use the modern `max_completion_tokens` field instead of the legacy
563
+ * `max_tokens` field for capping output length.
564
+ *
565
+ * @remarks
566
+ * OpenAI's Chat Completions API deprecated `max_tokens` in favor of
567
+ * `max_completion_tokens`. Every other provider routed through the shared
568
+ * OpenAI-compatible chat-completions adapter (xAI Grok, Groq, Mistral, Ollama,
569
+ * self-hosted `openai-compat` servers) still expects the legacy `max_tokens`
570
+ * field, so this returns `true` only for the `'openai'` provider id. Consulted
571
+ * by both the completion (`callProviderCompletion`) and streaming
572
+ * (`callProviderCompletionStream`) chat-completions dispatch branches. Not
573
+ * consulted on the Responses API path — `max_output_tokens` applies uniformly
574
+ * there for both OpenAI and xAI (see `isResponsesOnlyModel`) —
575
+ * nor by any non-`'openai'`-format provider (Anthropic, Gemini).
576
+ *
577
+ * @param descriptor - The provider descriptor.
578
+ * @returns `true` only for the `'openai'` provider id.
579
+ * @public
580
+ */
581
+ export declare function usesMaxCompletionTokensField(descriptor: IAiProviderDescriptor): boolean;
535
582
  /**
536
583
  * All known AI provider identifiers.
537
584
  * @public
@@ -586,6 +633,27 @@ export interface IAiCompletionResponse {
586
633
  /** Whether the response was truncated due to token limits */
587
634
  readonly truncated: boolean;
588
635
  }
636
+ /**
637
+ * Default `max_tokens` sent to the Anthropic Messages API when the caller does
638
+ * not supply an explicit `maxTokens` override.
639
+ *
640
+ * @remarks
641
+ * Anthropic's Messages API requires `max_tokens` on every request — there is
642
+ * no provider-side default the way there is for OpenAI Chat/Responses,
643
+ * Gemini, or xAI, all of which accept a request with no cap and apply their
644
+ * own default. Anthropic is therefore the only provider that needs — or
645
+ * gets — a library-supplied fallback; every other provider omits the field
646
+ * entirely when the caller doesn't set `maxTokens` (see
647
+ * `IProviderCompletionParams.maxTokens`).
648
+ *
649
+ * Callers whose structured/JSON output scales with input size and hits this
650
+ * ceiling see a silent truncation that often surfaces downstream as a
651
+ * confusing `extractJsonText` parse failure rather than an obvious "too
652
+ * short" error — pass `maxTokens` explicitly to raise the cap for those
653
+ * requests.
654
+ * @public
655
+ */
656
+ export declare const DEFAULT_ANTHROPIC_MAX_TOKENS: number;
589
657
  /**
590
658
  * A text-content delta arriving during a streaming completion.
591
659
  * @public
@@ -780,6 +848,27 @@ export interface IAiProviderDescriptor {
780
848
  * Responses-only.
781
849
  */
782
850
  readonly responsesOnlyModelPrefixes?: ReadonlyArray<string>;
851
+ /**
852
+ * Concrete Anthropic model ids (exact-or-dash-bounded-prefix-matched) that require the
853
+ * adaptive thinking wire shape (`thinking: { type: 'adaptive' }` + top-level
854
+ * `output_config: { effort }`) rather than the legacy manual-budget shape
855
+ * (`thinking: { type: 'enabled', budget_tokens }`). Non-Anthropic `apiFormat`s ignore this.
856
+ *
857
+ * @remarks
858
+ * The Claude 5 family (`claude-sonnet-5`, `claude-opus-5`, `claude-fable-5`, including their
859
+ * dated snapshots) rejects `thinking.type: 'enabled'` with an HTTP 400 and requires the
860
+ * adaptive shape; older models (`claude-sonnet-4-6`, `claude-opus-4-8`, `claude-haiku-4-5`,
861
+ * etc.) keep the legacy shape. The completion (`callProviderCompletion`), streaming
862
+ * (`callProviderCompletionStream`), and client-tool (`executeClientToolTurn`) Anthropic
863
+ * dispatch sites consult this list (via the sibling predicate
864
+ * `isAdaptiveThinkingModel`) to pick the correct wire shape for the resolved
865
+ * model. Mirrors the prefix-matching shape of `responsesOnlyModelPrefixes`, but with
866
+ * exact-or-dash-bounded matching (an entry matches a resolved model that equals it or starts
867
+ * with it followed by `-`) rather than a plain prefix, since Anthropic model families share
868
+ * numeric leading characters (`claude-sonnet-5` vs. a hypothetical `claude-sonnet-50`).
869
+ * Empty or undefined means no model uses the adaptive shape.
870
+ */
871
+ readonly adaptiveThinkingModelPrefixes?: ReadonlyArray<string>;
783
872
  }
784
873
  /**
785
874
  * Image-generation capability for a model family within a provider. Used as
@@ -1207,7 +1296,7 @@ export type GeminiThinkingModelNames = 'gemini-3.1-pro-preview' | 'gemini-3.5-fl
1207
1296
  * Model IDs for xAI thinking-capable models.
1208
1297
  * @public
1209
1298
  */
1210
- export type XAiThinkingModelNames = 'grok-3-mini' | 'grok-4.3' | 'grok-4';
1299
+ export type XAiThinkingModelNames = 'grok-3-mini' | 'grok-4.3' | 'grok-4' | 'grok-4.5';
1211
1300
  /**
1212
1301
  * Anthropic-specific thinking configuration.
1213
1302
  * @public
@@ -1410,4 +1499,15 @@ export interface IAiAssistKeyStore {
1410
1499
  /** Get an API key by secret name */
1411
1500
  getApiKey(name: string): Result<string>;
1412
1501
  }
1502
+ /**
1503
+ * Returns the canonical `CryptoUtils.KeyStore.KeyStore` secret name for a provider's API key,
1504
+ * of the form `provider:<providerId>`. Apps that store provider API keys in a `KeyStore`
1505
+ * should use this name (rather than inventing their own) so that a single keystore vault
1506
+ * works consistently across every fgv app.
1507
+ *
1508
+ * @param providerId - The provider whose API key secret name is requested.
1509
+ * @returns The canonical keystore secret name, e.g. `'provider:openai'`.
1510
+ * @public
1511
+ */
1512
+ export declare function providerApiKeySecretName(providerId: AiProviderId): string;
1413
1513
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/packlets/ai-assist/model.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AAEH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W,iBAAiB;IAChC,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IAC3D,8FAA8F;IAC9F,QAAQ,CAAC,eAAe,CAAC,EAAE,YAAY,CAAC;IACxC,2GAA2G;IAC3G,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,4HAA4H;IAC5H,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CACtC;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAE/B,CAAC;AAMF;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,qCAAqC;IACrC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACzC,oCAAoC;IACpC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;CACzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,YAAY,GAAG,MAAM,CAEzE"}
@@ -19,12 +19,15 @@
19
19
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
20
  // SOFTWARE.
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.DEFAULT_AI_ASSIST = exports.allModelCapabilities = exports.MODEL_ALIAS_SIGIL = exports.MODEL_SPEC_BASE_KEY = exports.allModelSpecKeys = exports.AiPrompt = void 0;
22
+ exports.DEFAULT_AI_ASSIST = exports.allModelCapabilities = exports.DEFAULT_ANTHROPIC_MAX_TOKENS = exports.MODEL_ALIAS_SIGIL = exports.MODEL_SPEC_BASE_KEY = exports.allModelSpecKeys = exports.AiPrompt = void 0;
23
23
  exports.toDataUrl = toDataUrl;
24
24
  exports.resolveModel = resolveModel;
25
25
  exports.resolveModelAlias = resolveModelAlias;
26
26
  exports.resolveProviderModel = resolveProviderModel;
27
27
  exports.isResponsesOnlyModel = isResponsesOnlyModel;
28
+ exports.isAdaptiveThinkingModel = isAdaptiveThinkingModel;
29
+ exports.usesMaxCompletionTokensField = usesMaxCompletionTokensField;
30
+ exports.providerApiKeySecretName = providerApiKeySecretName;
28
31
  /**
29
32
  * Core types for AI assist: prompt class, provider descriptors, settings, and chat messages.
30
33
  * @packageDocumentation
@@ -260,6 +263,87 @@ function isResponsesOnlyModel(descriptor, modelId) {
260
263
  var _a, _b;
261
264
  return (_b = (_a = descriptor.responsesOnlyModelPrefixes) === null || _a === void 0 ? void 0 : _a.some((p) => modelId.startsWith(p))) !== null && _b !== void 0 ? _b : false;
262
265
  }
266
+ /**
267
+ * Returns true when `modelId` equals `prefix` or starts with `prefix` followed by a `-`
268
+ * (versioned/dated-snapshot ids, e.g. `'claude-sonnet-5'` matches `'claude-sonnet-5-20260115'`
269
+ * but not `'claude-sonnet-50'`). @internal
270
+ */
271
+ function isExactOrDashBoundedPrefix(modelId, prefix) {
272
+ return modelId === prefix || modelId.startsWith(`${prefix}-`);
273
+ }
274
+ /**
275
+ * Determines whether a concrete (already-resolved) Anthropic model id uses the adaptive
276
+ * thinking wire shape (`thinking: { type: 'adaptive' }` + top-level `output_config.effort`)
277
+ * rather than the legacy manual-budget shape (`thinking: { type: 'enabled', budget_tokens }`).
278
+ *
279
+ * @remarks
280
+ * Matches `modelId` against the descriptor's
281
+ * {@link IAiProviderDescriptor.adaptiveThinkingModelPrefixes} using the same
282
+ * exact-or-dash-bounded matcher semantics as the model-specific blocks in
283
+ * `mergeThinkingConfig` (an entry matches when it equals the resolved model or when the
284
+ * resolved model starts with the entry followed by a `-`) — a plain prefix match would risk a
285
+ * false positive against an unrelated model sharing the same leading characters. A provider
286
+ * that declares no list (the common case — this is Anthropic-specific) always returns `false`.
287
+ * Consulted by the completion (`callProviderCompletion`), streaming
288
+ * (`callProviderCompletionStream`), and client-tool (`executeClientToolTurn`) Anthropic
289
+ * dispatch sites so every Anthropic wire-request path picks the correct thinking shape for the
290
+ * resolved model.
291
+ *
292
+ * @param descriptor - The provider descriptor supplying the prefix list.
293
+ * @param modelId - The resolved concrete model id to test.
294
+ * @returns `true` when `modelId` exactly matches or is dash-bounded-prefixed by any declared
295
+ * adaptive-thinking prefix.
296
+ * @public
297
+ */
298
+ function isAdaptiveThinkingModel(descriptor, modelId) {
299
+ var _a, _b;
300
+ return ((_b = (_a = descriptor.adaptiveThinkingModelPrefixes) === null || _a === void 0 ? void 0 : _a.some((p) => isExactOrDashBoundedPrefix(modelId, p))) !== null && _b !== void 0 ? _b : false);
301
+ }
302
+ /**
303
+ * Determines whether a provider's OpenAI-compatible Chat Completions request
304
+ * should use the modern `max_completion_tokens` field instead of the legacy
305
+ * `max_tokens` field for capping output length.
306
+ *
307
+ * @remarks
308
+ * OpenAI's Chat Completions API deprecated `max_tokens` in favor of
309
+ * `max_completion_tokens`. Every other provider routed through the shared
310
+ * OpenAI-compatible chat-completions adapter (xAI Grok, Groq, Mistral, Ollama,
311
+ * self-hosted `openai-compat` servers) still expects the legacy `max_tokens`
312
+ * field, so this returns `true` only for the `'openai'` provider id. Consulted
313
+ * by both the completion (`callProviderCompletion`) and streaming
314
+ * (`callProviderCompletionStream`) chat-completions dispatch branches. Not
315
+ * consulted on the Responses API path — `max_output_tokens` applies uniformly
316
+ * there for both OpenAI and xAI (see `isResponsesOnlyModel`) —
317
+ * nor by any non-`'openai'`-format provider (Anthropic, Gemini).
318
+ *
319
+ * @param descriptor - The provider descriptor.
320
+ * @returns `true` only for the `'openai'` provider id.
321
+ * @public
322
+ */
323
+ function usesMaxCompletionTokensField(descriptor) {
324
+ return descriptor.id === 'openai';
325
+ }
326
+ /**
327
+ * Default `max_tokens` sent to the Anthropic Messages API when the caller does
328
+ * not supply an explicit `maxTokens` override.
329
+ *
330
+ * @remarks
331
+ * Anthropic's Messages API requires `max_tokens` on every request — there is
332
+ * no provider-side default the way there is for OpenAI Chat/Responses,
333
+ * Gemini, or xAI, all of which accept a request with no cap and apply their
334
+ * own default. Anthropic is therefore the only provider that needs — or
335
+ * gets — a library-supplied fallback; every other provider omits the field
336
+ * entirely when the caller doesn't set `maxTokens` (see
337
+ * `IProviderCompletionParams.maxTokens`).
338
+ *
339
+ * Callers whose structured/JSON output scales with input size and hits this
340
+ * ceiling see a silent truncation that often surfaces downstream as a
341
+ * confusing `extractJsonText` parse failure rather than an obvious "too
342
+ * short" error — pass `maxTokens` explicitly to raise the cap for those
343
+ * requests.
344
+ * @public
345
+ */
346
+ exports.DEFAULT_ANTHROPIC_MAX_TOKENS = 4096;
263
347
  /**
264
348
  * All valid `AiModelCapability` values — the single source of truth for
265
349
  * the capability vocabulary (used by validators and capability filters).
@@ -280,4 +364,17 @@ exports.allModelCapabilities = [
280
364
  exports.DEFAULT_AI_ASSIST = {
281
365
  providers: [{ provider: 'copy-paste' }]
282
366
  };
367
+ /**
368
+ * Returns the canonical `CryptoUtils.KeyStore.KeyStore` secret name for a provider's API key,
369
+ * of the form `provider:<providerId>`. Apps that store provider API keys in a `KeyStore`
370
+ * should use this name (rather than inventing their own) so that a single keystore vault
371
+ * works consistently across every fgv app.
372
+ *
373
+ * @param providerId - The provider whose API key secret name is requested.
374
+ * @returns The canonical keystore secret name, e.g. `'provider:openai'`.
375
+ * @public
376
+ */
377
+ function providerApiKeySecretName(providerId) {
378
+ return `provider:${providerId}`;
379
+ }
283
380
  //# sourceMappingURL=model.js.map