@standardagents/spec 0.44.0 → 0.45.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 +12 -11
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -404,11 +404,11 @@ type ResolveUsesState<Uses extends readonly string[]> = IsEmptyArray<Uses> exten
|
|
|
404
404
|
* are constrained to only the declared tools. When `uses` is not declared or
|
|
405
405
|
* is a regular string[], any tool name is allowed (backward compatible).
|
|
406
406
|
*
|
|
407
|
-
* @template
|
|
407
|
+
* @template _State - Reserved for compatibility.
|
|
408
408
|
* @template Args - Tool arguments schema
|
|
409
409
|
* @template Uses - Readonly array of allowed tool names
|
|
410
410
|
*/
|
|
411
|
-
type UsesAwareExecute<
|
|
411
|
+
type UsesAwareExecute<_State, Args extends ToolArgs | null, Uses extends readonly string[]> = Args extends ToolArgs ? (state: ResolveUsesState<Uses>, args: z.infer<Args>) => Promise<ToolResult> : (state: ResolveUsesState<Uses>) => Promise<ToolResult>;
|
|
412
412
|
type ToolAnnotations = Record<string, unknown>;
|
|
413
413
|
/**
|
|
414
414
|
* Options for defining a tool.
|
|
@@ -783,7 +783,7 @@ interface LLMProviderInterface {
|
|
|
783
783
|
* @param modelId - Optional filter to get tools available for a specific model
|
|
784
784
|
* @returns Record of tool name to tool definition (sync or async)
|
|
785
785
|
*/
|
|
786
|
-
getTools?(modelId?: string): Record<string, ToolDefinition<
|
|
786
|
+
getTools?(modelId?: string): Record<string, ToolDefinition<unknown, ToolArgs | null, ToolTenvs | null>> | Promise<Record<string, ToolDefinition<unknown, ToolArgs | null, ToolTenvs | null>>>;
|
|
787
787
|
/**
|
|
788
788
|
* Get an icon for this provider or a specific model.
|
|
789
789
|
* Optional - providers may implement this to provide UI icons.
|
|
@@ -4206,6 +4206,7 @@ interface PromptToolConfig {
|
|
|
4206
4206
|
options?: Record<string, unknown>;
|
|
4207
4207
|
}
|
|
4208
4208
|
/**
|
|
4209
|
+
* @template _T - Reserved for compatibility.
|
|
4209
4210
|
* @deprecated Removed in 0.2.0 — subagent relationships are no longer
|
|
4210
4211
|
* declared in a prompt's `tools` array. Declare them on the owning side's
|
|
4211
4212
|
* `subagents` array instead (see `SubagentRelationship`): the tool's `name`
|
|
@@ -4217,7 +4218,7 @@ interface PromptToolConfig {
|
|
|
4217
4218
|
* lifecycle tools (`subagents`, `subagent_create`, `subagent_message`).
|
|
4218
4219
|
* https://standardagentspec.com/0.2.0/getting-started/changelog
|
|
4219
4220
|
*/
|
|
4220
|
-
type SubagentToolConfig<
|
|
4221
|
+
type SubagentToolConfig<_T extends string = string> = never;
|
|
4221
4222
|
/**
|
|
4222
4223
|
* Reasoning configuration for models that support extended thinking.
|
|
4223
4224
|
* Applies to models like OpenAI o1/o3, Anthropic Claude with extended thinking,
|
|
@@ -4610,12 +4611,12 @@ interface SubagentRelationship<Agent extends string = StandardAgentSpec.Agents>
|
|
|
4610
4611
|
*/
|
|
4611
4612
|
readonly scopedEnv?: readonly string[];
|
|
4612
4613
|
/**
|
|
4613
|
-
* Property from `subagent_create`
|
|
4614
|
+
* Property from `subagent_create.arguments` used as the initial user
|
|
4614
4615
|
* message when spawning an instance.
|
|
4615
4616
|
*/
|
|
4616
4617
|
readonly initUserMessageProperty?: StandardAgentSpec.SchemaFields<Agent>;
|
|
4617
4618
|
/**
|
|
4618
|
-
* Property from `subagent_create`
|
|
4619
|
+
* Property from `subagent_create.arguments` containing attachment path(s)
|
|
4619
4620
|
* to include with the initial message.
|
|
4620
4621
|
*/
|
|
4621
4622
|
readonly initAttachmentsProperty?: StandardAgentSpec.SchemaFields<Agent>;
|
|
@@ -5353,22 +5354,22 @@ interface ThreadEndpointAuth {
|
|
|
5353
5354
|
*/
|
|
5354
5355
|
declare const THREAD_ENDPOINT_SYMBOL: unique symbol;
|
|
5355
5356
|
/**
|
|
5356
|
-
* A
|
|
5357
|
+
* A thread handler marked for ThreadState injection.
|
|
5357
5358
|
*
|
|
5358
5359
|
* The runtime detects this marker and wraps the handler with ThreadState injection.
|
|
5359
5360
|
* The `__handler` property contains the original handler function that expects
|
|
5360
5361
|
* `(req: Request, state: ThreadState)` arguments.
|
|
5361
5362
|
*/
|
|
5362
|
-
interface MarkedThreadEndpoint extends
|
|
5363
|
+
interface MarkedThreadEndpoint extends ThreadEndpointHandler {
|
|
5363
5364
|
/** Marker symbol indicating this is a thread endpoint */
|
|
5364
5365
|
[THREAD_ENDPOINT_SYMBOL]: true;
|
|
5365
5366
|
/** The original handler function before wrapping */
|
|
5366
5367
|
__handler: ThreadEndpointHandler;
|
|
5367
5368
|
}
|
|
5368
5369
|
/**
|
|
5369
|
-
*
|
|
5370
|
+
* Check whether a value carries a thread handler marker.
|
|
5370
5371
|
*/
|
|
5371
|
-
declare function isThreadEndpoint(controller:
|
|
5372
|
+
declare function isThreadEndpoint(controller: unknown): controller is MarkedThreadEndpoint;
|
|
5372
5373
|
/**
|
|
5373
5374
|
* Virtual module loader function.
|
|
5374
5375
|
*
|
|
@@ -5535,7 +5536,7 @@ declare function defineController(controller: Controller, options?: EndpointOpti
|
|
|
5535
5536
|
*
|
|
5536
5537
|
* @param handler - The handler function receiving request, ThreadState, route params, and authentication context
|
|
5537
5538
|
* @param options - Endpoint options, including the access level
|
|
5538
|
-
* @returns
|
|
5539
|
+
* @returns The marked original handler for runtime registration
|
|
5539
5540
|
*
|
|
5540
5541
|
* @example
|
|
5541
5542
|
* ```typescript
|
package/dist/index.js
CHANGED
|
@@ -723,27 +723,29 @@ var THREAD_STREAM_REASONING_PARAM = "reasoning";
|
|
|
723
723
|
// src/endpoints.ts
|
|
724
724
|
var ENDPOINT_ACCESS_SYMBOL = Symbol.for("standardagents.endpointAccess");
|
|
725
725
|
function getEndpointAccess(value) {
|
|
726
|
-
if (
|
|
727
|
-
|
|
726
|
+
if (typeof value === "function" || typeof value === "object" && value !== null) {
|
|
727
|
+
const access = Reflect.get(value, ENDPOINT_ACCESS_SYMBOL);
|
|
728
|
+
if (access === "public") return "public";
|
|
728
729
|
}
|
|
729
730
|
return "authenticated";
|
|
730
731
|
}
|
|
731
732
|
var THREAD_ENDPOINT_SYMBOL = Symbol.for("standardagents.threadEndpoint");
|
|
732
733
|
function isThreadEndpoint(controller) {
|
|
733
|
-
return THREAD_ENDPOINT_SYMBOL in controller && controller[THREAD_ENDPOINT_SYMBOL] === true;
|
|
734
|
+
return typeof controller === "function" && THREAD_ENDPOINT_SYMBOL in controller && controller[THREAD_ENDPOINT_SYMBOL] === true;
|
|
734
735
|
}
|
|
735
736
|
function defineController(controller, options) {
|
|
736
737
|
if (options?.access) {
|
|
737
|
-
controller[ENDPOINT_ACCESS_SYMBOL]
|
|
738
|
+
Object.assign(controller, { [ENDPOINT_ACCESS_SYMBOL]: options.access });
|
|
738
739
|
}
|
|
739
740
|
return controller;
|
|
740
741
|
}
|
|
741
742
|
function defineThreadEndpoint(handler, options) {
|
|
742
|
-
const
|
|
743
|
-
|
|
744
|
-
|
|
743
|
+
const marker = {
|
|
744
|
+
[THREAD_ENDPOINT_SYMBOL]: true
|
|
745
|
+
};
|
|
746
|
+
const markedHandler = Object.assign(handler, marker, { __handler: handler });
|
|
745
747
|
if (options?.access) {
|
|
746
|
-
markedHandler[ENDPOINT_ACCESS_SYMBOL]
|
|
748
|
+
Object.assign(markedHandler, { [ENDPOINT_ACCESS_SYMBOL]: options.access });
|
|
747
749
|
}
|
|
748
750
|
return markedHandler;
|
|
749
751
|
}
|