@standardagents/spec 0.37.8 → 0.38.1
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/dist/index.d.ts +149 -18
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -833,6 +833,10 @@ interface UserHandle extends ThreadUser {
|
|
|
833
833
|
* scope's serialization guarantee. The runtime MUST NOT require network
|
|
834
834
|
* self-addressing to fulfill this call. Rejects for user-less threads.
|
|
835
835
|
*
|
|
836
|
+
* The endpoint is always relative to the packaged user-endpoint namespace.
|
|
837
|
+
* Runtimes reject dot-segment traversal (including encoded/backslash forms)
|
|
838
|
+
* rather than allowing URL normalization to address another hub route.
|
|
839
|
+
*
|
|
836
840
|
* @param endpoint - The user endpoint path (e.g. `"standardcode/lease_acquire"`)
|
|
837
841
|
* @param payload - JSON-serializable request body (POSTed to the handler)
|
|
838
842
|
*/
|
|
@@ -952,16 +956,17 @@ declare function isUserEndpoint(value: unknown): value is MarkedUserEndpoint;
|
|
|
952
956
|
declare function defineUserEndpoint(handler: UserEndpointHandler): MarkedUserEndpoint;
|
|
953
957
|
|
|
954
958
|
/**
|
|
955
|
-
* Agent Skills —
|
|
959
|
+
* Agent Skills — principal-scoped skill store types.
|
|
956
960
|
*
|
|
957
961
|
* Skills follow the Agent Skills standard (https://agentskills.io): a folder
|
|
958
962
|
* whose root SKILL.md opens with YAML frontmatter carrying a required `name`
|
|
959
963
|
* (lowercase kebab, ≤64 chars) and `description` (≤1024 chars), optionally
|
|
960
964
|
* accompanied by scripts, references, and assets.
|
|
961
965
|
*
|
|
962
|
-
* Runtimes store skills server-side
|
|
963
|
-
*
|
|
964
|
-
*
|
|
966
|
+
* Runtimes store skills server-side and scope visibility to the calling
|
|
967
|
+
* principal. A runtime may additionally expose administrator-reviewed shared
|
|
968
|
+
* skills. One principal's private skill MUST NOT be visible to another.
|
|
969
|
+
* Progressive disclosure is the contract — agents see only each
|
|
965
970
|
* skill's name + description until a skill is judged applicable, at which
|
|
966
971
|
* point they load its SKILL.md body (and, when needed, read or execute its
|
|
967
972
|
* bundled files).
|
|
@@ -987,9 +992,9 @@ interface SkillFileInput {
|
|
|
987
992
|
content: string;
|
|
988
993
|
}
|
|
989
994
|
/**
|
|
990
|
-
* ThreadState surface for the
|
|
991
|
-
*
|
|
992
|
-
*
|
|
995
|
+
* ThreadState surface for the calling thread owner's skill library plus any
|
|
996
|
+
* explicitly shared runtime skills. Owner-scoped names take precedence over a
|
|
997
|
+
* shared skill with the same name.
|
|
993
998
|
*/
|
|
994
999
|
interface SkillsNamespace {
|
|
995
1000
|
/** Installed skills (enabled only, unless includeDisabled). */
|
|
@@ -1007,11 +1012,16 @@ interface SkillsNamespace {
|
|
|
1007
1012
|
* Install (or replace) a skill from its file set. The file set must include
|
|
1008
1013
|
* a root SKILL.md with valid frontmatter; the skill's identity comes from
|
|
1009
1014
|
* that frontmatter, never from a caller-supplied name.
|
|
1015
|
+
*
|
|
1016
|
+
* Runtimes MUST authorize mutation and confine it to the calling principal's
|
|
1017
|
+
* scope. Multi-tenant runtimes MUST NOT permit ordinary tenant agent code to
|
|
1018
|
+
* mutate shared skills; an administrative or equivalently trusted principal
|
|
1019
|
+
* is required for shared-library changes.
|
|
1010
1020
|
*/
|
|
1011
1021
|
install(files: SkillFileInput[]): Promise<SkillMetadata>;
|
|
1012
|
-
/** Enable/disable an installed skill.
|
|
1022
|
+
/** Enable/disable an installed skill. Requires mutation authorization. */
|
|
1013
1023
|
setEnabled(name: string, enabled: boolean): Promise<boolean>;
|
|
1014
|
-
/** Uninstall a skill entirely.
|
|
1024
|
+
/** Uninstall a skill entirely. Requires mutation authorization. */
|
|
1015
1025
|
remove(name: string): Promise<boolean>;
|
|
1016
1026
|
}
|
|
1017
1027
|
|
|
@@ -1961,6 +1971,21 @@ interface ThreadState {
|
|
|
1961
1971
|
* @throws If the variable is not defined in any source
|
|
1962
1972
|
*/
|
|
1963
1973
|
env(propertyName: string): Promise<string>;
|
|
1974
|
+
/**
|
|
1975
|
+
* Resolve an environment value exclusively from the runtime instance.
|
|
1976
|
+
*
|
|
1977
|
+
* Unlike `env()`, this method never considers thread, agent, prompt, or user
|
|
1978
|
+
* values. Use it for security-sensitive instance configuration such as
|
|
1979
|
+
* trusted service endpoints and the credentials sent to those endpoints.
|
|
1980
|
+
*
|
|
1981
|
+
* This capability is optional for backward compatibility with runtimes that
|
|
1982
|
+
* predate instance-scoped environment access. Consumers that require an
|
|
1983
|
+
* instance trust boundary MUST fail closed when the method is unavailable.
|
|
1984
|
+
*
|
|
1985
|
+
* @returns The instance value, or `undefined` when the key is not configured
|
|
1986
|
+
* @throws If the runtime cannot read the instance environment
|
|
1987
|
+
*/
|
|
1988
|
+
instanceEnv?(propertyName: string): Promise<string | undefined>;
|
|
1964
1989
|
/**
|
|
1965
1990
|
* Resolve the display/redaction type for an environment value.
|
|
1966
1991
|
*
|
|
@@ -2226,7 +2251,8 @@ interface ThreadState {
|
|
|
2226
2251
|
*
|
|
2227
2252
|
* Resolves a {@link UserHandle}: the identity fields (never credentials)
|
|
2228
2253
|
* plus user-scope capabilities — `call()` into packaged user endpoints
|
|
2229
|
-
* under the user scope's serialization guarantee
|
|
2254
|
+
* under the user scope's serialization guarantee (with endpoint paths
|
|
2255
|
+
* confined to that namespace), durable user values,
|
|
2230
2256
|
* `emit()` on the user event stream, and privileged `fetch()` through
|
|
2231
2257
|
* credential grants.
|
|
2232
2258
|
*
|
|
@@ -2240,10 +2266,12 @@ interface ThreadState {
|
|
|
2240
2266
|
*/
|
|
2241
2267
|
user(): Promise<UserHandle | null>;
|
|
2242
2268
|
/**
|
|
2243
|
-
* The
|
|
2269
|
+
* The thread owner's Agent Skills library plus explicitly shared skills
|
|
2270
|
+
* (https://agentskills.io format).
|
|
2244
2271
|
*
|
|
2245
|
-
*
|
|
2246
|
-
*
|
|
2272
|
+
* Private skills are visible only to the owning principal; administrator-
|
|
2273
|
+
* reviewed shared skills may also be visible. Their files live server-side
|
|
2274
|
+
* (never on a client machine). Agents should follow progressive
|
|
2247
2275
|
* disclosure: browse metadata via `skills.list()`, and load a skill's
|
|
2248
2276
|
* SKILL.md body with `skills.get()` only when it is applicable to the task.
|
|
2249
2277
|
*
|
|
@@ -5108,6 +5136,68 @@ declare function defineAgent<N extends string>(options: AgentDefinition<N>): Age
|
|
|
5108
5136
|
* @module
|
|
5109
5137
|
*/
|
|
5110
5138
|
|
|
5139
|
+
/**
|
|
5140
|
+
* The access level of an endpoint.
|
|
5141
|
+
*
|
|
5142
|
+
* - `authenticated` — the runtime MUST authenticate the request before
|
|
5143
|
+
* invoking the handler, and for thread endpoints MUST additionally enforce
|
|
5144
|
+
* its thread access policy. Requests that fail authentication or
|
|
5145
|
+
* authorization MUST be rejected without invoking the handler.
|
|
5146
|
+
* - `public` — the runtime MUST invoke the handler regardless of the
|
|
5147
|
+
* request's authentication state. The runtime MUST still attempt caller
|
|
5148
|
+
* resolution: a request presenting credentials the runtime can verify is
|
|
5149
|
+
* attributed to that caller, and any other request is treated as anonymous
|
|
5150
|
+
* rather than rejected.
|
|
5151
|
+
*
|
|
5152
|
+
* When no access level is declared, the access level is `authenticated`.
|
|
5153
|
+
*/
|
|
5154
|
+
type EndpointAccess = 'authenticated' | 'public';
|
|
5155
|
+
/**
|
|
5156
|
+
* Symbol used to carry an endpoint's declared access level.
|
|
5157
|
+
*
|
|
5158
|
+
* The declaration is attached to the handler at definition time so that
|
|
5159
|
+
* runtimes can read it before routing the request through their
|
|
5160
|
+
* authentication layer.
|
|
5161
|
+
*/
|
|
5162
|
+
declare const ENDPOINT_ACCESS_SYMBOL: unique symbol;
|
|
5163
|
+
/**
|
|
5164
|
+
* Options accepted when defining an endpoint.
|
|
5165
|
+
*/
|
|
5166
|
+
interface EndpointOptions {
|
|
5167
|
+
/**
|
|
5168
|
+
* The endpoint's access level. Defaults to `authenticated`.
|
|
5169
|
+
*/
|
|
5170
|
+
access?: EndpointAccess;
|
|
5171
|
+
}
|
|
5172
|
+
/**
|
|
5173
|
+
* Resolve the declared access level of an endpoint handler.
|
|
5174
|
+
*
|
|
5175
|
+
* Returns `authenticated` when the value carries no declaration.
|
|
5176
|
+
*/
|
|
5177
|
+
declare function getEndpointAccess(value: unknown): EndpointAccess;
|
|
5178
|
+
/**
|
|
5179
|
+
* The authentication context supplied to a thread endpoint handler.
|
|
5180
|
+
*
|
|
5181
|
+
* The runtime constructs this context for every invocation:
|
|
5182
|
+
*
|
|
5183
|
+
* - `caller` MUST be the authenticated identity when the request presented
|
|
5184
|
+
* credentials the runtime verified, and `null` otherwise. For an endpoint
|
|
5185
|
+
* whose access level is `authenticated`, `caller` is always non-null.
|
|
5186
|
+
* - `threadAccess` MUST be `true` if and only if the runtime's thread access
|
|
5187
|
+
* policy grants the resolved caller access to the requested thread. It
|
|
5188
|
+
* MUST be `false` when `caller` is `null`. For an endpoint whose access
|
|
5189
|
+
* level is `authenticated`, `threadAccess` is always `true`.
|
|
5190
|
+
*
|
|
5191
|
+
* The mechanism by which a runtime authenticates requests is
|
|
5192
|
+
* implementation-defined; this interface defines only the identity contract
|
|
5193
|
+
* observable by endpoint code.
|
|
5194
|
+
*/
|
|
5195
|
+
interface ThreadEndpointAuth {
|
|
5196
|
+
/** The authenticated caller, or `null` for an anonymous request. */
|
|
5197
|
+
caller: ThreadUser | null;
|
|
5198
|
+
/** Whether the caller satisfies the runtime's access policy for the requested thread. */
|
|
5199
|
+
threadAccess: boolean;
|
|
5200
|
+
}
|
|
5111
5201
|
/**
|
|
5112
5202
|
* Symbol used to identify thread endpoint handlers.
|
|
5113
5203
|
*
|
|
@@ -5158,6 +5248,15 @@ type VirtualModuleRegistry<T> = Record<string, VirtualModuleLoader<T>>;
|
|
|
5158
5248
|
interface ControllerContext {
|
|
5159
5249
|
/** The incoming HTTP request */
|
|
5160
5250
|
req: Request;
|
|
5251
|
+
/**
|
|
5252
|
+
* The authenticated caller, or `null` for an anonymous request.
|
|
5253
|
+
*
|
|
5254
|
+
* Populated under the same contract as {@link ThreadEndpointAuth.caller}:
|
|
5255
|
+
* non-null whenever the request presented credentials the runtime
|
|
5256
|
+
* verified, and always non-null for a controller whose access level is
|
|
5257
|
+
* `authenticated`.
|
|
5258
|
+
*/
|
|
5259
|
+
caller?: ThreadUser | null;
|
|
5161
5260
|
/** URL path parameters extracted by the router */
|
|
5162
5261
|
params: Record<string, string>;
|
|
5163
5262
|
/** Parsed URL object */
|
|
@@ -5224,16 +5323,25 @@ type Controller = (context: ControllerContext) => ControllerReturn;
|
|
|
5224
5323
|
* Thread endpoint routes are scoped beneath the runtime's thread ID prefix.
|
|
5225
5324
|
* A request under that prefix that does not match any local or packed thread
|
|
5226
5325
|
* endpoint route MUST return HTTP 404.
|
|
5326
|
+
*
|
|
5327
|
+
* The fourth argument carries the request's authentication context under the
|
|
5328
|
+
* contract defined by {@link ThreadEndpointAuth}. Handlers that do not
|
|
5329
|
+
* consume it may omit the parameter.
|
|
5227
5330
|
*/
|
|
5228
5331
|
type ThreadEndpointRouteParams = Record<string, string>;
|
|
5229
|
-
type ThreadEndpointHandler = (req: Request, state: ThreadState, params: ThreadEndpointRouteParams) => Response | Promise<Response>;
|
|
5332
|
+
type ThreadEndpointHandler = (req: Request, state: ThreadState, params: ThreadEndpointRouteParams, auth: ThreadEndpointAuth) => Response | Promise<Response>;
|
|
5230
5333
|
/**
|
|
5231
5334
|
* Define a standard HTTP controller.
|
|
5232
5335
|
*
|
|
5233
5336
|
* Controllers handle HTTP requests and return responses. They have
|
|
5234
5337
|
* access to the controller context including virtual module registries.
|
|
5235
5338
|
*
|
|
5339
|
+
* A controller's access level is declared through `options.access` and
|
|
5340
|
+
* defaults to `authenticated`; see {@link EndpointAccess} for the
|
|
5341
|
+
* requirements each level places on the runtime.
|
|
5342
|
+
*
|
|
5236
5343
|
* @param controller - The controller function
|
|
5344
|
+
* @param options - Endpoint options, including the access level
|
|
5237
5345
|
* @returns The controller for registration
|
|
5238
5346
|
*
|
|
5239
5347
|
* @example
|
|
@@ -5256,7 +5364,7 @@ type ThreadEndpointHandler = (req: Request, state: ThreadState, params: ThreadEn
|
|
|
5256
5364
|
* });
|
|
5257
5365
|
* ```
|
|
5258
5366
|
*/
|
|
5259
|
-
declare function defineController(controller: Controller): Controller;
|
|
5367
|
+
declare function defineController(controller: Controller, options?: EndpointOptions): Controller;
|
|
5260
5368
|
/**
|
|
5261
5369
|
* Define a thread-specific endpoint.
|
|
5262
5370
|
*
|
|
@@ -5268,7 +5376,14 @@ declare function defineController(controller: Controller): Controller;
|
|
|
5268
5376
|
* Runtimes MUST return HTTP 404 for requests beneath the thread endpoint
|
|
5269
5377
|
* prefix that do not match any local or packed thread endpoint route.
|
|
5270
5378
|
*
|
|
5271
|
-
*
|
|
5379
|
+
* A thread endpoint's access level is declared through `options.access` and
|
|
5380
|
+
* defaults to `authenticated`; see {@link EndpointAccess} for the
|
|
5381
|
+
* requirements each level places on the runtime. Handlers receive the
|
|
5382
|
+
* request's authentication context as their fourth argument under the
|
|
5383
|
+
* contract defined by {@link ThreadEndpointAuth}.
|
|
5384
|
+
*
|
|
5385
|
+
* @param handler - The handler function receiving request, ThreadState, route params, and authentication context
|
|
5386
|
+
* @param options - Endpoint options, including the access level
|
|
5272
5387
|
* @returns A Controller that can be used with the router
|
|
5273
5388
|
*
|
|
5274
5389
|
* @example
|
|
@@ -5330,8 +5445,24 @@ declare function defineController(controller: Controller): Controller;
|
|
|
5330
5445
|
* return Response.json({ exists: !!file });
|
|
5331
5446
|
* });
|
|
5332
5447
|
* ```
|
|
5448
|
+
*
|
|
5449
|
+
* @example
|
|
5450
|
+
* ```typescript
|
|
5451
|
+
* // agents/api/status.ts
|
|
5452
|
+
* import { defineThreadEndpoint } from '@standardagents/spec';
|
|
5453
|
+
*
|
|
5454
|
+
* export default defineThreadEndpoint(
|
|
5455
|
+
* async (req, state, params, auth) => {
|
|
5456
|
+
* return Response.json({
|
|
5457
|
+
* threadId: state.threadId,
|
|
5458
|
+
* authorized: auth.threadAccess,
|
|
5459
|
+
* });
|
|
5460
|
+
* },
|
|
5461
|
+
* { access: 'public' }
|
|
5462
|
+
* );
|
|
5463
|
+
* ```
|
|
5333
5464
|
*/
|
|
5334
|
-
declare function defineThreadEndpoint(handler: ThreadEndpointHandler): MarkedThreadEndpoint;
|
|
5465
|
+
declare function defineThreadEndpoint(handler: ThreadEndpointHandler, options?: EndpointOptions): MarkedThreadEndpoint;
|
|
5335
5466
|
|
|
5336
5467
|
/**
|
|
5337
5468
|
* Packing types for Standard Agents.
|
|
@@ -5544,4 +5675,4 @@ interface PackedExports {
|
|
|
5544
5675
|
__meta: PackedMeta;
|
|
5545
5676
|
}
|
|
5546
5677
|
|
|
5547
|
-
export { type AgentDefinition, type AgentType, type AttachmentRef, type CodeExecution, type CodeExecutionError, type CodeExecutionLog, type CodeExecutionOptions, type CodeExecutionResult, type CodeExecutionStatus, type ContentPart, type Controller, type ControllerContext, type ControllerReturn, type CreateFetch, type CredentialGrant, type DefineToolOptions, type DefinitionLoader, type Effect, type EffectDefinition, type EmptyUsesState, type EnvValueType, type ExecutionState, type FetchLike, type FileChunk, type FilePart, type FileRecord, type FileStats, type FileStorage, type FindResult, type GetMessagesOptions, type GlobalNamespaceContext, type GrepResult, type HookContext, type HookDefinition, type HookDefinitionOptions, type HookDefinitionResult, type HookMessage, type HookName, type HookSignatures, type HookToolCall, type HookToolResult, type ImageContent, type ImagePart, type ImageUrlPart, type InferProviderOptions, type InjectMessageInput, type InspectedRequest, type LLMMessage, type LLMProviderInterface, type ListUserThreadsOptions, type ListUserValuesOptions, type MarkedThreadEndpoint, type MarkedUserEndpoint, type Message, type MessageUpdates, type MessagesResult, type ModelCapabilities, type ModelDefinition, type ModelProvider, type NamespaceContext, type PackageSignature, type PackedExports, type PackedMeta, type PackedMetadata, type PackedNamespaceContext, type PromptContent, type PromptDefinition, type PromptEnvPart, type PromptIncludePart, type PromptInput, type PromptPart, type PromptTextPart, type PromptToolConfig, type ProviderAssistantMessage, type ProviderAttachment, type ProviderConfigSlot, type ProviderConfigSlots, type ProviderConfigValueSource, type ProviderDefinition, ProviderError, type ProviderErrorCode, type ProviderExecutedToolResult, type ProviderFactory, type ProviderFactoryConfig, type ProviderFactoryWithOptions, type ProviderFinishReason, type ProviderGeneratedImage, type ProviderInstance, type ProviderMessage, type ProviderMessageContent, type ProviderMethodOverrides, type ProviderModelInfo, type ProviderModelsPage, type ProviderModelsQuery, type ProviderOverride, type ProviderOverrideContext, type ProviderReasoningDetail, type ProviderRequest, type ProviderResponse, type ProviderStreamChunk, type ProviderSyncOverride, type ProviderSystemMessage, type ProviderTool, type ProviderToolCallPart, type ProviderToolMessage, type ProviderToolResultContent, type ProviderUsage, type ProviderUsagePricing, type ProviderUserMessage, type ProviderWebSearchResult, type QueueMessageInput, type ReadFileStreamOptions, type ReaddirResult, type ReasoningConfig, type ResolveUsesState, type ResponseSummary, type RuntimeByteStream, type RuntimeStreamErrorCode, type RuntimeStreamRequest, type RuntimeStreamResult, type RuntimeStreams, type ScheduledEffect, type SessionToolBinding, type SessionToolConfig, type SetEnvOptions, type SideConfig, type SkillFileInput, type SkillMetadata, type SkillsNamespace, type StopSessionOptions, type StructuredPrompt, type SubagentRegistryEntry, type SubagentToolConfig, type SubpromptConfig, THREAD_ENDPOINT_SYMBOL, THREAD_STREAM_REASONING_PARAM, type TenvRawShape, type TextContent, type TextPart, type ThreadEndpointHandler, type ThreadEndpointRouteParams, type ThreadMessageChunkEvent, type ThreadMetadata, type ThreadReasoningChunkEvent, type ThreadState, type ThreadUser, type Tool, type ToolArgs, type ToolArgsNode, type ToolArgsRawShape, type ToolAttachment, type ToolConfig, type ToolContent, type ToolDefinition, type ToolResult, type ToolTenvs, type ToolVariables, USER_ENDPOINT_SYMBOL, type UserClientInfo, type UserEndpointHandler, type UserEndpointRouteParams, type UserHandle, type UserIdentity, type UserState, type UserThreadSummary, type UserValueEntry, type UsesAwareExecute, type UsesConstrainedState, type VariableDefinition, type VariableType, type VirtualModuleLoader, type VirtualModuleRegistry, type WriteFileOptions, belongsToPackage, defineAgent, defineController, defineEffect, defineHook, defineModel, definePrompt, defineProvider, defineThreadEndpoint, defineTool, defineUserEndpoint, isPacked, isThreadEndpoint, isUserEndpoint, isVisibleInNamespace, mapReasoningLevel, providerConst, providerEnv, providerValue, validateToolName };
|
|
5678
|
+
export { type AgentDefinition, type AgentType, type AttachmentRef, type CodeExecution, type CodeExecutionError, type CodeExecutionLog, type CodeExecutionOptions, type CodeExecutionResult, type CodeExecutionStatus, type ContentPart, type Controller, type ControllerContext, type ControllerReturn, type CreateFetch, type CredentialGrant, type DefineToolOptions, type DefinitionLoader, ENDPOINT_ACCESS_SYMBOL, type Effect, type EffectDefinition, type EmptyUsesState, type EndpointAccess, type EndpointOptions, type EnvValueType, type ExecutionState, type FetchLike, type FileChunk, type FilePart, type FileRecord, type FileStats, type FileStorage, type FindResult, type GetMessagesOptions, type GlobalNamespaceContext, type GrepResult, type HookContext, type HookDefinition, type HookDefinitionOptions, type HookDefinitionResult, type HookMessage, type HookName, type HookSignatures, type HookToolCall, type HookToolResult, type ImageContent, type ImagePart, type ImageUrlPart, type InferProviderOptions, type InjectMessageInput, type InspectedRequest, type LLMMessage, type LLMProviderInterface, type ListUserThreadsOptions, type ListUserValuesOptions, type MarkedThreadEndpoint, type MarkedUserEndpoint, type Message, type MessageUpdates, type MessagesResult, type ModelCapabilities, type ModelDefinition, type ModelProvider, type NamespaceContext, type PackageSignature, type PackedExports, type PackedMeta, type PackedMetadata, type PackedNamespaceContext, type PromptContent, type PromptDefinition, type PromptEnvPart, type PromptIncludePart, type PromptInput, type PromptPart, type PromptTextPart, type PromptToolConfig, type ProviderAssistantMessage, type ProviderAttachment, type ProviderConfigSlot, type ProviderConfigSlots, type ProviderConfigValueSource, type ProviderDefinition, ProviderError, type ProviderErrorCode, type ProviderExecutedToolResult, type ProviderFactory, type ProviderFactoryConfig, type ProviderFactoryWithOptions, type ProviderFinishReason, type ProviderGeneratedImage, type ProviderInstance, type ProviderMessage, type ProviderMessageContent, type ProviderMethodOverrides, type ProviderModelInfo, type ProviderModelsPage, type ProviderModelsQuery, type ProviderOverride, type ProviderOverrideContext, type ProviderReasoningDetail, type ProviderRequest, type ProviderResponse, type ProviderStreamChunk, type ProviderSyncOverride, type ProviderSystemMessage, type ProviderTool, type ProviderToolCallPart, type ProviderToolMessage, type ProviderToolResultContent, type ProviderUsage, type ProviderUsagePricing, type ProviderUserMessage, type ProviderWebSearchResult, type QueueMessageInput, type ReadFileStreamOptions, type ReaddirResult, type ReasoningConfig, type ResolveUsesState, type ResponseSummary, type RuntimeByteStream, type RuntimeStreamErrorCode, type RuntimeStreamRequest, type RuntimeStreamResult, type RuntimeStreams, type ScheduledEffect, type SessionToolBinding, type SessionToolConfig, type SetEnvOptions, type SideConfig, type SkillFileInput, type SkillMetadata, type SkillsNamespace, type StopSessionOptions, type StructuredPrompt, type SubagentRegistryEntry, type SubagentToolConfig, type SubpromptConfig, THREAD_ENDPOINT_SYMBOL, THREAD_STREAM_REASONING_PARAM, type TenvRawShape, type TextContent, type TextPart, type ThreadEndpointAuth, type ThreadEndpointHandler, type ThreadEndpointRouteParams, type ThreadMessageChunkEvent, type ThreadMetadata, type ThreadReasoningChunkEvent, type ThreadState, type ThreadUser, type Tool, type ToolArgs, type ToolArgsNode, type ToolArgsRawShape, type ToolAttachment, type ToolConfig, type ToolContent, type ToolDefinition, type ToolResult, type ToolTenvs, type ToolVariables, USER_ENDPOINT_SYMBOL, type UserClientInfo, type UserEndpointHandler, type UserEndpointRouteParams, type UserHandle, type UserIdentity, type UserState, type UserThreadSummary, type UserValueEntry, type UsesAwareExecute, type UsesConstrainedState, type VariableDefinition, type VariableType, type VirtualModuleLoader, type VirtualModuleRegistry, type WriteFileOptions, belongsToPackage, defineAgent, defineController, defineEffect, defineHook, defineModel, definePrompt, defineProvider, defineThreadEndpoint, defineTool, defineUserEndpoint, getEndpointAccess, isPacked, isThreadEndpoint, isUserEndpoint, isVisibleInNamespace, mapReasoningLevel, providerConst, providerEnv, providerValue, validateToolName };
|
package/dist/index.js
CHANGED
|
@@ -355,17 +355,30 @@ function defineAgent(options) {
|
|
|
355
355
|
var THREAD_STREAM_REASONING_PARAM = "reasoning";
|
|
356
356
|
|
|
357
357
|
// src/endpoints.ts
|
|
358
|
+
var ENDPOINT_ACCESS_SYMBOL = Symbol.for("standardagents.endpointAccess");
|
|
359
|
+
function getEndpointAccess(value) {
|
|
360
|
+
if ((typeof value === "function" || typeof value === "object" && value !== null) && value[ENDPOINT_ACCESS_SYMBOL] === "public") {
|
|
361
|
+
return "public";
|
|
362
|
+
}
|
|
363
|
+
return "authenticated";
|
|
364
|
+
}
|
|
358
365
|
var THREAD_ENDPOINT_SYMBOL = Symbol.for("standardagents.threadEndpoint");
|
|
359
366
|
function isThreadEndpoint(controller) {
|
|
360
367
|
return THREAD_ENDPOINT_SYMBOL in controller && controller[THREAD_ENDPOINT_SYMBOL] === true;
|
|
361
368
|
}
|
|
362
|
-
function defineController(controller) {
|
|
369
|
+
function defineController(controller, options) {
|
|
370
|
+
if (options?.access) {
|
|
371
|
+
controller[ENDPOINT_ACCESS_SYMBOL] = options.access;
|
|
372
|
+
}
|
|
363
373
|
return controller;
|
|
364
374
|
}
|
|
365
|
-
function defineThreadEndpoint(handler) {
|
|
375
|
+
function defineThreadEndpoint(handler, options) {
|
|
366
376
|
const markedHandler = handler;
|
|
367
377
|
markedHandler[THREAD_ENDPOINT_SYMBOL] = true;
|
|
368
378
|
markedHandler.__handler = handler;
|
|
379
|
+
if (options?.access) {
|
|
380
|
+
markedHandler[ENDPOINT_ACCESS_SYMBOL] = options.access;
|
|
381
|
+
}
|
|
369
382
|
return markedHandler;
|
|
370
383
|
}
|
|
371
384
|
|
|
@@ -432,6 +445,7 @@ function isVisibleInNamespace(metadata, namespace, isEntryPoint = false) {
|
|
|
432
445
|
return isOwnPackage || hasPkg && isEntryPoint;
|
|
433
446
|
}
|
|
434
447
|
export {
|
|
448
|
+
ENDPOINT_ACCESS_SYMBOL,
|
|
435
449
|
ProviderError,
|
|
436
450
|
THREAD_ENDPOINT_SYMBOL,
|
|
437
451
|
THREAD_STREAM_REASONING_PARAM,
|
|
@@ -447,6 +461,7 @@ export {
|
|
|
447
461
|
defineThreadEndpoint,
|
|
448
462
|
defineTool,
|
|
449
463
|
defineUserEndpoint,
|
|
464
|
+
getEndpointAccess,
|
|
450
465
|
isPacked,
|
|
451
466
|
isThreadEndpoint,
|
|
452
467
|
isUserEndpoint,
|