@theokit/sdk-tools 0.15.1 → 0.16.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/CHANGELOG.md +10 -0
- package/dist/index.cjs +41 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +41 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -75,6 +75,27 @@ interface SessionArtifactStore {
|
|
|
75
75
|
*/
|
|
76
76
|
declare function createSessionArtifactStore(options: SessionArtifactStoreOptions): SessionArtifactStore;
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* `current_time` — built-in tool for coding agents.
|
|
80
|
+
*
|
|
81
|
+
* Returns the current date-time. Codex-faithful at the core (its `clock`/`curr_time` tool returns UTC
|
|
82
|
+
* as `YYYY-MM-DD HH:MM:SS UTC`); this built-in keeps that default and adds an optional IANA `timezone`
|
|
83
|
+
* (additive superset — omitted ⇒ UTC, exactly Codex's behavior) plus an unambiguous `iso` instant.
|
|
84
|
+
*
|
|
85
|
+
* The clock is injectable so the tool is deterministic under test (testing.md §6: never read the real
|
|
86
|
+
* wall clock in a unit test).
|
|
87
|
+
*
|
|
88
|
+
* Result shape (always a JSON string):
|
|
89
|
+
* - `{ ok: true, current_time: "YYYY-MM-DD HH:MM:SS <tz>", iso: string, timezone: string }`
|
|
90
|
+
* - `{ ok: false, error: "invalid_timezone", timezone }`
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
interface CreateCurrentTimeToolOptions {
|
|
94
|
+
/** Injectable clock — defaults to `() => new Date()`. Pass a fixed clock for deterministic tests. */
|
|
95
|
+
clock?: () => Date;
|
|
96
|
+
}
|
|
97
|
+
declare function createCurrentTimeTool(opts?: CreateCurrentTimeToolOptions): CustomTool;
|
|
98
|
+
|
|
78
99
|
/**
|
|
79
100
|
* `edit_file` — built-in tool for coding agents.
|
|
80
101
|
*
|
|
@@ -1052,4 +1073,4 @@ interface CreateWriteFileToolOptions {
|
|
|
1052
1073
|
}
|
|
1053
1074
|
declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
|
|
1054
1075
|
|
|
1055
|
-
export { CatastrophicCommandError, type CommandPolicy, ContextMatchError, type ContextMatchReason, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, 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, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
|
|
1076
|
+
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, 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
|
@@ -75,6 +75,27 @@ interface SessionArtifactStore {
|
|
|
75
75
|
*/
|
|
76
76
|
declare function createSessionArtifactStore(options: SessionArtifactStoreOptions): SessionArtifactStore;
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* `current_time` — built-in tool for coding agents.
|
|
80
|
+
*
|
|
81
|
+
* Returns the current date-time. Codex-faithful at the core (its `clock`/`curr_time` tool returns UTC
|
|
82
|
+
* as `YYYY-MM-DD HH:MM:SS UTC`); this built-in keeps that default and adds an optional IANA `timezone`
|
|
83
|
+
* (additive superset — omitted ⇒ UTC, exactly Codex's behavior) plus an unambiguous `iso` instant.
|
|
84
|
+
*
|
|
85
|
+
* The clock is injectable so the tool is deterministic under test (testing.md §6: never read the real
|
|
86
|
+
* wall clock in a unit test).
|
|
87
|
+
*
|
|
88
|
+
* Result shape (always a JSON string):
|
|
89
|
+
* - `{ ok: true, current_time: "YYYY-MM-DD HH:MM:SS <tz>", iso: string, timezone: string }`
|
|
90
|
+
* - `{ ok: false, error: "invalid_timezone", timezone }`
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
interface CreateCurrentTimeToolOptions {
|
|
94
|
+
/** Injectable clock — defaults to `() => new Date()`. Pass a fixed clock for deterministic tests. */
|
|
95
|
+
clock?: () => Date;
|
|
96
|
+
}
|
|
97
|
+
declare function createCurrentTimeTool(opts?: CreateCurrentTimeToolOptions): CustomTool;
|
|
98
|
+
|
|
78
99
|
/**
|
|
79
100
|
* `edit_file` — built-in tool for coding agents.
|
|
80
101
|
*
|
|
@@ -1052,4 +1073,4 @@ interface CreateWriteFileToolOptions {
|
|
|
1052
1073
|
}
|
|
1053
1074
|
declare function createWriteFileTool(opts: CreateWriteFileToolOptions): CustomTool;
|
|
1054
1075
|
|
|
1055
|
-
export { CatastrophicCommandError, type CommandPolicy, ContextMatchError, type ContextMatchReason, type CreateApplyPatchToolOptions, type CreateBraveWebSearchAdapterOptions, 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, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
|
|
1076
|
+
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, 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.js
CHANGED
|
@@ -265,6 +265,46 @@ function createSessionArtifactStore(options) {
|
|
|
265
265
|
}
|
|
266
266
|
return { write, read, has, list, path };
|
|
267
267
|
}
|
|
268
|
+
function formatInTimezone(now, tz) {
|
|
269
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
270
|
+
timeZone: tz,
|
|
271
|
+
year: "numeric",
|
|
272
|
+
month: "2-digit",
|
|
273
|
+
day: "2-digit",
|
|
274
|
+
hour: "2-digit",
|
|
275
|
+
minute: "2-digit",
|
|
276
|
+
second: "2-digit",
|
|
277
|
+
hour12: false
|
|
278
|
+
}).formatToParts(now);
|
|
279
|
+
const p = {};
|
|
280
|
+
for (const { type, value } of parts) p[type] = value;
|
|
281
|
+
const hour = p.hour === "24" ? "00" : p.hour;
|
|
282
|
+
return `${p.year}-${p.month}-${p.day} ${hour}:${p.minute}:${p.second} ${tz}`;
|
|
283
|
+
}
|
|
284
|
+
function createCurrentTimeTool(opts = {}) {
|
|
285
|
+
const clock = opts.clock ?? (() => /* @__PURE__ */ new Date());
|
|
286
|
+
return Tool.create({
|
|
287
|
+
name: "current_time",
|
|
288
|
+
description: "Get the current date and time. Returns { current_time, iso, timezone } as a JSON string, where current_time is 'YYYY-MM-DD HH:MM:SS <timezone>' and iso is the ISO-8601 instant. Pass an optional IANA timezone (e.g. 'America/Sao_Paulo', 'Europe/Lisbon'); defaults to UTC. Never state the date or time from memory \u2014 always call this. Returns { ok: false, error: 'invalid_timezone' } for an unknown timezone.",
|
|
289
|
+
inputSchema: z.object({
|
|
290
|
+
timezone: z.string().optional().describe("IANA timezone, e.g. 'America/Sao_Paulo' or 'Europe/Lisbon'. Defaults to UTC.")
|
|
291
|
+
}),
|
|
292
|
+
handler: ({ timezone }) => {
|
|
293
|
+
const tz = timezone ?? "UTC";
|
|
294
|
+
const now = clock();
|
|
295
|
+
try {
|
|
296
|
+
return JSON.stringify({
|
|
297
|
+
ok: true,
|
|
298
|
+
current_time: formatInTimezone(now, tz),
|
|
299
|
+
iso: now.toISOString(),
|
|
300
|
+
timezone: tz
|
|
301
|
+
});
|
|
302
|
+
} catch {
|
|
303
|
+
return JSON.stringify({ ok: false, error: "invalid_timezone", timezone: tz });
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
268
308
|
|
|
269
309
|
// src/internal/context-match.ts
|
|
270
310
|
var ContextMatchError = class extends Error {
|
|
@@ -2557,6 +2597,6 @@ async function isBinaryFile(absolutePath) {
|
|
|
2557
2597
|
}
|
|
2558
2598
|
}
|
|
2559
2599
|
|
|
2560
|
-
export { CatastrophicCommandError, ContextMatchError, DEFAULT_TOOL_GUIDANCE, ReadTracker, ReasoningTools, RedirectBlockedError, SsrfBlockedError, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
|
|
2600
|
+
export { CatastrophicCommandError, ContextMatchError, DEFAULT_TOOL_GUIDANCE, ReadTracker, ReasoningTools, RedirectBlockedError, SsrfBlockedError, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createCurrentTimeTool, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGlobTool, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance };
|
|
2561
2601
|
//# sourceMappingURL=index.js.map
|
|
2562
2602
|
//# sourceMappingURL=index.js.map
|