pkg/

directory
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: AGPL-3.0

Directories

Path Synopsis
Package agenttrace is the capture contract for Agent Call Tracing, shared by the gateway hooks in proxy/, the embedded and edge transports, and the Enterprise assembler (spec: enterprise/features/agenttracing/SPEC.md).
Package agenttrace is the capture contract for Agent Call Tracing, shared by the gateway hooks in proxy/, the embedded and edge transports, and the Enterprise assembler (spec: enterprise/features/agenttracing/SPEC.md).
declared
Package declared extracts the context a client declares about a gateway request (spec enterprise/features/agenttracing/SPEC.md §4.2 and §4.3): W3C trace context and baggage, the X-Tyk-* tracing headers, the compatibility header families of other gateways, a few body fields, and the session ids of verified coding harnesses.
Package declared extracts the context a client declares about a gateway request (spec enterprise/features/agenttracing/SPEC.md §4.2 and §4.3): W3C trace context and baggage, the X-Tyk-* tracing headers, the compatibility header families of other gateways, a few body fields, and the session ids of verified coding harnesses.
extract
Package extract turns LLM request and response bodies into the correlation extracts of Agent Call Tracing (spec §4.4): the tool calls a response requests, the trailing tool results a request sends back, response ids and finish reasons.
Package extract turns LLM request and response bodies into the correlation extracts of Agent Call Tracing (spec §4.4): the tool calls a response requests, the trailing tool results a request sends back, response ids and finish reasons.
traceschema
Package traceschema holds the JSON Schema of the agent-trace export format (application/vnd.tyk.agent-trace+json; v=1, spec §7).
Package traceschema holds the JSON Schema of the agent-trace export format (application/vnd.tyk.agent-trace+json; v=1, spec §7).
Package aigateway provides a simple interface to use the Midsommar AI Gateway as an importable library in standalone applications.
Package aigateway provides a simple interface to use the Midsommar AI Gateway as an importable library in standalone applications.
Package authidentity carries who authenticated a gateway request, and how, on the request context.
Package authidentity carries who authenticated a gateway request, and how, on the request context.
Package authz defines the permission vocabulary used by role-based access control.
Package authz defines the permission vocabulary used by role-based access control.
Package brokerdial holds the one connection a plugin process opens to its host's brokered service server (KV, management, events, edge payloads).
Package brokerdial holds the one connection a plugin process opens to its host's brokered service server (KV, management, events, edge payloads).
Package cluster lets several Studio replicas share one database: it registers each replica (Node) so others can tell live replicas from dead ones, and carries events every replica must see (Log).
Package cluster lets several Studio replicas share one database: it registers each replica (Node) so others can tell live replicas from dead ones, and carries events every replica must see (Log).
Package corsutil centralizes the CORS policy for endpoints that historically sent `Access-Control-Allow-Origin: *` (OAuth, proxy metadata, plugin assets).
Package corsutil centralizes the CORS policy for endpoints that historically sent `Access-Control-Allow-Origin: *` (OAuth, proxy metadata, plugin assets).
Package credhash computes the keyed hash under which a credential (an App key, a standalone microgateway API token) is cached, stored and looked up in place of the credential itself:
Package credhash computes the keyed hash under which a credential (an App key, a standalone microgateway API token) is cached, stored and looked up in place of the credential itself:
Package credsync is what the control server's SyncCredentials RPC (EDGE_CREDENTIAL_SYNC=full on an edge) is built from in every edition: the hook its handler registers through, what a handler reads from the control server (Source), and the read of credential rows with their Apps.
Package credsync is what the control server's SyncCredentials RPC (EDGE_CREDENTIAL_SYNC=full on an edge) is built from in every edition: the hook its handler registers through, what a handler reads from the control server (Source), and the read of credential rows with their Apps.
Package dbhold holds database statements across a Postgres failover.
Package dbhold holds database statements across a Postgres failover.
Package dbstate tracks whether the PostgreSQL server a Studio replica is connected to takes writes.
Package dbstate tracks whether the PostgreSQL server a Studio replica is connected to takes writes.
Package decisions holds the wire types for decision models ("System One" models): models that answer typed questions about a piece of evidence with calibrated probabilities instead of generating text.
Package decisions holds the wire types for decision models ("System One" models): models that answer typed questions about a piece of evidence with calibrated probabilities instead of generating text.
Package eventbridge provides an event bus system for communication between AI Studio (control) and Microgateway (edge) nodes using simonfxr/pubsub for in-process event buses and gRPC for cross-node event forwarding.
Package eventbridge provides an event bus system for communication between AI Studio (control) and Microgateway (edge) nodes using simonfxr/pubsub for in-process event buses and gRPC for cross-node event forwarding.
Package filterscript holds the filter-script settings that both AI Studio and the microgateway check at startup.
Package filterscript holds the filter-script settings that both AI Studio and the microgateway check at startup.
Package fipsinfo reports the process's FIPS 140-3 status, for the startup log, the /health endpoints of AI Studio and the microgateway, and the edge heartbeat (so the hub can show each edge's status).
Package fipsinfo reports the process's FIPS 140-3 status, for the startup log, the /health endpoints of AI Studio and the microgateway, and the edge heartbeat (so the hub can show each edge's status).
Package fipstest is for tests that check the FIPS 140-3 build and mode.
Package fipstest is for tests that check the FIPS 140-3 build and mode.
gatewayplugin
interfaces
plugins/interfaces/auth.go
plugins/interfaces/auth.go
sdk
plugins/sdk/conversions.go
plugins/sdk/conversions.go
Package lrucache is a small bounded cache keyed by string: least recently used entries are evicted at capacity, and a value that is missing is built once even when many goroutines ask for it at the same moment.
Package lrucache is a small bounded cache keyed by string: least recently used entries are evicted at capacity, and a value that is missing is built once even when many goroutines ask for it at the same moment.
Package mcpannotations derives MCP tool annotations (readOnlyHint, destructiveHint, ...) for an OpenAPI operation: from its HTTP method, overridden by x-mcp-* extensions on the operation.
Package mcpannotations derives MCP tool annotations (readOnlyHint, destructiveHint, ...) for an OpenAPI operation: from its HTTP method, overridden by x-mcp-* extensions on the operation.
Package mcpintrospect asks a remote MCP server which tools it offers.
Package mcpintrospect asks a remote MCP server which tools it offers.
Package middleware provides HTTP middleware shared between AI Studio and the Microgateway.
Package middleware provides HTTP middleware shared between AI Studio and the Microgateway.
Package modelmatch is the single implementation of the LLM "allowed models" matching rule.
Package modelmatch is the single implementation of the LLM "allowed models" matching rule.
Package nativeapi is the contract between LLM vendors and the native proxy routes (/llm/rest|stream|call/{slug}/...) for SDK-specific endpoints that do not fit the single synchronous "POST with a top-level model" shape: Anthropic Message Batches and count_tokens, OpenAI Responses ownership and OpenAI Batches and Files.
Package nativeapi is the contract between LLM vendors and the native proxy routes (/llm/rest|stream|call/{slug}/...) for SDK-specific endpoints that do not fit the single synchronous "POST with a top-level model" shape: Anthropic Message Batches and count_tokens, OpenAI Responses ownership and OpenAI Batches and Files.
Package netguard provides SSRF safeguards for outbound requests whose destination is derived from stored configuration (LLM upstream endpoints, OCI registries).
Package netguard provides SSRF safeguards for outbound requests whose destination is derived from stored configuration (LLM upstream endpoints, OCI registries).
netguardtest
Package netguardtest stubs the DNS lookups of the plugin host checks (netguard.LookupIP), so tests that name registries or plugin hosts stay hermetic.
Package netguardtest stubs the DNS lookups of the plugin host checks (netguard.LookupIP), so tests that name registries or plugin hosts stay hermetic.
Package oauthscope is the single definition of the OAuth scopes this platform issues and enforces.
Package oauthscope is the single definition of the OAuth scopes this platform issues and enforces.
pkg/ociplugins/client.go
pkg/ociplugins/client.go
ocitest
Package ocitest provides an in-memory OCI distribution registry for tests that exercise the real ORAS fetcher (and signature verifiers) end to end.
Package ocitest provides an in-memory OCI distribution registry for tests that exercise the real ORAS fetcher (and signature verifiers) end to end.
Package pathcheck reports, once at startup, every filesystem path a binary is configured with: where the value came from (set, or the built-in default), the absolute path it resolves to from the working directory, and whether the file or directory is there and usable by the process user.
Package pathcheck reports, once at startup, every filesystem path a binary is configured with: where the value came from (set, or the built-in default), the absolute path it resolves to from the working directory, and whether the file or directory is there and usable by the process user.
Package pglisten shares one PostgreSQL LISTEN connection per database among every subscriber in the process.
Package pglisten shares one PostgreSQL LISTEN connection per database among every subscriber in the process.
Package plugin_sdk provides a unified SDK for building plugins that work in both AI Studio and Microgateway contexts.
Package plugin_sdk provides a unified SDK for building plugins that work in both AI Studio and Microgateway contexts.
Package pluginenv builds the environment plugin processes start with.
Package pluginenv builds the environment plugin processes start with.
Package pluginlimits sets the largest gRPC message plugins and plugin hosts exchange, and recognises a plugin that refused a message for its size.
Package pluginlimits sets the largest gRPC message plugins and plugin hosts exchange, and recognises a plugin that refused a message for its size.
Package pwhash hashes and verifies passwords and long-lived secrets (user passwords, OAuth client secrets, microgateway credential secrets).
Package pwhash hashes and verifies passwords and long-lived secrets (user passwords, OAuth client secrets, microgateway credential secrets).
Package replicas is how code anywhere in Studio (core or Enterprise) cooperates with the other control-plane replicas sharing its database, without being handed the cluster machinery:
Package replicas is how code anywhere in Studio (core or Enterprise) cooperates with the other control-plane replicas sharing its database, without being handed the cluster machinery:
Package requestformat names the wire shape of an LLM request body (its filter format) from the LLM's vendor and the request's method and path.
Package requestformat names the wire shape of an LLM request body (its filter format) from the LLM's vendor and the request's method and path.
Package requestid gives every gateway request one id of AI Studio's own.
Package requestid gives every gateway request one id of AI Studio's own.
Package safe keeps a panic in Studio's background work from taking the whole process down.
Package safe keeps a panic in Studio's background work from taking the whole process down.
Package semanticrouting holds the shared shape of a Semantic Router: the configuration an administrator writes, what the classifier is asked, and what it answers.
Package semanticrouting holds the shared shape of a Semantic Router: the configuration an administrator writes, what the classifier is asked, and what it answers.
llmclient
Package llmclient reaches LLMs for the Semantic Router engine (embeddings for the example and request vectors, and a completion for its judge) and for the guardrail second opinion (Generate).
Package llmclient reaches LLMs for the Semantic Router engine (embeddings for the example and request vectors, and a completion for its judge) and for the guardrail second opinion (Generate).
Package snapshotguard keeps one entry of a configuration snapshot that an edge cannot store from blocking the rest of it.
Package snapshotguard keeps one entry of a configuration snapshot that an edge cannot store from blocking the rest of it.
Package sqlitedsn tunes SQLite DSNs (mattn/go-sqlite3 parameter names) for concurrent use.
Package sqlitedsn tunes SQLite DSNs (mattn/go-sqlite3 parameter names) for concurrent use.
Package studio runs Tyk AI Studio inside another Go process.
Package studio runs Tyk AI Studio inside another Go process.
sqlitedb
Package sqlitedb adds SQLite to studio.OpenDatabase.
Package sqlitedb adds SQLite to studio.OpenDatabase.
testinfra
containers
Package containers provides testcontainers-go helpers for integration testing.
Package containers provides testcontainers-go helpers for integration testing.
mockllm
Package mockllm provides mock LLM backends for E2E testing.
Package mockllm provides mock LLM backends for E2E testing.
plugintest
Package plugintest provides E2E testing utilities for plugins.
Package plugintest provides E2E testing utilities for plugins.
sqlitetemplate
Package sqlitetemplate gives tests a migrated SQLite database without migrating it for every test.
Package sqlitetemplate gives tests a migrated SQLite database without migrating it for every test.
studiodb
Package studiodb gives a test's SQLite database Studio's schema without migrating it again.
Package studiodb gives a test's SQLite database Studio's schema without migrating it again.
toolfixtures
Package toolfixtures holds vendor request bodies that carry tool use, with the segments a lossless segmenter is expected to find in them, for tests of tool-result guardrails (epic midsommar-clean-4uc).
Package toolfixtures holds vendor request bodies that carry tool use, with the segments a lossless segmenter is expected to find in them, for tests of tool-result guardrails (epic midsommar-clean-4uc).
vendorconformance
Package vendorconformance holds the shared, module-neutral half of the live vendor conformance suite: configuration loading, the vendor/surface/scenario support matrix, canonical wire schemas, response normalization and drift detection.
Package vendorconformance holds the shared, module-neutral half of the live vendor conformance suite: configuration loading, the vendor/surface/scenario support matrix, canonical wire schemas, response normalization and drift detection.
Package tiktokenbpe loads tiktoken BPE rank files without SHA-1, so token counting works under GODEBUG=fips140=only.
Package tiktokenbpe loads tiktoken BPE rank files without SHA-1, so token counting works under GODEBUG=fips140=only.
Package tracing wires OpenTelemetry distributed tracing for the LLM proxy.
Package tracing wires OpenTelemetry distributed tracing for the LLM proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL