@niscorp/signal 0.1.4 → 0.1.6

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.d.cts CHANGED
@@ -516,6 +516,8 @@ declare const modelRegistry: Record<string, ModelEntry>;
516
516
  declare const UNMEASURED_MODEL: ModelCapabilities;
517
517
  declare const modelKey: (provider: string, model: string) => string;
518
518
  declare const modelEntry: (provider: string, model: string) => ModelEntry | undefined;
519
+ type ModelDefaults = Pick<SignalOptions, 'temperature' | 'topP' | 'maxTokens'>;
520
+ declare const modelDefaults: Record<string, ModelDefaults>;
519
521
  declare const chatProviderEntry: (id: string) => ChatProviderEntry | undefined;
520
522
 
521
523
  type ErrorWireStrategy = {
@@ -588,4 +590,4 @@ type ResolvedTransport = {
588
590
  declare const RESPOND_TOOL_NAME = "respond";
589
591
  declare const resolveTransport: (spec: TransportSpec, caps: Capabilities) => ResolvedTransport;
590
592
 
591
- export { type AssistantToolCall, type CalibratedDecision, type Capabilities, type ChatProviderEntry, type ChoiceQuestion, type ContentPart, type CountInput, type CustomChatProviderConfig, type CustomDecisionProviderConfig, type CustomProviderConfig, type DecideMeta, type DecideRequest, type DecideResult, type DecideState, type DecisionProviderEntry, type EmbedOptions, type EmbedRequest, type EmbedResponse, type EndpointCapabilities, ErrorCode, type ErrorWireStrategy, type ExtractResult, type ImageSource, type Message, type ModelCapabilities, type ModelEntry, type NoulQuestion, type OutputTransport, type ProviderEntry, type ProviderError, type Question, type Questions, REASONING_EFFORTS, RESPOND_TOOL_NAME, type ReasoningEffort, type Rejection, type ResolvedTransport, type ResponseFormat, type ResponseWireStrategy, type ScoreQuestion, type Signal, type SignalConfig, type SignalDescription, SignalError, type SignalMeta, type SignalOptions, type SignalResult, type StepInputMessage, type StepOutcome, type StepRequest, type StepResult, type StepStreamEvent, type StepToolCall, type StepToolDescriptor, type StreamEvent, type StreamOptions, type Tool, type ToolCallRecord, type ToolConfig, type TransportSpec, UNMEASURED_MODEL, type UncalibratedDecision, type WireReport, type WireStrategy, chatProviderEntry, closeTruncated, createSignal, decodeJsonish, deepDecodeJsonish, defineTool, extractJson, isTruncatedJson, modelEntry, modelKey, modelRegistry, providerRegistry, repairEscapeDamage, resolveTransport, routeRejection, routeResponse };
593
+ export { type AssistantToolCall, type CalibratedDecision, type Capabilities, type ChatProviderEntry, type ChoiceQuestion, type ContentPart, type CountInput, type CustomChatProviderConfig, type CustomDecisionProviderConfig, type CustomProviderConfig, type DecideMeta, type DecideRequest, type DecideResult, type DecideState, type DecisionProviderEntry, type EmbedOptions, type EmbedRequest, type EmbedResponse, type EndpointCapabilities, ErrorCode, type ErrorWireStrategy, type ExtractResult, type ImageSource, type Message, type ModelCapabilities, type ModelDefaults, type ModelEntry, type NoulQuestion, type OutputTransport, type ProviderEntry, type ProviderError, type Question, type Questions, REASONING_EFFORTS, RESPOND_TOOL_NAME, type ReasoningEffort, type Rejection, type ResolvedTransport, type ResponseFormat, type ResponseWireStrategy, type ScoreQuestion, type Signal, type SignalConfig, type SignalDescription, SignalError, type SignalMeta, type SignalOptions, type SignalResult, type StepInputMessage, type StepOutcome, type StepRequest, type StepResult, type StepStreamEvent, type StepToolCall, type StepToolDescriptor, type StreamEvent, type StreamOptions, type Tool, type ToolCallRecord, type ToolConfig, type TransportSpec, UNMEASURED_MODEL, type UncalibratedDecision, type WireReport, type WireStrategy, chatProviderEntry, closeTruncated, createSignal, decodeJsonish, deepDecodeJsonish, defineTool, extractJson, isTruncatedJson, modelDefaults, modelEntry, modelKey, modelRegistry, providerRegistry, repairEscapeDamage, resolveTransport, routeRejection, routeResponse };
package/dist/index.d.ts CHANGED
@@ -516,6 +516,8 @@ declare const modelRegistry: Record<string, ModelEntry>;
516
516
  declare const UNMEASURED_MODEL: ModelCapabilities;
517
517
  declare const modelKey: (provider: string, model: string) => string;
518
518
  declare const modelEntry: (provider: string, model: string) => ModelEntry | undefined;
519
+ type ModelDefaults = Pick<SignalOptions, 'temperature' | 'topP' | 'maxTokens'>;
520
+ declare const modelDefaults: Record<string, ModelDefaults>;
519
521
  declare const chatProviderEntry: (id: string) => ChatProviderEntry | undefined;
520
522
 
521
523
  type ErrorWireStrategy = {
@@ -588,4 +590,4 @@ type ResolvedTransport = {
588
590
  declare const RESPOND_TOOL_NAME = "respond";
589
591
  declare const resolveTransport: (spec: TransportSpec, caps: Capabilities) => ResolvedTransport;
590
592
 
591
- export { type AssistantToolCall, type CalibratedDecision, type Capabilities, type ChatProviderEntry, type ChoiceQuestion, type ContentPart, type CountInput, type CustomChatProviderConfig, type CustomDecisionProviderConfig, type CustomProviderConfig, type DecideMeta, type DecideRequest, type DecideResult, type DecideState, type DecisionProviderEntry, type EmbedOptions, type EmbedRequest, type EmbedResponse, type EndpointCapabilities, ErrorCode, type ErrorWireStrategy, type ExtractResult, type ImageSource, type Message, type ModelCapabilities, type ModelEntry, type NoulQuestion, type OutputTransport, type ProviderEntry, type ProviderError, type Question, type Questions, REASONING_EFFORTS, RESPOND_TOOL_NAME, type ReasoningEffort, type Rejection, type ResolvedTransport, type ResponseFormat, type ResponseWireStrategy, type ScoreQuestion, type Signal, type SignalConfig, type SignalDescription, SignalError, type SignalMeta, type SignalOptions, type SignalResult, type StepInputMessage, type StepOutcome, type StepRequest, type StepResult, type StepStreamEvent, type StepToolCall, type StepToolDescriptor, type StreamEvent, type StreamOptions, type Tool, type ToolCallRecord, type ToolConfig, type TransportSpec, UNMEASURED_MODEL, type UncalibratedDecision, type WireReport, type WireStrategy, chatProviderEntry, closeTruncated, createSignal, decodeJsonish, deepDecodeJsonish, defineTool, extractJson, isTruncatedJson, modelEntry, modelKey, modelRegistry, providerRegistry, repairEscapeDamage, resolveTransport, routeRejection, routeResponse };
593
+ export { type AssistantToolCall, type CalibratedDecision, type Capabilities, type ChatProviderEntry, type ChoiceQuestion, type ContentPart, type CountInput, type CustomChatProviderConfig, type CustomDecisionProviderConfig, type CustomProviderConfig, type DecideMeta, type DecideRequest, type DecideResult, type DecideState, type DecisionProviderEntry, type EmbedOptions, type EmbedRequest, type EmbedResponse, type EndpointCapabilities, ErrorCode, type ErrorWireStrategy, type ExtractResult, type ImageSource, type Message, type ModelCapabilities, type ModelDefaults, type ModelEntry, type NoulQuestion, type OutputTransport, type ProviderEntry, type ProviderError, type Question, type Questions, REASONING_EFFORTS, RESPOND_TOOL_NAME, type ReasoningEffort, type Rejection, type ResolvedTransport, type ResponseFormat, type ResponseWireStrategy, type ScoreQuestion, type Signal, type SignalConfig, type SignalDescription, SignalError, type SignalMeta, type SignalOptions, type SignalResult, type StepInputMessage, type StepOutcome, type StepRequest, type StepResult, type StepStreamEvent, type StepToolCall, type StepToolDescriptor, type StreamEvent, type StreamOptions, type Tool, type ToolCallRecord, type ToolConfig, type TransportSpec, UNMEASURED_MODEL, type UncalibratedDecision, type WireReport, type WireStrategy, chatProviderEntry, closeTruncated, createSignal, decodeJsonish, deepDecodeJsonish, defineTool, extractJson, isTruncatedJson, modelDefaults, modelEntry, modelKey, modelRegistry, providerRegistry, repairEscapeDamage, resolveTransport, routeRejection, routeResponse };
package/dist/index.js CHANGED
@@ -199,6 +199,11 @@ var UNMEASURED_MODEL = {
199
199
  };
200
200
  var modelKey = (provider, model) => `${provider}/${model}`;
201
201
  var modelEntry = (provider, model) => modelRegistry[modelKey(provider, model)];
202
+ var GPT_OSS_ON_GROQ = { temperature: 1, topP: 1, maxTokens: 16384 };
203
+ var modelDefaults = {
204
+ "groq/openai/gpt-oss-120b": GPT_OSS_ON_GROQ,
205
+ "groq/openai/gpt-oss-20b": GPT_OSS_ON_GROQ
206
+ };
202
207
  var resolveApiKey = (envKey, explicitKey) => explicitKey ?? (typeof process !== "undefined" ? process.env?.[envKey] : void 0);
203
208
  var chatProviderEntry = (id) => {
204
209
  const entry = providerRegistry[id];
@@ -1169,6 +1174,11 @@ function* ladder(text, strategies) {
1169
1174
  if (trimmed.length === 0) return;
1170
1175
  const direct = tryParse2(trimmed);
1171
1176
  if (direct.ok) yield { value: direct.value, rung: "parse" };
1177
+ const closed = closeTruncated(trimmed);
1178
+ if (closed !== void 0) {
1179
+ const parsed = tryParse2(closed);
1180
+ if (parsed.ok) yield { value: parsed.value, rung: "close-truncated" };
1181
+ }
1172
1182
  const extracted = extractJson(trimmed);
1173
1183
  if (extracted.ok) yield { value: extracted.value, rung: "extract" };
1174
1184
  for (const repaired of repairEscapeDamage(trimmed)) {
@@ -1181,11 +1191,6 @@ function* ladder(text, strategies) {
1181
1191
  if (parsed.ok) yield { value: parsed.value, rung: strategy.id };
1182
1192
  }
1183
1193
  }
1184
- const closed = closeTruncated(trimmed);
1185
- if (closed !== void 0) {
1186
- const parsed = tryParse2(closed);
1187
- if (parsed.ok) yield { value: parsed.value, rung: "close-truncated" };
1188
- }
1189
1194
  }
1190
1195
  var firstAccepted = (candidates, accept) => {
1191
1196
  let nearMiss;
@@ -1309,6 +1314,10 @@ var modelRowOf = (config) => {
1309
1314
  const model = config.model ?? entry.defaultModel;
1310
1315
  return { provider: config.provider, model, row: modelEntry(config.provider, model) };
1311
1316
  };
1317
+ var defaultsOf = (config) => {
1318
+ const resolved = modelRowOf(config);
1319
+ return resolved === void 0 ? void 0 : modelDefaults[modelKey(resolved.provider, resolved.model)];
1320
+ };
1312
1321
  var resolveCapabilities = (config) => {
1313
1322
  if (typeof config.provider === "string") {
1314
1323
  const entry = providerRegistry[config.provider];
@@ -1374,6 +1383,7 @@ var createSignalFromConfig = (config) => {
1374
1383
  let cachedAdapterKey;
1375
1384
  const wireStrategies = resolveWireStrategies(wireIdsOf(config));
1376
1385
  assertEffort(config, config.options?.reasoningEffort);
1386
+ const defaults = defaultsOf(config);
1377
1387
  const getAdapter = async () => {
1378
1388
  const resolved = resolveProvider(config);
1379
1389
  const key = `${resolved.adapterType}:${resolved.baseUrl}:${resolved.apiKey}`;
@@ -1410,8 +1420,8 @@ var createSignalFromConfig = (config) => {
1410
1420
  ...providerTools && { tools: providerTools },
1411
1421
  ...request.toolChoice !== void 0 && { toolChoice: request.toolChoice },
1412
1422
  ...request.responseFormat !== void 0 && { responseFormat: request.responseFormat },
1413
- ...(config.options !== void 0 || request.options !== void 0) && {
1414
- options: { ...config.options, ...request.options }
1423
+ ...(defaults !== void 0 || config.options !== void 0 || request.options !== void 0) && {
1424
+ options: { ...defaults, ...config.options, ...request.options }
1415
1425
  }
1416
1426
  };
1417
1427
  assertEffort(config, providerRequest.options?.reasoningEffort);
@@ -1465,7 +1475,7 @@ var createSignalFromConfig = (config) => {
1465
1475
  const adapter = await getChatAdapter(verb);
1466
1476
  const resolved = resolveProvider(config);
1467
1477
  const declared = new Set((request.tools ?? []).map((tool) => tool.name));
1468
- const merged = config.options !== void 0 || request.options !== void 0 ? { ...request, options: { ...config.options, ...request.options } } : request;
1478
+ const merged = defaults !== void 0 || config.options !== void 0 || request.options !== void 0 ? { ...request, options: { ...defaults, ...config.options, ...request.options } } : request;
1469
1479
  assertEffort(config, merged.options?.reasoningEffort);
1470
1480
  try {
1471
1481
  for await (const event of executeStepStream({
@@ -1773,6 +1783,6 @@ var resolveTransport = (spec, caps) => {
1773
1783
  // src/types.ts
1774
1784
  var REASONING_EFFORTS = ["none", "default", "minimal", "low", "medium", "high", "xhigh", "max"];
1775
1785
 
1776
- export { ErrorCode, REASONING_EFFORTS, RESPOND_TOOL_NAME, SignalError, UNMEASURED_MODEL, chatProviderEntry, closeTruncated, createSignal, decodeJsonish, deepDecodeJsonish, defineTool, extractJson, isTruncatedJson, modelEntry, modelKey, modelRegistry, providerRegistry, repairEscapeDamage, resolveTransport, routeRejection, routeResponse };
1786
+ export { ErrorCode, REASONING_EFFORTS, RESPOND_TOOL_NAME, SignalError, UNMEASURED_MODEL, chatProviderEntry, closeTruncated, createSignal, decodeJsonish, deepDecodeJsonish, defineTool, extractJson, isTruncatedJson, modelDefaults, modelEntry, modelKey, modelRegistry, providerRegistry, repairEscapeDamage, resolveTransport, routeRejection, routeResponse };
1777
1787
  //# sourceMappingURL=index.js.map
1778
1788
  //# sourceMappingURL=index.js.map