Files
didactyl/src/tools/tools.h
T

33 lines
1.4 KiB
C

#ifndef DIDACTYL_TOOLS_H
#define DIDACTYL_TOOLS_H
#include "../config.h"
#include "../nostr_core_lib/nostr_core/nostr_signer.h"
struct trigger_manager;
typedef struct {
didactyl_config_t* cfg;
/* Optional process-lifetime signer handle (non-owning). When set,
* NIP-04/44 encrypt/decrypt tool call sites route through the signer
* verbs so remote signer modes keep the nsec out of the agent. Falls
* back to the legacy raw-key path when NULL (local mode / pre-Phase-3). */
nostr_signer_t* signer;
struct trigger_manager* trigger_manager;
int template_sender_tier;
const char* template_current_user_message;
const char* template_trigger_event_json;
const char* (*template_skill_lookup)(void* user_data, const char* d_tag);
void* template_skill_lookup_user_data;
} tools_context_t;
int tools_init(tools_context_t* ctx, didactyl_config_t* cfg);
void tools_cleanup(tools_context_t* ctx);
/* Wire a process-lifetime signer handle into the tools context. Non-owning:
* caller must keep the signer alive for the context's lifetime and free it
* after tools_cleanup. Passing NULL restores the legacy raw-key fallback. */
void tools_set_signer(tools_context_t* ctx, nostr_signer_t* signer);
char* tools_build_openai_schema_json(const tools_context_t* ctx);
char* tools_execute(tools_context_t* ctx, const char* tool_name, const char* args_json);
#endif