| @@ -1,7 +1,7 @@ |
| 1 | import type { ScopeId, ToolId, SecretId } from "@executor/sdk"; | 1 | import type { ScopeId, ToolId, SecretId } from "@executor/sdk"; |
| 2 | import { ScopeId as ScopeIdSchema } from "@executor/sdk"; | 2 | import { ScopeId as ScopeIdSchema } from "@executor/sdk"; |
| 3 | | 3 | |
| 4 | import { getExecutorClient } from "./client"; | 4 | import { ExecutorApiClient } from "./client"; |
| 5 | | 5 | |
| 6 | // --------------------------------------------------------------------------- | 6 | // --------------------------------------------------------------------------- |
| 7 | // Query atoms — typed, cached, reactive | 7 | // Query atoms — typed, cached, reactive |
| @@ -10,25 +10,25 @@ import { getExecutorClient } from "./client"; · 2 unmodified lines |
| 10 | const DEFAULT_SCOPE = ScopeIdSchema.make("default"); | 10 | const DEFAULT_SCOPE = ScopeIdSchema.make("default"); |
| 11 | | 11 | |
| 12 | export const toolsAtom = (scopeId: ScopeId = DEFAULT_SCOPE) => | 12 | export const toolsAtom = (scopeId: ScopeId = DEFAULT_SCOPE) => |
| 13 | getExecutorClient().query("tools", "list", { | 13 | ExecutorApiClient.query("tools", "list", { |
| 14 | path: { scopeId }, | 14 | path: { scopeId }, |
| 15 | timeToLive: "30 seconds", | 15 | timeToLive: "30 seconds", |
| 16 | }); | 16 | }); |
| 17 | | 17 | |
| 18 | export const toolSchemaAtom = (scopeId: ScopeId, toolId: ToolId) => | 18 | export const toolSchemaAtom = (scopeId: ScopeId, toolId: ToolId) => |
| 19 | getExecutorClient().query("tools", "schema", { | 19 | ExecutorApiClient.query("tools", "schema", { |
| 20 | path: { scopeId, toolId }, | 20 | path: { scopeId, toolId }, |
| 21 | timeToLive: "1 minute", | 21 | timeToLive: "1 minute", |
| 22 | }); | 22 | }); |
| 23 | | 23 | |
| 24 | export const secretsAtom = (scopeId: ScopeId = DEFAULT_SCOPE) => | 24 | export const secretsAtom = (scopeId: ScopeId = DEFAULT_SCOPE) => |
| 25 | getExecutorClient().query("secrets", "list", { | 25 | ExecutorApiClient.query("secrets", "list", { |
| 26 | path: { scopeId }, | 26 | path: { scopeId }, |
| 27 | timeToLive: "30 seconds", | 27 | timeToLive: "30 seconds", |
| 28 | }); | 28 | }); |
| 29 | | 29 | |
| 30 | export const secretStatusAtom = (scopeId: ScopeId, secretId: SecretId) => | 30 | export const secretStatusAtom = (scopeId: ScopeId, secretId: SecretId) => |
| 31 | getExecutorClient().query("secrets", "status", { | 31 | ExecutorApiClient.query("secrets", "status", { |
| 32 | path: { scopeId, secretId }, | 32 | path: { scopeId, secretId }, |
| 33 | timeToLive: "15 seconds", | 33 | timeToLive: "15 seconds", |
| 34 | }); | 34 | }); |
| @@ -37,8 +37,8 @@ export const secretStatusAtom = (scopeId: ScopeId, secretId: SecretId) => · 2 unmodified lines |
| 37 | // Mutation atoms | 37 | // Mutation atoms |
| 38 | // --------------------------------------------------------------------------- | 38 | // --------------------------------------------------------------------------- |
| 39 | | 39 | |
| 40 | export const invokeTool = getExecutorClient().mutation("tools", "invoke"); | 40 | export const invokeTool = ExecutorApiClient.mutation("tools", "invoke"); |
| 41 | | 41 | |
| 42 | export const setSecret = getExecutorClient().mutation("secrets", "set"); | 42 | export const setSecret = ExecutorApiClient.mutation("secrets", "set"); |
| 43 | | 43 | |
| 44 | export const removeSecret = getExecutorClient().mutation("secrets", "remove"); | 44 | export const removeSecret = ExecutorApiClient.mutation("secrets", "remove"); |