MCPcopy Create free account

hub / github.com/0xjeffro/astroclaw / functions

Functions765 in github.com/0xjeffro/astroclaw

↓ 42 callersMethodExecute
(ctx context.Context, args string)
pkg/tool/tool.go:10
↓ 40 callersMethodExec
(context.Context, string, ...interface{})
pkg/app/agents/db/db.go:15
↓ 36 callersFunctionwriteJSON
writeJSON serializes body as JSON and writes it to the response with the given status code and a JSON Content-Type header.
pkg/api/handlers.go:267
↓ 28 callersMethodQueryRow
(context.Context, string, ...interface{})
pkg/app/agents/db/db.go:17
↓ 23 callersFunctionNew
(p provider.Provider, system string, tools *tool.Registry, contextWindow int)
pkg/agent/agent.go:26
↓ 23 callersMethodQuery
(context.Context, string, ...interface{})
pkg/app/agents/db/db.go:16
↓ 22 callersFunctionNewRouter
NewRouter wires up the chi router with the supplied services. Kept separate from init() so tests can build a router without DSQL.
pkg/api/handlers.go:56
↓ 17 callersMethodReply
(ctx context.Context, sessionID, agentID, text string)
pkg/api/reply.go:20
↓ 17 callersFunctiondo
--- helpers --------------------------------------------------------------- do builds a request (JSON-encoding body when non-nil), serves it through t
pkg/api/handlers_test.go:137
↓ 15 callersFunctioncreateTemplate
()
deploy/aws/infra/test/infra.test.ts:20
↓ 13 callersMethodRegister
Register adds a tool to the registry.
pkg/tool/tool.go:25
↓ 12 callersMethodExecute
(ctx context.Context, args string)
pkg/tool/websearch/websearch.go:70
↓ 11 callersFunctionCreateHash
CreateHash returns an Argon2id hash of a plain-text password using the provided algorithm parameters. The returned hash follows the format used by the
pkg/crypto/password.go:90
↓ 10 callersMethodGet
Get returns the decoded secret. The first successful call loads from DB and decodes base64; later calls return the cached bytes. If load fails, the ne
pkg/auth/keys.go:33
↓ 10 callersFunctionvalidClaims
()
pkg/auth/jwt_test.go:18
↓ 9 callersFunctionBuildSystemPrompt
BuildSystemPrompt assembles the full system prompt from hardcoded rules and configurable sections. The result is cached per session to preserve LLM pr
pkg/agent/prompt.go:106
↓ 9 callersFunctionDefaultCharLimits
DefaultCharLimits returns sensible defaults.
pkg/agent/prompt.go:95
↓ 9 callersFunctionSign
(secret []byte, c Claims)
pkg/auth/jwt.go:31
↓ 9 callersFunctionisPrivateOrRestrictedIP
isPrivateOrRestrictedIP returns true for IPs that should never be fetched: IPv4: - 10.0.0.0/8 RFC 1918 private - 172.16.0.0/12 RFC 1918 private - 192
pkg/tool/webfetch/ssrf.go:161
↓ 8 callersMethodGetAdmin
(ctx context.Context)
pkg/api/handlers.go:37
↓ 8 callersFunctionParse
Parse verifies a token against the secret and returns the decoded claims.
pkg/auth/jwt.go:48
↓ 8 callersMethodforceCompress
forceCompress drops the oldest ~50% of Turns from history. This is the emergency strategy when summarization fails or history is still over budget aft
pkg/agent/context.go:140
↓ 8 callersFunctionsplitStatements
splitStatements splits SQL content by semicolons at the end of a line. Skips empty statements and comment-only lines.
deploy/aws/lambda/migrate/main.go:414
↓ 7 callersFunctionEncryptAESGCM
EncryptAESGCM encrypts plaintext with AES-256-GCM using the given data key. It returns a fresh 12-byte nonce and the ciphertext. The caller stores bot
pkg/crypto/aes.go:30
↓ 7 callersFunctionNewService
NewService returns a system Service. Callers that create users or workspaces must pass WithProvisioner so the corresponding passwords data key is cre
pkg/app/system/service.go:51
↓ 7 callersFunctionRequireAuth
RequireAuth returns a middleware that rejects any request without a valid bearer token. On success, the request's context carries the parsed *Claims,
pkg/auth/middleware.go:51
↓ 7 callersMethodServeHTTP
(w http.ResponseWriter, r *http.Request)
pkg/auth/middleware_test.go:44
↓ 7 callersMethodisOverBudget
isOverBudget checks whether the current history + system + summary + tools exceed the model's context window. Returns false if contextWindow is 0 (no
pkg/agent/context.go:35
↓ 7 callersFunctionmakeExecArgs
makeExecArgs is a test helper that wraps a command string into the JSON format that OpenAI would send as tool_call arguments: {"command": "echo hello"
pkg/tool/exec_test.go:13
↓ 7 callersFunctionmakeReadFileArgs
makeReadFileArgs is a test helper that wraps a file path into the JSON format that OpenAI would send as tool_call arguments: {"path": "/tmp/foo.txt"}
pkg/tool/readfile_test.go:16
↓ 7 callersFunctionparseTurnBoundaries
parseTurnBoundaries returns the indices of all user messages in history. Each user message marks the start of a new Turn — a complete cycle of: user →
pkg/agent/context.go:90
↓ 6 callersFunctionCheckHash
CheckHash is like ComparePasswordAndHash, except it also returns the params that the hash was created with. This can be useful if you want to update y
pkg/crypto/password.go:117
↓ 6 callersMethodCreateSessionInWorkspace
(ctx context.Context, workspaceID, userID string, agentIDs []string, title string)
pkg/api/handlers.go:20
↓ 6 callersFunctionDecodeHash
DecodeHash expects a hash created from this package, and parses it to return the params used to create it, as well as the salt and key (password hash)
pkg/crypto/password.go:149
↓ 6 callersFunctionGenerateDataKey
GenerateDataKey returns a fresh 32-byte AES-256 key drawn from crypto/rand. Use this when a workspace/user/system scope first needs to encrypt somethi
pkg/crypto/aes.go:17
↓ 6 callersFunctionNew
()
pkg/tool/webfetch/webfetch.go:54
↓ 6 callersFunctionUserFromDB
(u db.AppSystemUser)
pkg/app/system/types.go:42
↓ 6 callersMethoddo
do issues a request against the API base URL with the standard 30s timeout. Most methods use this.
pkg/client/client.go:66
↓ 6 callersFunctionestimateMessageTokens
estimateMessageTokens estimates the token count of a single message using a character-based heuristic: ~2.5 characters per token, no external tokenize
pkg/agent/context.go:51
↓ 6 callersFunctiongenerateRandomBytes
(n uint32)
pkg/crypto/password.go:137
↓ 6 callersFunctionmakeArgs
makeArgs is a test helper that wraps an expression string into the JSON format that OpenAI would send as tool_call arguments: {"expression": "1+2"} Th
pkg/tool/arithmetic_test.go:15
↓ 6 callersFunctionmakeEditFileArgs
makeEditFileArgs is a test helper that builds the JSON arguments for edit_file.
pkg/tool/editfile_test.go:14
↓ 6 callersMethodsummarizeOldTurns
summarizeOldTurns summarizes the oldest Turns in history using the LLM, keeping the most recent Turns as-is. The summary replaces the original message
pkg/agent/context.go:183
↓ 5 callersFunctionComparePasswordAndHash
ComparePasswordAndHash performs a constant-time comparison between a plain-text password and Argon2id hash, using the parameters and salt contained in
pkg/crypto/password.go:109
↓ 5 callersFunctionDecryptAESGCM
DecryptAESGCM reverses EncryptAESGCM. It returns the plaintext, or a non-nil error if the ciphertext or nonce was modified after encryption (AES-GCM c
pkg/crypto/aes.go:46
↓ 5 callersMethodListWorkspacesForUser
(ctx context.Context, userID string)
pkg/api/handlers.go:38
↓ 5 callersMethodLogin
Login authenticates with email and password. On success the token is stored in the Client and attached to all subsequent requests; callers who need to
pkg/client/client.go:153
↓ 5 callersFunctionNewWsRegistry
NewWsRegistry adapts an existing *system.Service to the Registry interface. The service keeps owning the underlying SQL queries; this type only expose
pkg/cloud/wsbus/ws_registry.go:24
↓ 5 callersMethodPushToSession
PushToSession dispatches a WSEvent to all live connections of every member of the session. Streaming callbacks (OnTextDelta / OnToolCall OnToolResult
pkg/api/reply.go:84
↓ 5 callersFunctionassertStatements
(t *testing.T, got, want []string)
deploy/aws/lambda/migrate/main_test.go:440
↓ 5 callersFunctioncalcRightSidebarWidth
calcRightSidebarWidth returns how wide the right sidebar should be. Extra space goes to logs first (up to max), then to chat. Returns 0 if there's not
tui/model.go:35
↓ 5 callersFunctiondecodeErr
decodeErr pulls the "error" field out of a writeAuthError JSON body.
pkg/auth/middleware_test.go:53
↓ 5 callersFunctionfindSafeBoundary
findSafeBoundary finds the nearest Turn boundary at or before targetIndex. Normal case: returns the last boundary <= targetIndex. For example, if bou
pkg/agent/context.go:115
↓ 5 callersMethodget
(ctx context.Context, path string)
main.go:160
↓ 5 callersFunctionnewTestServer
newTestServer spins up a real api.NewRouter against fake services, wraps it in an httptest.Server, and returns a Client pointed at it. The server is t
pkg/client/client_test.go:52
↓ 5 callersFunctionsetupEditFile
setupEditFile is a test helper that creates a temp file with the given content and returns its path. The file is automatically cleaned up when the tes
pkg/tool/editfile_test.go:26
↓ 4 callersFunctionChatSync
ChatSync consumes a ChatStream channel and assembles the events into a complete Message. Use this when streaming output is not needed (e.g., wen summa
pkg/provider/provider.go:55
↓ 4 callersFunctionClaimsFromContext
(ctx context.Context)
pkg/auth/middleware.go:19
↓ 4 callersMethodDecrypt
Decrypt reverses Encrypt for a blob produced by the same master key. Returns an error if the blob was tampered with or was produced by a different key
pkg/crypto/keymanager.go:33
↓ 4 callersMethodEncrypt
Encrypt encrypts plaintext with the master key. Returns an opaque blob that must be passed back to Decrypt unchanged.
pkg/crypto/keymanager.go:28
↓ 4 callersMethodExecute
(ctx context.Context, args string)
pkg/tool/memory.go:44
↓ 4 callersMethodGet
Get returns the tool with the given name if it exists.
pkg/tool/tool.go:30
↓ 4 callersMethodGetByUser
(ctx context.Context, userID string)
pkg/cloud/wsbus/wsbus.go:45
↓ 4 callersMethodGetWorkspaceSetting
(ctx context.Context, workspaceID, name string)
pkg/api/handlers.go:30
↓ 4 callersFunctionNewRegistry
NewRegistry creates a new tool registry.
pkg/tool/tool.go:20
↓ 4 callersMethodServeHTTP
ServeHTTP handles POST /sessions/{sessionID}/reply.
pkg/api/reply.go:38
↓ 4 callersFunctionWorkspaceFromDB
(w db.AppSystemWorkspace)
pkg/app/system/types.go:61
↓ 4 callersFunctionddgTimeRange
ddgTimeRange maps our normalized time range codes to DuckDuckGo's df parameter. DuckDuckGo uses "t" for year instead of "y".
pkg/tool/websearch/ddg.go:170
↓ 4 callersMethodget
(ctx context.Context, path string)
tui/backend.go:112
↓ 4 callersFunctionisObviousPrivateHost
isObviousPrivateHost is a lightweight pre-flight check that catches obviously private hostnames without performing DNS resolution. The real SSRF guard
pkg/tool/webfetch/ssrf.go:119
↓ 4 callersFunctionmakeWriteFileArgs
makeWriteFileArgs is a test helper that builds the JSON arguments for write_file. overwrite is optional — pass true to set it.
pkg/tool/writefile_test.go:14
↓ 4 callersFunctionnewClient
()
cmd/astroclaw/main.go:31
↓ 4 callersFunctionparseDDGResults
parseDDGResults extracts search results from DuckDuckGo's HTML response. Link and snippet matches are aligned by position (the Nth link corresponds to
pkg/tool/websearch/ddg.go:99
↓ 4 callersFunctionsetupService
setupService creates a Service for testing using the shared testPool. Cleans up data before each test to ensure isolation.
pkg/app/chat/service_test.go:117
↓ 4 callersFunctionsignTestToken
signTestToken builds a signed token with the given claims, failing the test on any signing error.
pkg/auth/middleware_test.go:28
↓ 4 callersFunctionstatusForError
statusForError maps known sentinel errors to HTTP status codes; otherwise falls back to fallback (typically 404 or 500 depending on the call site).
pkg/api/handlers.go:275
↓ 4 callersFunctionupdateViewport
updateViewport rebuilds the chat content and scrolls to the bottom.
tui/model.go:333
↓ 4 callersFunctionwriteAuthError
(w http.ResponseWriter, status int, msg string)
pkg/auth/middleware.go:41
↓ 3 callersFunctionAgentFromDB
(a db.AppAgentsProfile)
pkg/app/agents/types.go:24
↓ 3 callersMethodGetSession
(ctx context.Context, id string)
pkg/api/handlers.go:22
↓ 3 callersMethodGetSystemCredential
===================================================================== System scope ===================================================================
pkg/app/passwords/service.go:67
↓ 3 callersMethodHistory
()
pkg/agent/agent.go:45
↓ 3 callersMethodListUserWorkspaces
(ctx context.Context, userID string)
main.go:111
↓ 3 callersMethodMe
Me returns the currently authenticated user, identified by the bearer token. CLIs use this to discover the user's ID without keeping it in local state
pkg/client/client.go:201
↓ 3 callersFunctionNewAnthropic
(apiKey, model string)
pkg/provider/anthropic.go:22
↓ 3 callersFunctionNewBus
NewBus returns a Bus with an empty socket map.
pkg/cloud/wsbus/inprocess/bus.go:38
↓ 3 callersFunctionNewService
( pool *pgxpool.Pool, createFn func(s *Session, agentID string) (*agent.Agent, error), )
pkg/app/chat/service.go:24
↓ 3 callersFunctionNewService
(pool *pgxpool.Pool)
pkg/app/settings/service.go:16
↓ 3 callersFunctionNewService
(pool *pgxpool.Pool, km crypto.KeyManager)
pkg/app/passwords/service.go:53
↓ 3 callersFunctionOpenKeyManager
OpenKeyManager returns a crypto.KeyManager backed by gocloud.dev/secrets, picked by URL scheme. Supported URLs: awskms://<keyID>?region=<region> AWS
pkg/cloud/kms.go:30
↓ 3 callersFunctionSessionFromDB
SessionFromDB constructs a chat.Session from a db.AppChatSession.
pkg/app/chat/types.go:33
↓ 3 callersFunctionSkillFromDB
(s db.AppSkill)
pkg/app/skills/types.go:30
↓ 3 callersMethodSoftDeleteSession
(ctx context.Context, id string)
pkg/api/handlers.go:23
↓ 3 callersMethodUnregister
(ctx context.Context, connID string)
pkg/cloud/wsbus/wsbus.go:44
↓ 3 callersMethodUpsertWorkspaceSetting
(ctx context.Context, workspaceID, name, value string)
pkg/api/handlers.go:31
↓ 3 callersFunctionclampDelay
clampDelay constrains a duration to [0, maxRetryWait].
pkg/provider/httputil.go:97
↓ 3 callersFunctionestimateTokens
estimateTokens estimates the total token count of a message slice.
pkg/agent/context.go:63
↓ 3 callersFunctionestimateToolTokens
estimateToolTokens estimates how many tokens the tool definitions occupy in the request. Each tool's name, description, and JSON-serialized parameters
pkg/agent/context.go:74
↓ 3 callersFunctionextractText
extractText converts HTML to plain text by removing script/style/noscript blocks, stripping all tags, and normalizing whitespace. TODO: upgrade to pro
pkg/tool/webfetch/webfetch.go:206
↓ 3 callersFunctionformatJSON
formatJSON pretty-prints JSON. If the input is not valid JSON, returns it as-is.
pkg/tool/webfetch/webfetch.go:191
next →1–100 of 765, ranked by callers