@standardagents/spec 0.29.1 → 0.30.0
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 +286 -7
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -699,6 +699,258 @@ declare function defineEffect<State = ThreadState, Args extends ToolArgs = ToolA
|
|
|
699
699
|
*/
|
|
700
700
|
declare function defineEffect<State = ThreadState>(description: string, handler: Effect<State, null>): EffectDefinition<State, null>;
|
|
701
701
|
|
|
702
|
+
/**
|
|
703
|
+
* User scope types for Standard Agents.
|
|
704
|
+
*
|
|
705
|
+
* A user is a first-class scope owned by a runtime principal: durable values,
|
|
706
|
+
* packaged HTTP endpoints, an event stream, and credential grants. Threads
|
|
707
|
+
* reference users; these surfaces are addressable independently of any thread.
|
|
708
|
+
*
|
|
709
|
+
* Specification: https://standardagentspec.com/0.1.0/specification/users
|
|
710
|
+
*
|
|
711
|
+
* @module
|
|
712
|
+
*/
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* The identity record of a user — identity fields only, never credentials.
|
|
716
|
+
*
|
|
717
|
+
* This is the same record {@link ThreadState.user} resolves for a thread's
|
|
718
|
+
* owner. A runtime MUST resolve every authenticated request to a stable user
|
|
719
|
+
* id; a runtime with exactly one principal resolves all requests to a single
|
|
720
|
+
* constant user id.
|
|
721
|
+
*/
|
|
722
|
+
type UserIdentity = ThreadUser;
|
|
723
|
+
/**
|
|
724
|
+
* A client attached to the user event stream, as reported to user lifecycle
|
|
725
|
+
* hooks. `kind` is a client-declared label (for example `"cli"`, `"web"`).
|
|
726
|
+
*/
|
|
727
|
+
interface UserClientInfo {
|
|
728
|
+
id: string;
|
|
729
|
+
kind?: string;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Options for {@link UserState.listValues}.
|
|
733
|
+
*/
|
|
734
|
+
interface ListUserValuesOptions {
|
|
735
|
+
prefix?: string;
|
|
736
|
+
limit?: number;
|
|
737
|
+
offset?: number;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* One durable user value entry.
|
|
741
|
+
*/
|
|
742
|
+
interface UserValueEntry {
|
|
743
|
+
key: string;
|
|
744
|
+
value: unknown;
|
|
745
|
+
/** Last-write timestamp (milliseconds since epoch). */
|
|
746
|
+
updated_at: number;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Options for {@link UserState.listThreads}.
|
|
750
|
+
*/
|
|
751
|
+
interface ListUserThreadsOptions {
|
|
752
|
+
agentId?: string;
|
|
753
|
+
limit?: number;
|
|
754
|
+
offset?: number;
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Registry metadata for one of a user's threads.
|
|
758
|
+
*/
|
|
759
|
+
interface UserThreadSummary {
|
|
760
|
+
id: string;
|
|
761
|
+
agent_id: string;
|
|
762
|
+
tags: string[];
|
|
763
|
+
/** Creation timestamp (microseconds since epoch). */
|
|
764
|
+
created_at: number;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* The user scope surface provided to user endpoints and user lifecycle hooks.
|
|
768
|
+
*
|
|
769
|
+
* The runtime serializes user endpoint executions and
|
|
770
|
+
* {@link UserHandle.call} invocations per user: at most one executes at a
|
|
771
|
+
* time, and each observes the completed writes of all prior executions for
|
|
772
|
+
* that user. This is the atomicity guarantee that makes user endpoints the
|
|
773
|
+
* designated home for quotas, leases, counters, and registries. Value access
|
|
774
|
+
* outside user endpoints (thread-side reads/writes) is NOT serialized.
|
|
775
|
+
*/
|
|
776
|
+
interface UserState {
|
|
777
|
+
/** The user this scope belongs to. */
|
|
778
|
+
userId: string;
|
|
779
|
+
/** Identity fields (never credentials). */
|
|
780
|
+
identity(): Promise<UserIdentity>;
|
|
781
|
+
/** Read a durable user-scoped value. */
|
|
782
|
+
getValue<T = unknown>(key: string): Promise<T | null>;
|
|
783
|
+
/** Write a durable user-scoped value (`null`/`undefined` deletes). */
|
|
784
|
+
setValue(key: string, value: unknown): Promise<void>;
|
|
785
|
+
/** List durable user-scoped values. */
|
|
786
|
+
listValues(options?: ListUserValuesOptions): Promise<{
|
|
787
|
+
entries: UserValueEntry[];
|
|
788
|
+
total: number;
|
|
789
|
+
}>;
|
|
790
|
+
/**
|
|
791
|
+
* Resolve a user-scoped environment property. Rejects when the property is
|
|
792
|
+
* not defined for this user.
|
|
793
|
+
*/
|
|
794
|
+
env(name: string): Promise<string>;
|
|
795
|
+
/**
|
|
796
|
+
* Broadcast an event to every socket attached to this user's event stream
|
|
797
|
+
* (`{runtime_prefix}/users/me/stream`). Delivery is at-most-once and
|
|
798
|
+
* live-only: the stream carries no history and no acknowledgements.
|
|
799
|
+
* Packages SHOULD namespace event names (`my_package.thing_changed`).
|
|
800
|
+
*/
|
|
801
|
+
emit(event: string, data?: unknown): void;
|
|
802
|
+
/** Registry metadata for the user's threads. */
|
|
803
|
+
listThreads(options?: ListUserThreadsOptions): Promise<{
|
|
804
|
+
threads: UserThreadSummary[];
|
|
805
|
+
total: number;
|
|
806
|
+
}>;
|
|
807
|
+
/**
|
|
808
|
+
* Privileged fetch through a named credential grant. The runtime injects
|
|
809
|
+
* the credential per the grant's policy; packaged code never sees the
|
|
810
|
+
* secret material. Rejects for destinations outside the grant's `origins`
|
|
811
|
+
* and callers outside its `allow` policy.
|
|
812
|
+
*/
|
|
813
|
+
fetch(grant: string, input: string | URL, init?: RequestInit): Promise<Response>;
|
|
814
|
+
/**
|
|
815
|
+
* Raise one of this user's threads at rest — the same materialization
|
|
816
|
+
* thread endpoints receive (`state.execution` is `null`). Rejects for
|
|
817
|
+
* threads not belonging to the user. Operations on the resolved state
|
|
818
|
+
* execute in the thread scope; the user-scope serialization guarantee does
|
|
819
|
+
* not extend across them. A reentrant user-scope invocation
|
|
820
|
+
* (`state.user()` → `call()`) made from code reached through `thread()`
|
|
821
|
+
* within the same user execution MUST fail rather than deadlock.
|
|
822
|
+
*/
|
|
823
|
+
thread(threadId: string): Promise<ThreadState>;
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* The user handle resolved by {@link ThreadState.user} — the identity fields
|
|
827
|
+
* of {@link UserIdentity} plus scoped capabilities. Additive to the historic
|
|
828
|
+
* identity-only return value.
|
|
829
|
+
*/
|
|
830
|
+
interface UserHandle extends ThreadUser {
|
|
831
|
+
/**
|
|
832
|
+
* Invoke a named user endpoint for the thread's user under the user
|
|
833
|
+
* scope's serialization guarantee. The runtime MUST NOT require network
|
|
834
|
+
* self-addressing to fulfill this call. Rejects for user-less threads.
|
|
835
|
+
*
|
|
836
|
+
* @param endpoint - The user endpoint path (e.g. `"standardcode/lease_acquire"`)
|
|
837
|
+
* @param payload - JSON-serializable request body (POSTed to the handler)
|
|
838
|
+
*/
|
|
839
|
+
call(endpoint: string, payload?: unknown): Promise<Response>;
|
|
840
|
+
/** Read a durable user value (unserialized convenience access). */
|
|
841
|
+
getValue<T = unknown>(key: string): Promise<T | null>;
|
|
842
|
+
/** Write a durable user value (unserialized convenience access). */
|
|
843
|
+
setValue(key: string, value: unknown): Promise<void>;
|
|
844
|
+
/** Broadcast on the user event stream. */
|
|
845
|
+
emit(event: string, data?: unknown): void;
|
|
846
|
+
/** Privileged fetch through a named credential grant. */
|
|
847
|
+
fetch(grant: string, input: string | URL, init?: RequestInit): Promise<Response>;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* A named, user-scoped credential with a declared use policy.
|
|
851
|
+
*
|
|
852
|
+
* Secret material is write-only: it is set through runtime credential APIs
|
|
853
|
+
* and is never readable by packaged code, models, or clients. Only
|
|
854
|
+
* `metadata` and grant existence are inspectable. Deleting a grant fails
|
|
855
|
+
* subsequent `fetch` calls with an error distinguishable from a network
|
|
856
|
+
* failure.
|
|
857
|
+
*/
|
|
858
|
+
interface CredentialGrant {
|
|
859
|
+
/** Grant name, e.g. `"github"`. */
|
|
860
|
+
name: string;
|
|
861
|
+
/** How the credential is applied to requests. */
|
|
862
|
+
kind: 'bearer' | 'header' | 'query' | 'basic' | 'signing';
|
|
863
|
+
/** Allowed destinations: exact origins or suffix wildcards (`*.example.com`). */
|
|
864
|
+
origins: string[];
|
|
865
|
+
/**
|
|
866
|
+
* Injection template. `format` may reference `SECRET`, which expands
|
|
867
|
+
* runtime-side after policy checks (e.g. `{ header: 'Authorization',
|
|
868
|
+
* format: 'token SECRET' }`).
|
|
869
|
+
*/
|
|
870
|
+
inject?: {
|
|
871
|
+
header?: string;
|
|
872
|
+
format?: string;
|
|
873
|
+
query?: string;
|
|
874
|
+
};
|
|
875
|
+
/**
|
|
876
|
+
* Which packaged resources may use this grant. An absent `allow` denies
|
|
877
|
+
* all callers.
|
|
878
|
+
*/
|
|
879
|
+
allow?: {
|
|
880
|
+
tools?: string[];
|
|
881
|
+
endpoints?: string[];
|
|
882
|
+
userEndpoints?: string[];
|
|
883
|
+
agents?: string[];
|
|
884
|
+
};
|
|
885
|
+
/** Non-secret metadata: account label, scopes, expiry. */
|
|
886
|
+
metadata?: Record<string, unknown>;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Symbol used to identify user endpoint handlers.
|
|
890
|
+
*
|
|
891
|
+
* When a handler is created with {@link defineUserEndpoint}, it's marked with
|
|
892
|
+
* this symbol so the runtime can detect it and execute it in the user scope
|
|
893
|
+
* with a UserState.
|
|
894
|
+
*/
|
|
895
|
+
declare const USER_ENDPOINT_SYMBOL: unique symbol;
|
|
896
|
+
/**
|
|
897
|
+
* Route parameters captured from `[param]` and `[*]` segments of a user
|
|
898
|
+
* endpoint file path.
|
|
899
|
+
*/
|
|
900
|
+
type UserEndpointRouteParams = Record<string, string>;
|
|
901
|
+
/**
|
|
902
|
+
* User endpoint handler function.
|
|
903
|
+
*
|
|
904
|
+
* Receives the HTTP request and the UserState for the addressed user.
|
|
905
|
+
* `me` routes resolve the authenticated caller; `users/{id}` routes are
|
|
906
|
+
* served to callers authorized to administer that user.
|
|
907
|
+
*/
|
|
908
|
+
type UserEndpointHandler = (req: Request, user: UserState, params: UserEndpointRouteParams) => Response | Promise<Response>;
|
|
909
|
+
/**
|
|
910
|
+
* A handler that has been marked as a user endpoint.
|
|
911
|
+
*/
|
|
912
|
+
interface MarkedUserEndpoint {
|
|
913
|
+
[USER_ENDPOINT_SYMBOL]: true;
|
|
914
|
+
__handler: UserEndpointHandler;
|
|
915
|
+
(req: Request, user: UserState, params: UserEndpointRouteParams): Response | Promise<Response>;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Type guard to check if a value is a marked user endpoint.
|
|
919
|
+
*/
|
|
920
|
+
declare function isUserEndpoint(value: unknown): value is MarkedUserEndpoint;
|
|
921
|
+
/**
|
|
922
|
+
* Define a user-scoped endpoint.
|
|
923
|
+
*
|
|
924
|
+
* User endpoint files live in the project or package `users/` directory and
|
|
925
|
+
* are file-routed beneath `{runtime_prefix}/users/me/` with the same rules
|
|
926
|
+
* as thread endpoints (method suffixes, nested directories, `[param]` and
|
|
927
|
+
* `[*]` segments). Nested directories namespace endpoints; packages SHOULD
|
|
928
|
+
* root their endpoints in a package-named directory.
|
|
929
|
+
*
|
|
930
|
+
* Handlers execute in the user scope under per-user serialization: at most
|
|
931
|
+
* one user endpoint (or {@link UserHandle.call}) executes at a time for a
|
|
932
|
+
* given user, and each observes all prior completed writes.
|
|
933
|
+
*
|
|
934
|
+
* @example
|
|
935
|
+
* ```typescript
|
|
936
|
+
* // users/quota.post.ts → POST {runtime_prefix}/users/me/quota
|
|
937
|
+
* import { defineUserEndpoint } from '@standardagents/spec';
|
|
938
|
+
*
|
|
939
|
+
* export default defineUserEndpoint(async (req, user) => {
|
|
940
|
+
* const used = (await user.getValue<number>('quota.used')) ?? 0;
|
|
941
|
+
* const limit = Number(await user.getValue('quota.limit')) || 0;
|
|
942
|
+
* const { amount } = await req.json() as { amount: number };
|
|
943
|
+
* if (used + amount > limit) {
|
|
944
|
+
* return Response.json({ ok: false, used, limit }, { status: 429 });
|
|
945
|
+
* }
|
|
946
|
+
* await user.setValue('quota.used', used + amount);
|
|
947
|
+
* user.emit('quota_changed', { used: used + amount, limit });
|
|
948
|
+
* return Response.json({ ok: true, used: used + amount, limit });
|
|
949
|
+
* });
|
|
950
|
+
* ```
|
|
951
|
+
*/
|
|
952
|
+
declare function defineUserEndpoint(handler: UserEndpointHandler): MarkedUserEndpoint;
|
|
953
|
+
|
|
702
954
|
/**
|
|
703
955
|
* Agent Skills — instance-global skill store types.
|
|
704
956
|
*
|
|
@@ -1943,20 +2195,24 @@ interface ThreadState {
|
|
|
1943
2195
|
total: number;
|
|
1944
2196
|
}>;
|
|
1945
2197
|
/**
|
|
1946
|
-
* The
|
|
1947
|
-
*
|
|
2198
|
+
* The user this thread belongs to, or `null` when the thread has no
|
|
2199
|
+
* associated user (e.g. unauthenticated local development).
|
|
1948
2200
|
*
|
|
1949
|
-
*
|
|
1950
|
-
*
|
|
1951
|
-
*
|
|
2201
|
+
* Resolves a {@link UserHandle}: the identity fields (never credentials)
|
|
2202
|
+
* plus user-scope capabilities — `call()` into packaged user endpoints
|
|
2203
|
+
* under the user scope's serialization guarantee, durable user values,
|
|
2204
|
+
* `emit()` on the user event stream, and privileged `fetch()` through
|
|
2205
|
+
* credential grants.
|
|
1952
2206
|
*
|
|
1953
2207
|
* @example
|
|
1954
2208
|
* ```typescript
|
|
1955
2209
|
* const user = await state.user();
|
|
1956
2210
|
* if (user?.email) await notifyBillingService(user.email);
|
|
2211
|
+
* // Atomic user-scope logic (quotas, leases) goes through call():
|
|
2212
|
+
* await user?.call('standardcode/lease_acquire', { thread_id: state.threadId });
|
|
1957
2213
|
* ```
|
|
1958
2214
|
*/
|
|
1959
|
-
user(): Promise<
|
|
2215
|
+
user(): Promise<UserHandle | null>;
|
|
1960
2216
|
/**
|
|
1961
2217
|
* The instance-global Agent Skills library (https://agentskills.io format).
|
|
1962
2218
|
*
|
|
@@ -4318,6 +4574,29 @@ interface HookSignatures<State = ThreadState, Msg = HookMessage, ToolCall = Hook
|
|
|
4318
4574
|
* @param toolResult - The tool's result (`status` is `'success'` or `'error'`)
|
|
4319
4575
|
*/
|
|
4320
4576
|
tool_call_done: (state: State, toolCall: ToolCall, toolResult: ToolResult) => Promise<void>;
|
|
4577
|
+
/**
|
|
4578
|
+
* Called when a socket attaches to the user's event stream
|
|
4579
|
+
* (`{runtime_prefix}/users/me/stream`).
|
|
4580
|
+
*
|
|
4581
|
+
* @param user - User scope state
|
|
4582
|
+
* @param client - The attached client's id and self-declared kind
|
|
4583
|
+
*/
|
|
4584
|
+
user_client_attached: (user: UserState, client: UserClientInfo) => Promise<void>;
|
|
4585
|
+
/**
|
|
4586
|
+
* Called when a socket detaches from the user's event stream.
|
|
4587
|
+
*
|
|
4588
|
+
* @param user - User scope state
|
|
4589
|
+
* @param client - The detached client's id and self-declared kind
|
|
4590
|
+
*/
|
|
4591
|
+
user_client_detached: (user: UserState, client: UserClientInfo) => Promise<void>;
|
|
4592
|
+
/**
|
|
4593
|
+
* Called after a durable user value changes, regardless of the writer
|
|
4594
|
+
* (user endpoint, thread-side handle, or REST).
|
|
4595
|
+
*
|
|
4596
|
+
* @param user - User scope state
|
|
4597
|
+
* @param key - The key that changed
|
|
4598
|
+
*/
|
|
4599
|
+
user_value_changed: (user: UserState, key: string) => Promise<void>;
|
|
4321
4600
|
}
|
|
4322
4601
|
/**
|
|
4323
4602
|
* Valid hook names.
|
|
@@ -5214,4 +5493,4 @@ interface PackedExports {
|
|
|
5214
5493
|
__meta: PackedMeta;
|
|
5215
5494
|
}
|
|
5216
5495
|
|
|
5217
|
-
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 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 MarkedThreadEndpoint, 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, type UsesAwareExecute, type UsesConstrainedState, type VariableDefinition, type VariableType, type VirtualModuleLoader, type VirtualModuleRegistry, type WriteFileOptions, belongsToPackage, defineAgent, defineController, defineEffect, defineHook, defineModel, definePrompt, defineProvider, defineThreadEndpoint, defineTool, isPacked, isThreadEndpoint, isVisibleInNamespace, mapReasoningLevel, providerConst, providerEnv, providerValue, validateToolName };
|
|
5496
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -369,6 +369,18 @@ function defineThreadEndpoint(handler) {
|
|
|
369
369
|
return markedHandler;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
// src/users.ts
|
|
373
|
+
var USER_ENDPOINT_SYMBOL = Symbol.for("standardagents.userEndpoint");
|
|
374
|
+
function isUserEndpoint(value) {
|
|
375
|
+
return typeof value === "function" && USER_ENDPOINT_SYMBOL in value && value[USER_ENDPOINT_SYMBOL] === true;
|
|
376
|
+
}
|
|
377
|
+
function defineUserEndpoint(handler) {
|
|
378
|
+
const marked = handler;
|
|
379
|
+
marked[USER_ENDPOINT_SYMBOL] = true;
|
|
380
|
+
marked.__handler = handler;
|
|
381
|
+
return marked;
|
|
382
|
+
}
|
|
383
|
+
|
|
372
384
|
// src/providers.ts
|
|
373
385
|
var ProviderError = class extends Error {
|
|
374
386
|
constructor(message, code, statusCode, retryAfter, options) {
|
|
@@ -423,6 +435,7 @@ export {
|
|
|
423
435
|
ProviderError,
|
|
424
436
|
THREAD_ENDPOINT_SYMBOL,
|
|
425
437
|
THREAD_STREAM_REASONING_PARAM,
|
|
438
|
+
USER_ENDPOINT_SYMBOL,
|
|
426
439
|
belongsToPackage,
|
|
427
440
|
defineAgent,
|
|
428
441
|
defineController,
|
|
@@ -433,8 +446,10 @@ export {
|
|
|
433
446
|
defineProvider,
|
|
434
447
|
defineThreadEndpoint,
|
|
435
448
|
defineTool,
|
|
449
|
+
defineUserEndpoint,
|
|
436
450
|
isPacked,
|
|
437
451
|
isThreadEndpoint,
|
|
452
|
+
isUserEndpoint,
|
|
438
453
|
isVisibleInNamespace,
|
|
439
454
|
mapReasoningLevel,
|
|
440
455
|
providerConst,
|