@theokit/sdk-tools 0.20.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +178 -209
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +111 -4
- package/dist/index.d.ts +111 -4
- package/dist/index.js +151 -183
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -119,6 +119,17 @@ declare function createCurrentTimeTool(opts?: CreateCurrentTimeToolOptions): Cus
|
|
|
119
119
|
*/
|
|
120
120
|
|
|
121
121
|
interface CreateEditFileToolOptions {
|
|
122
|
+
/**
|
|
123
|
+
* M76 — nome exposto ao modelo. Omitido ⇒ o literal de hoje (aditivo).
|
|
124
|
+
*
|
|
125
|
+
* Existe porque, no Codex, o nome NASCE na definição da tool e é a chave de decisão de approval —
|
|
126
|
+
* três consumidores (modelo, approval, telemetry) de uma string decidida num lugar só. Renomear
|
|
127
|
+
* depois da construção é mudar a identidade de algo já publicado ao modelo. `withName` continua
|
|
128
|
+
* para o caso genuinamente dinâmico.
|
|
129
|
+
*/
|
|
130
|
+
name?: string;
|
|
131
|
+
/** M76 — descrição exposta ao modelo. Omitida ⇒ o literal de hoje (aditivo). */
|
|
132
|
+
description?: string;
|
|
122
133
|
/** Absolute path to the project root. Every edit is gated against this boundary. */
|
|
123
134
|
projectRoot: string;
|
|
124
135
|
/** Optional injected filesystem (`@theokit/sdk/filesystem`) — when provided, the read + `.bak` backup +
|
|
@@ -175,6 +186,40 @@ interface CreateGitDiffToolOptions {
|
|
|
175
186
|
}
|
|
176
187
|
declare function createGitDiffTool(opts: CreateGitDiffToolOptions): CustomTool;
|
|
177
188
|
|
|
189
|
+
/**
|
|
190
|
+
* `git_status` — built-in tool for coding agents.
|
|
191
|
+
*
|
|
192
|
+
* Returns the working-tree status in porcelain v1 format (`git status --porcelain`), which is the
|
|
193
|
+
* stable machine-readable form — the human format is explicitly not guaranteed across git versions.
|
|
194
|
+
*
|
|
195
|
+
* M76 — nasce ao lado de `git_diff` e compartilha o motor de execução (`internal/git-exec.ts`): teto
|
|
196
|
+
* de stdout, kill do grupo de processos no timeout e mapeamento para erro tipado são a MESMA regra
|
|
197
|
+
* para qualquer subcomando do git. O consumidor (agent-builder) tinha isto local em 62 LoC; nada ali
|
|
198
|
+
* era específico dele.
|
|
199
|
+
*
|
|
200
|
+
* Result shape (always a JSON string):
|
|
201
|
+
* - `{ ok: true, diff: string, truncated?: boolean }` — `diff` carrega a saída porcelain
|
|
202
|
+
* - `{ ok: false, error: 'not_a_repo' | 'path_traversal' | 'timeout' | 'git_failed' }`
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
interface CreateGitStatusToolOptions {
|
|
206
|
+
/** Absolute path to the project root. Every invocation is gated against this boundary. */
|
|
207
|
+
projectRoot: string;
|
|
208
|
+
/** Wall-clock cap; the process group is killed on expiry. Default 30_000. */
|
|
209
|
+
timeoutMs?: number;
|
|
210
|
+
/** Cap on captured stdout; excess sets `truncated: true`. Default 5 MB. */
|
|
211
|
+
maxStdoutBytes?: number;
|
|
212
|
+
/**
|
|
213
|
+
* M76 — nome exposto ao modelo. Omitido ⇒ `"git_status"` (aditivo).
|
|
214
|
+
*
|
|
215
|
+
* O nome é contrato: chave de approval, o que o modelo vê e o que o telemetry registra.
|
|
216
|
+
*/
|
|
217
|
+
name?: string;
|
|
218
|
+
/** M76 — descrição exposta ao modelo. Omitida ⇒ o literal abaixo (aditivo). */
|
|
219
|
+
description?: string;
|
|
220
|
+
}
|
|
221
|
+
declare function createGitStatusTool(opts: CreateGitStatusToolOptions): CustomTool;
|
|
222
|
+
|
|
178
223
|
/**
|
|
179
224
|
* `glob_files` — built-in tool for coding agents.
|
|
180
225
|
*
|
|
@@ -528,6 +573,26 @@ declare function withShellExitGuidance(tool: CustomTool): CustomTool;
|
|
|
528
573
|
*/
|
|
529
574
|
|
|
530
575
|
interface CreateListDirToolOptions {
|
|
576
|
+
/**
|
|
577
|
+
* M76 — nome exposto ao modelo. Omitido ⇒ o literal de hoje (aditivo).
|
|
578
|
+
*
|
|
579
|
+
* Existe porque, no Codex, o nome NASCE na definição da tool e é a chave de decisão de approval —
|
|
580
|
+
* três consumidores (modelo, approval, telemetry) de uma string decidida num lugar só. Renomear
|
|
581
|
+
* depois da construção é mudar a identidade de algo já publicado ao modelo. `withName` continua
|
|
582
|
+
* para o caso genuinamente dinâmico.
|
|
583
|
+
*/
|
|
584
|
+
name?: string;
|
|
585
|
+
/** M76 — descrição exposta ao modelo. Omitida ⇒ o literal de hoje (aditivo). */
|
|
586
|
+
description?: string;
|
|
587
|
+
/**
|
|
588
|
+
* M76 — opt-in "lista-em-qualquer-lugar": honra um `path` ABSOLUTO fora de `projectRoot`
|
|
589
|
+
* (paridade com `createReadFileTool`/`createSearchTextTool`, sandbox read-only do Codex).
|
|
590
|
+
*
|
|
591
|
+
* O guard de segredo por QUALQUER segmento continua valendo, e não é separável: `isForbiddenPath`
|
|
592
|
+
* só bloqueia o item sensível quando ele é o PRIMEIRO segmento, então um `/home/u/proj/.env/sub`
|
|
593
|
+
* passaria. Ligar o flag sem o guard é abrir exfiltração. Default `false` ⇒ absoluto rejeitado.
|
|
594
|
+
*/
|
|
595
|
+
allowAbsolute?: boolean;
|
|
531
596
|
/** Absolute path to the project root. Every listing is gated against this boundary. */
|
|
532
597
|
projectRoot: string;
|
|
533
598
|
/** Maximum number of entries returned per call. Default 500. */
|
|
@@ -605,17 +670,37 @@ declare function createPlanModeTool(options: PlanModeToolOptions): PlanModeToolW
|
|
|
605
670
|
* - `{ ok: false, error: "timeout" }`
|
|
606
671
|
*/
|
|
607
672
|
interface QuestionToolOptions {
|
|
608
|
-
/**
|
|
609
|
-
|
|
673
|
+
/**
|
|
674
|
+
* Callback que apresenta a pergunta ao usuário e resolve com a resposta.
|
|
675
|
+
*
|
|
676
|
+
* M76 — passou a ser OPCIONAL: o asker preferencial vem do contexto da run
|
|
677
|
+
* (`ctx.context.askUser`), porque um valor fixado aqui é o "baked into each factory" que a doc do
|
|
678
|
+
* `CustomTool.handler` aponta como o problema que `ctx.context` existe para resolver. Este campo
|
|
679
|
+
* permanece como fallback, para quem constrói a tool com um asker fixo (retrocompatível).
|
|
680
|
+
*/
|
|
681
|
+
askUser?: (question: string) => Promise<string>;
|
|
610
682
|
/** Maximum time to wait for user response in ms. Default: 300_000 (5 min). */
|
|
611
683
|
timeoutMs?: number;
|
|
612
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* M76 — alinhado ao `CustomTool` do SDK. Era uma interface própria com `inputSchema: unknown`, o que
|
|
687
|
+
* obrigava todo consumidor a escrever um cast para registrar a tool — e cast não conserta contrato,
|
|
688
|
+
* só silencia o compilador, transformando uma futura mudança de assinatura em erro de RUNTIME.
|
|
689
|
+
*
|
|
690
|
+
* Estreitar foi aditivo: o valor sempre foi um objeto (`{ type: "object", properties, required }`
|
|
691
|
+
* logo abaixo); só o tipo declarado estava frouxo. O handler aceita o 2º argumento opcional do
|
|
692
|
+
* contrato (`ctx`), por onde o M76 passa a resolver o asker por sessão.
|
|
693
|
+
*/
|
|
613
694
|
interface QuestionTool {
|
|
614
695
|
name: string;
|
|
615
696
|
description: string;
|
|
616
|
-
inputSchema: unknown
|
|
697
|
+
inputSchema: Record<string, unknown>;
|
|
617
698
|
handler: (input: {
|
|
618
699
|
question: string;
|
|
700
|
+
}, ctx?: {
|
|
701
|
+
signal?: AbortSignal;
|
|
702
|
+
context?: unknown;
|
|
703
|
+
threadId?: string;
|
|
619
704
|
}) => Promise<string>;
|
|
620
705
|
}
|
|
621
706
|
declare function createQuestionTool(opts: QuestionToolOptions): QuestionTool;
|
|
@@ -782,6 +867,17 @@ declare function createRunVitestTool(opts: CreateRunVitestToolOptions): CustomTo
|
|
|
782
867
|
*/
|
|
783
868
|
|
|
784
869
|
interface CreateSearchTextToolOptions {
|
|
870
|
+
/**
|
|
871
|
+
* M76 — nome exposto ao modelo. Omitido ⇒ o literal de hoje (aditivo).
|
|
872
|
+
*
|
|
873
|
+
* Existe porque, no Codex, o nome NASCE na definição da tool e é a chave de decisão de approval —
|
|
874
|
+
* três consumidores (modelo, approval, telemetry) de uma string decidida num lugar só. Renomear
|
|
875
|
+
* depois da construção é mudar a identidade de algo já publicado ao modelo. `withName` continua
|
|
876
|
+
* para o caso genuinamente dinâmico.
|
|
877
|
+
*/
|
|
878
|
+
name?: string;
|
|
879
|
+
/** M76 — descrição exposta ao modelo. Omitida ⇒ o literal de hoje (aditivo). */
|
|
880
|
+
description?: string;
|
|
785
881
|
projectRoot: string;
|
|
786
882
|
/** Cap on total matches returned. Default 100. */
|
|
787
883
|
maxMatches?: number;
|
|
@@ -811,6 +907,17 @@ declare function createSearchTextTool(opts: CreateSearchTextToolOptions): Custom
|
|
|
811
907
|
*/
|
|
812
908
|
|
|
813
909
|
interface CreateShellToolOptions {
|
|
910
|
+
/**
|
|
911
|
+
* M76 — nome exposto ao modelo. Omitido ⇒ o literal de hoje (aditivo).
|
|
912
|
+
*
|
|
913
|
+
* Existe porque, no Codex, o nome NASCE na definição da tool e é a chave de decisão de approval —
|
|
914
|
+
* três consumidores (modelo, approval, telemetry) de uma string decidida num lugar só. Renomear
|
|
915
|
+
* depois da construção é mudar a identidade de algo já publicado ao modelo. `withName` continua
|
|
916
|
+
* para o caso genuinamente dinâmico.
|
|
917
|
+
*/
|
|
918
|
+
name?: string;
|
|
919
|
+
/** M76 — descrição exposta ao modelo. Omitida ⇒ o literal de hoje (aditivo). */
|
|
920
|
+
description?: string;
|
|
814
921
|
/** Absolute path to the project root. Commands execute in this cwd. */
|
|
815
922
|
projectRoot: string;
|
|
816
923
|
/** Default timeout in ms. Capped at 300s. */
|
|
@@ -1117,4 +1224,4 @@ interface CreateWriteFileToolOptions {
|
|
|
1117
1224
|
}
|
|
1118
1225
|
declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
|
|
1119
1226
|
|
|
1120
|
-
export { CatastrophicCommandError, type CommandPolicy, ContextMatchError, type ContextMatchReason, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateCurrentTimeToolOptions, type CreateEditFileToolOptions, type CreateGenericHttpSearchAdapterOptions, type CreateGitDiffToolOptions, type CreateGlobToolOptions, type CreateInteractiveShellToolOptions, type CreateListDirToolOptions, type CreateReadFileToolOptions, type CreateRunVitestToolOptions, type CreateSearchTextToolOptions, type CreateShellToolOptions, type CreateWebFetchToolOptions, type CreateWebSearchToolOptions, type CreateWriteFileToolOptions, DEFAULT_TOOL_GUIDANCE, type EnvContextOptions, type PlanModeTool, type PlanModeToolOptions, type PlanModeToolWithStore, type PlanNode, type QuestionTool, type QuestionToolOptions, ReadTracker, ReasoningTools, RedirectBlockedError, type RepoMapOptions, type ResolveAndScreenOptions, type ScreenedFetchOptions, type SessionArtifactStore, type SessionArtifactStoreOptions, SsrfBlockedError, type TodoItem, type TodolistTool, type ToolGuidanceMap, type TruncationOptions, type TruncationResult, type VitestSummary, type WebSearchCallback, type WebSearchResult, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createCurrentTimeTool, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createUpdatePlanTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
|
|
1227
|
+
export { CatastrophicCommandError, type CommandPolicy, ContextMatchError, type ContextMatchReason, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateCurrentTimeToolOptions, type CreateEditFileToolOptions, type CreateGenericHttpSearchAdapterOptions, type CreateGitDiffToolOptions, type CreateGitStatusToolOptions, type CreateGlobToolOptions, type CreateInteractiveShellToolOptions, type CreateListDirToolOptions, type CreateReadFileToolOptions, type CreateRunVitestToolOptions, type CreateSearchTextToolOptions, type CreateShellToolOptions, type CreateWebFetchToolOptions, type CreateWebSearchToolOptions, type CreateWriteFileToolOptions, DEFAULT_TOOL_GUIDANCE, type EnvContextOptions, type PlanModeTool, type PlanModeToolOptions, type PlanModeToolWithStore, type PlanNode, type QuestionTool, type QuestionToolOptions, ReadTracker, ReasoningTools, RedirectBlockedError, type RepoMapOptions, type ResolveAndScreenOptions, type ScreenedFetchOptions, type SessionArtifactStore, type SessionArtifactStoreOptions, SsrfBlockedError, type TodoItem, type TodolistTool, type ToolGuidanceMap, type TruncationOptions, type TruncationResult, type VitestSummary, type WebSearchCallback, type WebSearchResult, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createCurrentTimeTool, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGitStatusTool, createGlobTool, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createUpdatePlanTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
|
package/dist/index.d.ts
CHANGED
|
@@ -119,6 +119,17 @@ declare function createCurrentTimeTool(opts?: CreateCurrentTimeToolOptions): Cus
|
|
|
119
119
|
*/
|
|
120
120
|
|
|
121
121
|
interface CreateEditFileToolOptions {
|
|
122
|
+
/**
|
|
123
|
+
* M76 — nome exposto ao modelo. Omitido ⇒ o literal de hoje (aditivo).
|
|
124
|
+
*
|
|
125
|
+
* Existe porque, no Codex, o nome NASCE na definição da tool e é a chave de decisão de approval —
|
|
126
|
+
* três consumidores (modelo, approval, telemetry) de uma string decidida num lugar só. Renomear
|
|
127
|
+
* depois da construção é mudar a identidade de algo já publicado ao modelo. `withName` continua
|
|
128
|
+
* para o caso genuinamente dinâmico.
|
|
129
|
+
*/
|
|
130
|
+
name?: string;
|
|
131
|
+
/** M76 — descrição exposta ao modelo. Omitida ⇒ o literal de hoje (aditivo). */
|
|
132
|
+
description?: string;
|
|
122
133
|
/** Absolute path to the project root. Every edit is gated against this boundary. */
|
|
123
134
|
projectRoot: string;
|
|
124
135
|
/** Optional injected filesystem (`@theokit/sdk/filesystem`) — when provided, the read + `.bak` backup +
|
|
@@ -175,6 +186,40 @@ interface CreateGitDiffToolOptions {
|
|
|
175
186
|
}
|
|
176
187
|
declare function createGitDiffTool(opts: CreateGitDiffToolOptions): CustomTool;
|
|
177
188
|
|
|
189
|
+
/**
|
|
190
|
+
* `git_status` — built-in tool for coding agents.
|
|
191
|
+
*
|
|
192
|
+
* Returns the working-tree status in porcelain v1 format (`git status --porcelain`), which is the
|
|
193
|
+
* stable machine-readable form — the human format is explicitly not guaranteed across git versions.
|
|
194
|
+
*
|
|
195
|
+
* M76 — nasce ao lado de `git_diff` e compartilha o motor de execução (`internal/git-exec.ts`): teto
|
|
196
|
+
* de stdout, kill do grupo de processos no timeout e mapeamento para erro tipado são a MESMA regra
|
|
197
|
+
* para qualquer subcomando do git. O consumidor (agent-builder) tinha isto local em 62 LoC; nada ali
|
|
198
|
+
* era específico dele.
|
|
199
|
+
*
|
|
200
|
+
* Result shape (always a JSON string):
|
|
201
|
+
* - `{ ok: true, diff: string, truncated?: boolean }` — `diff` carrega a saída porcelain
|
|
202
|
+
* - `{ ok: false, error: 'not_a_repo' | 'path_traversal' | 'timeout' | 'git_failed' }`
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
interface CreateGitStatusToolOptions {
|
|
206
|
+
/** Absolute path to the project root. Every invocation is gated against this boundary. */
|
|
207
|
+
projectRoot: string;
|
|
208
|
+
/** Wall-clock cap; the process group is killed on expiry. Default 30_000. */
|
|
209
|
+
timeoutMs?: number;
|
|
210
|
+
/** Cap on captured stdout; excess sets `truncated: true`. Default 5 MB. */
|
|
211
|
+
maxStdoutBytes?: number;
|
|
212
|
+
/**
|
|
213
|
+
* M76 — nome exposto ao modelo. Omitido ⇒ `"git_status"` (aditivo).
|
|
214
|
+
*
|
|
215
|
+
* O nome é contrato: chave de approval, o que o modelo vê e o que o telemetry registra.
|
|
216
|
+
*/
|
|
217
|
+
name?: string;
|
|
218
|
+
/** M76 — descrição exposta ao modelo. Omitida ⇒ o literal abaixo (aditivo). */
|
|
219
|
+
description?: string;
|
|
220
|
+
}
|
|
221
|
+
declare function createGitStatusTool(opts: CreateGitStatusToolOptions): CustomTool;
|
|
222
|
+
|
|
178
223
|
/**
|
|
179
224
|
* `glob_files` — built-in tool for coding agents.
|
|
180
225
|
*
|
|
@@ -528,6 +573,26 @@ declare function withShellExitGuidance(tool: CustomTool): CustomTool;
|
|
|
528
573
|
*/
|
|
529
574
|
|
|
530
575
|
interface CreateListDirToolOptions {
|
|
576
|
+
/**
|
|
577
|
+
* M76 — nome exposto ao modelo. Omitido ⇒ o literal de hoje (aditivo).
|
|
578
|
+
*
|
|
579
|
+
* Existe porque, no Codex, o nome NASCE na definição da tool e é a chave de decisão de approval —
|
|
580
|
+
* três consumidores (modelo, approval, telemetry) de uma string decidida num lugar só. Renomear
|
|
581
|
+
* depois da construção é mudar a identidade de algo já publicado ao modelo. `withName` continua
|
|
582
|
+
* para o caso genuinamente dinâmico.
|
|
583
|
+
*/
|
|
584
|
+
name?: string;
|
|
585
|
+
/** M76 — descrição exposta ao modelo. Omitida ⇒ o literal de hoje (aditivo). */
|
|
586
|
+
description?: string;
|
|
587
|
+
/**
|
|
588
|
+
* M76 — opt-in "lista-em-qualquer-lugar": honra um `path` ABSOLUTO fora de `projectRoot`
|
|
589
|
+
* (paridade com `createReadFileTool`/`createSearchTextTool`, sandbox read-only do Codex).
|
|
590
|
+
*
|
|
591
|
+
* O guard de segredo por QUALQUER segmento continua valendo, e não é separável: `isForbiddenPath`
|
|
592
|
+
* só bloqueia o item sensível quando ele é o PRIMEIRO segmento, então um `/home/u/proj/.env/sub`
|
|
593
|
+
* passaria. Ligar o flag sem o guard é abrir exfiltração. Default `false` ⇒ absoluto rejeitado.
|
|
594
|
+
*/
|
|
595
|
+
allowAbsolute?: boolean;
|
|
531
596
|
/** Absolute path to the project root. Every listing is gated against this boundary. */
|
|
532
597
|
projectRoot: string;
|
|
533
598
|
/** Maximum number of entries returned per call. Default 500. */
|
|
@@ -605,17 +670,37 @@ declare function createPlanModeTool(options: PlanModeToolOptions): PlanModeToolW
|
|
|
605
670
|
* - `{ ok: false, error: "timeout" }`
|
|
606
671
|
*/
|
|
607
672
|
interface QuestionToolOptions {
|
|
608
|
-
/**
|
|
609
|
-
|
|
673
|
+
/**
|
|
674
|
+
* Callback que apresenta a pergunta ao usuário e resolve com a resposta.
|
|
675
|
+
*
|
|
676
|
+
* M76 — passou a ser OPCIONAL: o asker preferencial vem do contexto da run
|
|
677
|
+
* (`ctx.context.askUser`), porque um valor fixado aqui é o "baked into each factory" que a doc do
|
|
678
|
+
* `CustomTool.handler` aponta como o problema que `ctx.context` existe para resolver. Este campo
|
|
679
|
+
* permanece como fallback, para quem constrói a tool com um asker fixo (retrocompatível).
|
|
680
|
+
*/
|
|
681
|
+
askUser?: (question: string) => Promise<string>;
|
|
610
682
|
/** Maximum time to wait for user response in ms. Default: 300_000 (5 min). */
|
|
611
683
|
timeoutMs?: number;
|
|
612
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* M76 — alinhado ao `CustomTool` do SDK. Era uma interface própria com `inputSchema: unknown`, o que
|
|
687
|
+
* obrigava todo consumidor a escrever um cast para registrar a tool — e cast não conserta contrato,
|
|
688
|
+
* só silencia o compilador, transformando uma futura mudança de assinatura em erro de RUNTIME.
|
|
689
|
+
*
|
|
690
|
+
* Estreitar foi aditivo: o valor sempre foi um objeto (`{ type: "object", properties, required }`
|
|
691
|
+
* logo abaixo); só o tipo declarado estava frouxo. O handler aceita o 2º argumento opcional do
|
|
692
|
+
* contrato (`ctx`), por onde o M76 passa a resolver o asker por sessão.
|
|
693
|
+
*/
|
|
613
694
|
interface QuestionTool {
|
|
614
695
|
name: string;
|
|
615
696
|
description: string;
|
|
616
|
-
inputSchema: unknown
|
|
697
|
+
inputSchema: Record<string, unknown>;
|
|
617
698
|
handler: (input: {
|
|
618
699
|
question: string;
|
|
700
|
+
}, ctx?: {
|
|
701
|
+
signal?: AbortSignal;
|
|
702
|
+
context?: unknown;
|
|
703
|
+
threadId?: string;
|
|
619
704
|
}) => Promise<string>;
|
|
620
705
|
}
|
|
621
706
|
declare function createQuestionTool(opts: QuestionToolOptions): QuestionTool;
|
|
@@ -782,6 +867,17 @@ declare function createRunVitestTool(opts: CreateRunVitestToolOptions): CustomTo
|
|
|
782
867
|
*/
|
|
783
868
|
|
|
784
869
|
interface CreateSearchTextToolOptions {
|
|
870
|
+
/**
|
|
871
|
+
* M76 — nome exposto ao modelo. Omitido ⇒ o literal de hoje (aditivo).
|
|
872
|
+
*
|
|
873
|
+
* Existe porque, no Codex, o nome NASCE na definição da tool e é a chave de decisão de approval —
|
|
874
|
+
* três consumidores (modelo, approval, telemetry) de uma string decidida num lugar só. Renomear
|
|
875
|
+
* depois da construção é mudar a identidade de algo já publicado ao modelo. `withName` continua
|
|
876
|
+
* para o caso genuinamente dinâmico.
|
|
877
|
+
*/
|
|
878
|
+
name?: string;
|
|
879
|
+
/** M76 — descrição exposta ao modelo. Omitida ⇒ o literal de hoje (aditivo). */
|
|
880
|
+
description?: string;
|
|
785
881
|
projectRoot: string;
|
|
786
882
|
/** Cap on total matches returned. Default 100. */
|
|
787
883
|
maxMatches?: number;
|
|
@@ -811,6 +907,17 @@ declare function createSearchTextTool(opts: CreateSearchTextToolOptions): Custom
|
|
|
811
907
|
*/
|
|
812
908
|
|
|
813
909
|
interface CreateShellToolOptions {
|
|
910
|
+
/**
|
|
911
|
+
* M76 — nome exposto ao modelo. Omitido ⇒ o literal de hoje (aditivo).
|
|
912
|
+
*
|
|
913
|
+
* Existe porque, no Codex, o nome NASCE na definição da tool e é a chave de decisão de approval —
|
|
914
|
+
* três consumidores (modelo, approval, telemetry) de uma string decidida num lugar só. Renomear
|
|
915
|
+
* depois da construção é mudar a identidade de algo já publicado ao modelo. `withName` continua
|
|
916
|
+
* para o caso genuinamente dinâmico.
|
|
917
|
+
*/
|
|
918
|
+
name?: string;
|
|
919
|
+
/** M76 — descrição exposta ao modelo. Omitida ⇒ o literal de hoje (aditivo). */
|
|
920
|
+
description?: string;
|
|
814
921
|
/** Absolute path to the project root. Commands execute in this cwd. */
|
|
815
922
|
projectRoot: string;
|
|
816
923
|
/** Default timeout in ms. Capped at 300s. */
|
|
@@ -1117,4 +1224,4 @@ interface CreateWriteFileToolOptions {
|
|
|
1117
1224
|
}
|
|
1118
1225
|
declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
|
|
1119
1226
|
|
|
1120
|
-
export { CatastrophicCommandError, type CommandPolicy, ContextMatchError, type ContextMatchReason, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateCurrentTimeToolOptions, type CreateEditFileToolOptions, type CreateGenericHttpSearchAdapterOptions, type CreateGitDiffToolOptions, type CreateGlobToolOptions, type CreateInteractiveShellToolOptions, type CreateListDirToolOptions, type CreateReadFileToolOptions, type CreateRunVitestToolOptions, type CreateSearchTextToolOptions, type CreateShellToolOptions, type CreateWebFetchToolOptions, type CreateWebSearchToolOptions, type CreateWriteFileToolOptions, DEFAULT_TOOL_GUIDANCE, type EnvContextOptions, type PlanModeTool, type PlanModeToolOptions, type PlanModeToolWithStore, type PlanNode, type QuestionTool, type QuestionToolOptions, ReadTracker, ReasoningTools, RedirectBlockedError, type RepoMapOptions, type ResolveAndScreenOptions, type ScreenedFetchOptions, type SessionArtifactStore, type SessionArtifactStoreOptions, SsrfBlockedError, type TodoItem, type TodolistTool, type ToolGuidanceMap, type TruncationOptions, type TruncationResult, type VitestSummary, type WebSearchCallback, type WebSearchResult, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createCurrentTimeTool, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createUpdatePlanTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
|
|
1227
|
+
export { CatastrophicCommandError, type CommandPolicy, ContextMatchError, type ContextMatchReason, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, type CreateCurrentTimeToolOptions, type CreateEditFileToolOptions, type CreateGenericHttpSearchAdapterOptions, type CreateGitDiffToolOptions, type CreateGitStatusToolOptions, type CreateGlobToolOptions, type CreateInteractiveShellToolOptions, type CreateListDirToolOptions, type CreateReadFileToolOptions, type CreateRunVitestToolOptions, type CreateSearchTextToolOptions, type CreateShellToolOptions, type CreateWebFetchToolOptions, type CreateWebSearchToolOptions, type CreateWriteFileToolOptions, DEFAULT_TOOL_GUIDANCE, type EnvContextOptions, type PlanModeTool, type PlanModeToolOptions, type PlanModeToolWithStore, type PlanNode, type QuestionTool, type QuestionToolOptions, ReadTracker, ReasoningTools, RedirectBlockedError, type RepoMapOptions, type ResolveAndScreenOptions, type ScreenedFetchOptions, type SessionArtifactStore, type SessionArtifactStoreOptions, SsrfBlockedError, type TodoItem, type TodolistTool, type ToolGuidanceMap, type TruncationOptions, type TruncationResult, type VitestSummary, type WebSearchCallback, type WebSearchResult, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createCurrentTimeTool, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGitStatusTool, createGlobTool, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createUpdatePlanTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
|