@theokit/sdk-tools 0.22.0 → 0.22.1

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
@@ -695,9 +695,13 @@ interface QuestionTool {
695
695
  name: string;
696
696
  description: string;
697
697
  inputSchema: Record<string, unknown>;
698
- handler: (input: {
699
- question: string;
700
- }, ctx?: {
698
+ /**
699
+ * M76 — o input é `Record<string, unknown>`, não `{ question: string }`, por CONTRAVARIÂNCIA: um
700
+ * handler que aceita só o tipo estreito não é atribuível a um que aceita o largo, e o `CustomTool`
701
+ * do SDK declara o largo. Declarar estreito aqui obrigava o consumidor a um cast — que era
702
+ * exatamente o defeito. O estreitamento acontece DENTRO do handler, onde há validação.
703
+ */
704
+ handler: (input: Record<string, unknown>, ctx?: {
701
705
  signal?: AbortSignal;
702
706
  context?: unknown;
703
707
  threadId?: string;
package/dist/index.d.ts CHANGED
@@ -695,9 +695,13 @@ interface QuestionTool {
695
695
  name: string;
696
696
  description: string;
697
697
  inputSchema: Record<string, unknown>;
698
- handler: (input: {
699
- question: string;
700
- }, ctx?: {
698
+ /**
699
+ * M76 — o input é `Record<string, unknown>`, não `{ question: string }`, por CONTRAVARIÂNCIA: um
700
+ * handler que aceita só o tipo estreito não é atribuível a um que aceita o largo, e o `CustomTool`
701
+ * do SDK declara o largo. Declarar estreito aqui obrigava o consumidor a um cast — que era
702
+ * exatamente o defeito. O estreitamento acontece DENTRO do handler, onde há validação.
703
+ */
704
+ handler: (input: Record<string, unknown>, ctx?: {
701
705
  signal?: AbortSignal;
702
706
  context?: unknown;
703
707
  threadId?: string;
package/dist/index.js CHANGED
@@ -1759,7 +1759,7 @@ function createQuestionTool(opts) {
1759
1759
  setTimeout(() => reject(new Error("timeout")), timeoutMs);
1760
1760
  });
1761
1761
  try {
1762
- const answer = await Promise.race([askUser(input.question), timeout]);
1762
+ const answer = await Promise.race([askUser(String(input.question ?? "")), timeout]);
1763
1763
  return JSON.stringify({ ok: true, answer });
1764
1764
  } catch (err) {
1765
1765
  if (err instanceof Error && err.message === "timeout") {