@theoremjs/agents 0.3.4-next.433.gf6b4da5 → 0.3.4-next.452.gb2a8e30
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/README.md +1 -1
- package/esm/mod.d.ts +1 -1
- package/esm/mod.js +1 -1
- package/esm/src/kernel/mod.d.ts +1 -1
- package/esm/src/kernel/mod.js +1 -1
- package/esm/src/kernel/tools/activity-label.js +8 -2
- package/esm/src/kernel/tools/mod.d.ts +1 -1
- package/esm/src/kernel/tools/mod.js +1 -1
- package/esm/src/kernel/tools/remote.d.ts +5 -0
- package/esm/src/kernel/tools/remote.js +11 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -460,7 +460,7 @@ Named exports from the root barrel (same symbols hosts get from `@theoremjs/agen
|
|
|
460
460
|
| Schema | `PROFILE_FIELDS`, `PROFILE_GRAPH`, `PROFILE_TYPES`, `PROFILE_ID_MAX_CHARS`, `PROFILE_HANDLE_MAX_CHARS`, `EXTRA_FIELDS`, `REQUEST_FIELDS`, `API_EXPORTS`, `fieldMeta`, `catalogPathFor`, `DYNAMIC_FIELD_PARENTS`, `spineFacetsForProfileType`, `profileGraphFacet`, `ProfileGraphFacet`, `ProfileGraphFacetId`, `ProfileGraphEditor`, `ProfileGraphRole`, `THINKING_LEVELS`, `KEY_SLOT_NAME`, `isKeySlotName`, `MEDIA_INPUT_KINDS`, `MEDIA_INPUT_KIND_VALUES`, `MEDIA_WILDCARDS`, `ATTACHMENT_ACCEPT_MIMES`, `IMAGE_ATTACHMENT_ACCEPT_MIMES`, `VOICE_ACCEPT_MIMES`, `SUMMARY_MODES`, `STREAM_MODES`, `SPEECH_AUDIO_FORMATS`, `COMPACTION_METERS`, `COMPACTION_OUTCOMES`, `COMPACTION_TIMINGS`, `CACHE_MODES`, `CACHE_TTLS`, `TURN_STAGES`, `TURN_INJECT_STAGES`, `TURN_STOP_KINDS`, `CONTINUE_STOP_KINDS`, `TOOL_GATE_KINDS`, `AWAITING_USER_INPUT_KINDS`, `AWAITING_USER_INPUT_STATUS`, `TOOL_LOAD_TIERS`, `TOOL_ACCESS`, `TOOL_PERMISSION`, `TOOL_TYPES`, `AUTH_UNAUTHENTICATED_POLICIES`, `HTTP_METHODS`, `STUDIO_AUTH_TYPES`, `TOOL_AUTH_TYPES`, `AuthUnauthenticatedPolicy`, `CustomToolType`, `HttpMethod`, `StudioAuthType`, `ToolAccess`, `ToolAuthType`, `ToolPermission`, `ToolType`, `LIVE_ACTIVITY_HANDLINGS`, `LIVE_START_SENSITIVITIES`, `LIVE_END_SENSITIVITIES` |
|
|
461
461
|
| Scope | `KernelScope`, `createKernelScope`, `defaultKernelScope`, `KernelRegistry`, `createKernelRegistry` |
|
|
462
462
|
| Profiles | `ProfileDefinition`, `ProfileDefinitionBase`, `TextProfileDefinition`, `ImageProfileDefinition`, `SpeechProfileDefinition`, `LiveProfileDefinition`, `HostProfileDefinition`, `DecisionProfileDefinition`, `EmbeddingProfileDefinition`, `ProfileRegistry`, `createProfileRegistry`, `clearProfiles`, `defineProfile`, `getProfile`, `hasProfile`, `listProfiles`, `registerProfile`, `registerProfiles`, `projectProfile`, `resolveTurn`, `pickModel` |
|
|
463
|
-
| Tools | `ToolContext`, `GateReference`, `gateReferenceSchema`, `ToolRegistry`, `createToolRegistry`, `registerTool`, `registerTools`, `invokeTool`, `invokeToolStep`, `runTool`, `runToolStep`, `SettledToolCall`, `ToolCallResult`, `ToolStepCallResult`, `GATE_DECISIONS`, `GateDecision`, `askUserTool`, `registerHarnessTools`, `getTool`, `hasTool`, `requireTool`, `listTools`, `resetTools`, `formatToolResult`, `prepareTurnToolSnapshot`, `buildHttpToolTarget`, `executeHttpTool`, `executeMcpTool`, `parseMcpRpcResponse`, `isUnsupportedMcpProtocolError`, `MCP_PROTOCOL_VERSIONS`, `McpProtocolVersion`, `resolveToolAuth`, `credentialPlacement`, `withCredentialQuery`, `CredentialQuery`, `uncheckedOutput`, `UncheckedOutput` |
|
|
463
|
+
| Tools | `ToolContext`, `GateReference`, `gateReferenceSchema`, `ToolRegistry`, `createToolRegistry`, `registerTool`, `registerTools`, `invokeTool`, `invokeToolStep`, `runTool`, `runToolStep`, `SettledToolCall`, `ToolCallResult`, `ToolStepCallResult`, `GATE_DECISIONS`, `GateDecision`, `askUserTool`, `registerHarnessTools`, `getTool`, `hasTool`, `requireTool`, `listTools`, `resetTools`, `formatToolResult`, `prepareTurnToolSnapshot`, `buildHttpToolTarget`, `executeHttpTool`, `executeMcpTool`, `parseMcpRpcResponse`, `isUnsupportedMcpProtocolError`, `MCP_PROTOCOL_VERSIONS`, `mcpRequestMeta`, `McpProtocolVersion`, `resolveToolAuth`, `credentialPlacement`, `withCredentialQuery`, `CredentialQuery`, `uncheckedOutput`, `UncheckedOutput` |
|
|
464
464
|
| Structured | `SchemaRegistry`, `createSchemaRegistry`, `getStructured`, `registerStructured` |
|
|
465
465
|
| Stop / resume | `ProfileTurnBehaviourSpec`, `MediaTurnBehaviourSpec`, `ProfileTurnResumptionSpec`, `TurnContinueFrom`, `TurnStop`, `TurnStopKind`, `ContinueStopKind`, `StepLimitMode`, `CONTINUE_STOP_KINDS`, `AUTO_CONTINUE_DELAY_MS`, `DEFAULT_ALLOW_CONTINUE`, `DEFAULT_AUTO_CONTINUE`, `GenerationStopError`, `isContinueStopKind`, `isGenerationStopError`, `isResumeableStop`, `isUserCancelledStop`, `profileAllowsSteering`, `profileAllowsInject`, `profileTurnResumption`, `shouldAutoContinue`, `turnStopFromClientStreamEnd`, `turnStopFromInteractionStatus`, `turnStopFromOpenAiFinishReason` |
|
|
466
466
|
| Stages (target foundation) | `TURN_STAGES`, `TURN_INJECT_STAGES`, `STAGE_AFFORDANCES`, `STAGE_AFFORDANCE_MATRIX`, `TOOL_GATE_KINDS`, `AWAITING_USER_INPUT_KINDS`, `AWAITING_USER_INPUT_STATUS`, `applyStageResult`, `awaitingUserInputSchema`, `toolGateSchema`, `isTurnStage`, `isTurnInjectStage`, `isToolGateKind`, `isAwaitingUserInput`, `stageAllowsAffordance`, `stageEventFields`, `profileAllowsInject`, `StageAffordance`, `StageContext`, `StageResult`, `StageMutate`, `StageHandler`, `StageApplyInput`, `StageApplyOutput`, `StageApplyWarning`, `StageApplyWarningCode`, `StageEventExtra`, `AwaitingUserInput`, `ToolGate` — contract [`docs/contracts/stages.md`](https://github.com/masudl-hub/theoremai/blob/main/docs/contracts/stages.md) |
|
package/esm/mod.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export { GATE_DECISIONS, type GateDecision } from './src/kernel/tools/gate-answe
|
|
|
68
68
|
export type { MemoryToolExecutionOptions } from './src/kernel/tools/memory-execution.js';
|
|
69
69
|
export { createMemoryToolExecution } from './src/kernel/tools/memory-execution.js';
|
|
70
70
|
export type { CredentialQuery, McpProtocolVersion, McpRpcResponse, ToolRegistry, } from './src/kernel/tools/mod.js';
|
|
71
|
-
export { askUserTool, buildHttpToolTarget, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, formatToolResult, isUnsupportedMcpProtocolError, MCP_PROTOCOL_VERSIONS, parseMcpRpcResponse, prepareTurnToolSnapshot, registerHarnessTools, resolveToolAuth, UncheckedOutput, uncheckedOutput, withCredentialQuery, } from './src/kernel/tools/mod.js';
|
|
71
|
+
export { askUserTool, buildHttpToolTarget, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, formatToolResult, isUnsupportedMcpProtocolError, MCP_PROTOCOL_VERSIONS, mcpRequestMeta, parseMcpRpcResponse, prepareTurnToolSnapshot, registerHarnessTools, resolveToolAuth, UncheckedOutput, uncheckedOutput, withCredentialQuery, } from './src/kernel/tools/mod.js';
|
|
72
72
|
export type { BeginToolOperationResult, PageToolDispatch, PageToolExecution, SavedToolInvocation, TerminalToolEvent, ToolExecutionCoordinator, ToolOperationClaim, ToolOperationIdentity, ToolOperationOutcome, ToolOperationUncertainty, } from './src/kernel/tools/operation.js';
|
|
73
73
|
export { savedToolInvocationSchema, toolInvocationHash, toolOperationOutcomeSchema, } from './src/kernel/tools/operation.js';
|
|
74
74
|
export type { SettledToolCall, ToolCallResult, ToolStepCallResult, } from './src/kernel/tools/run.js';
|
package/esm/mod.js
CHANGED
|
@@ -42,7 +42,7 @@ export { AUTO_CONTINUE_DELAY_MS, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE,
|
|
|
42
42
|
export { authorizeToolReplay } from './src/kernel/tools/execute.js';
|
|
43
43
|
export { GATE_DECISIONS } from './src/kernel/tools/gate-answer.js';
|
|
44
44
|
export { createMemoryToolExecution } from './src/kernel/tools/memory-execution.js';
|
|
45
|
-
export { askUserTool, buildHttpToolTarget, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, formatToolResult, isUnsupportedMcpProtocolError, MCP_PROTOCOL_VERSIONS, parseMcpRpcResponse, prepareTurnToolSnapshot, registerHarnessTools, resolveToolAuth, UncheckedOutput, uncheckedOutput, withCredentialQuery, } from './src/kernel/tools/mod.js';
|
|
45
|
+
export { askUserTool, buildHttpToolTarget, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, formatToolResult, isUnsupportedMcpProtocolError, MCP_PROTOCOL_VERSIONS, mcpRequestMeta, parseMcpRpcResponse, prepareTurnToolSnapshot, registerHarnessTools, resolveToolAuth, UncheckedOutput, uncheckedOutput, withCredentialQuery, } from './src/kernel/tools/mod.js';
|
|
46
46
|
export { savedToolInvocationSchema, toolInvocationHash, toolOperationOutcomeSchema, } from './src/kernel/tools/operation.js';
|
|
47
47
|
export { awaitingUserInputSchema, gateReferenceSchema, isAwaitingUserInput, keptReply, reasoningPartSchema, TURN_EVENT_SCHEMAS, toolGateSchema, turnDoneOf, turnEventSchema, turnHistoryMessageSchema, turnToolSnapshotSchema, } from './src/kernel/turn-events.js';
|
|
48
48
|
export { buildRecord, clearTraceDestinations, contentOf, getTraceDestination, inlineContent, isTraceSink, listTraceDestinationIds, memorySink, noopSink, readTraceparent, registerTraceDestination, requireTraceDestination, resolveObservabilityPolicy, resolveTraceWriter, startTrace, TRACE_ATTRIBUTE_GROUPS, TRACE_FIELDS, TRACE_SPAN_TYPES, TRACE_STATUS, toOtlpJson, traceAttributeMeta, traceBytes, traceContent, traceEventAttributeMeta, traceEventMeta, traceJson, traceRecordSchema, traceSpanMeta, writeTrace, } from './src/observability/mod.js';
|
package/esm/src/kernel/mod.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export { type AnsweredGate, answerGatedCall, GATE_DECISIONS, type GateAnswerRequ
|
|
|
63
63
|
export type { MemoryToolExecutionOptions } from './tools/memory-execution.js';
|
|
64
64
|
export { createMemoryToolExecution } from './tools/memory-execution.js';
|
|
65
65
|
export type { CredentialQuery, McpProtocolVersion, McpRpcResponse, ToolRegistry, } from './tools/mod.js';
|
|
66
|
-
export { askUserTool, authorizeToolReplay, coerceToolResultParts, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, executeRegisteredTool, formatToolResult, isUnsupportedMcpProtocolError, leanToolResultData, MCP_PROTOCOL_VERSIONS, parseMcpRpcResponse, prepareTurnToolSnapshot, projectForModel, registerHarnessTools, resolveToolAuth, withCredentialQuery, } from './tools/mod.js';
|
|
66
|
+
export { askUserTool, authorizeToolReplay, coerceToolResultParts, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, executeRegisteredTool, formatToolResult, isUnsupportedMcpProtocolError, leanToolResultData, MCP_PROTOCOL_VERSIONS, mcpRequestMeta, parseMcpRpcResponse, prepareTurnToolSnapshot, projectForModel, registerHarnessTools, resolveToolAuth, withCredentialQuery, } from './tools/mod.js';
|
|
67
67
|
export type { BeginToolOperationResult, PageToolDispatch, PageToolExecution, SavedToolInvocation, TerminalToolEvent, ToolExecutionCoordinator, ToolOperationClaim, ToolOperationIdentity, ToolOperationOutcome, ToolOperationUncertainty, } from './tools/operation.js';
|
|
68
68
|
export { savedToolInvocationSchema, toolInvocationHash, toolOperationOutcomeSchema, } from './tools/operation.js';
|
|
69
69
|
export { jsonSchemaFromZod } from './tools/schema.js';
|
package/esm/src/kernel/mod.js
CHANGED
|
@@ -37,7 +37,7 @@ export { activityLabelProblem } from './tools/activity-label.js';
|
|
|
37
37
|
export { agentToolInputFor, agentToolOutput } from './tools/agent.js';
|
|
38
38
|
export { answerGatedCall, GATE_DECISIONS, gateExpired, resolveGateTtlMs, sessionPermissionsAfterApproval, } from './tools/gate-answer.js';
|
|
39
39
|
export { createMemoryToolExecution } from './tools/memory-execution.js';
|
|
40
|
-
export { askUserTool, authorizeToolReplay, coerceToolResultParts, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, executeRegisteredTool, formatToolResult, isUnsupportedMcpProtocolError, leanToolResultData, MCP_PROTOCOL_VERSIONS, parseMcpRpcResponse, prepareTurnToolSnapshot, projectForModel, registerHarnessTools, resolveToolAuth, withCredentialQuery, } from './tools/mod.js';
|
|
40
|
+
export { askUserTool, authorizeToolReplay, coerceToolResultParts, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, executeRegisteredTool, formatToolResult, isUnsupportedMcpProtocolError, leanToolResultData, MCP_PROTOCOL_VERSIONS, mcpRequestMeta, parseMcpRpcResponse, prepareTurnToolSnapshot, projectForModel, registerHarnessTools, resolveToolAuth, withCredentialQuery, } from './tools/mod.js';
|
|
41
41
|
export { savedToolInvocationSchema, toolInvocationHash, toolOperationOutcomeSchema, } from './tools/operation.js';
|
|
42
42
|
export { jsonSchemaFromZod } from './tools/schema.js';
|
|
43
43
|
export { CredentialRefusedError } from './tools/signed-in-fetch.js';
|
|
@@ -196,8 +196,9 @@ function placeholdersAt(node, prefix) {
|
|
|
196
196
|
const branches = schemaBranches(node);
|
|
197
197
|
if (branches.length)
|
|
198
198
|
return branches.flatMap((branch) => placeholdersAt(branch, prefix));
|
|
199
|
+
// why: A list's length is a number a label can show, after its first item's fields.
|
|
199
200
|
if (schemaTypes(node).includes('array'))
|
|
200
|
-
return leavesAt(node.items, at('0'));
|
|
201
|
+
return [...leavesAt(node.items, at('0')), at('length')];
|
|
201
202
|
if (!isRecord(node.properties))
|
|
202
203
|
return [];
|
|
203
204
|
return Object.entries(node.properties).flatMap(([key, child]) => leavesAt(child, at(key)));
|
|
@@ -288,7 +289,12 @@ function placeholderProblem(template, schemas, sides) {
|
|
|
288
289
|
group: 'is a list or group; a label shows text or a number.', // labels-exempt: builder diagnostic
|
|
289
290
|
flag: 'is true or false; a label shows text or a number.', // labels-exempt: builder diagnostic
|
|
290
291
|
}[found.holds];
|
|
291
|
-
|
|
292
|
+
// why: What the builder ended the path with (a length, a name) says which of the fields they meant.
|
|
293
|
+
const last = route.keys.at(-1);
|
|
294
|
+
const tail = (candidate) => (candidate.split('.').at(-1) === last ? 0 : 1);
|
|
295
|
+
// why: Not `toSorted`: the studio's declaration build targets a lib before ES2023.
|
|
296
|
+
const ranked = [...(near.length ? near : all)].sort((a, b) => tail(a) - tail(b));
|
|
297
|
+
return `{${path}} ${reason}${tryInstead(ranked)}`;
|
|
292
298
|
}
|
|
293
299
|
return undefined;
|
|
294
300
|
}
|
|
@@ -4,7 +4,7 @@ export { formatToolResult } from './model-text.js';
|
|
|
4
4
|
export type { ToolRegistry } from './registry.js';
|
|
5
5
|
export { createToolRegistry } from './registry.js';
|
|
6
6
|
export type { CredentialQuery, McpProtocolVersion, McpRpcResponse } from './remote.js';
|
|
7
|
-
export { buildHttpToolTarget, credentialPlacement, executeHttpTool, executeMcpTool, isUnsupportedMcpProtocolError, MCP_PROTOCOL_VERSIONS, parseMcpRpcResponse, resolveToolAuth, withCredentialQuery, } from './remote.js';
|
|
7
|
+
export { buildHttpToolTarget, credentialPlacement, executeHttpTool, executeMcpTool, isUnsupportedMcpProtocolError, MCP_PROTOCOL_VERSIONS, mcpRequestMeta, parseMcpRpcResponse, resolveToolAuth, withCredentialQuery, } from './remote.js';
|
|
8
8
|
export { cloneTurnToolSnapshot, prepareTurnToolSnapshot } from './resolve.js';
|
|
9
9
|
export type * from './types.js';
|
|
10
10
|
export { UncheckedOutput, uncheckedOutput } from './unchecked-output.js';
|
|
@@ -2,6 +2,6 @@ export { authorizeToolReplay, coerceToolResultParts, executeRegisteredTool, lean
|
|
|
2
2
|
export { askUserTool, registerHarnessTools } from './harness.js';
|
|
3
3
|
export { formatToolResult } from './model-text.js';
|
|
4
4
|
export { createToolRegistry } from './registry.js';
|
|
5
|
-
export { buildHttpToolTarget, credentialPlacement, executeHttpTool, executeMcpTool, isUnsupportedMcpProtocolError, MCP_PROTOCOL_VERSIONS, parseMcpRpcResponse, resolveToolAuth, withCredentialQuery, } from './remote.js';
|
|
5
|
+
export { buildHttpToolTarget, credentialPlacement, executeHttpTool, executeMcpTool, isUnsupportedMcpProtocolError, MCP_PROTOCOL_VERSIONS, mcpRequestMeta, parseMcpRpcResponse, resolveToolAuth, withCredentialQuery, } from './remote.js';
|
|
6
6
|
export { cloneTurnToolSnapshot, prepareTurnToolSnapshot } from './resolve.js';
|
|
7
7
|
export { UncheckedOutput, uncheckedOutput } from './unchecked-output.js';
|
|
@@ -111,6 +111,11 @@ export declare function audienceMismatch(audience: string | undefined, url: URL)
|
|
|
111
111
|
export declare function executeHttpTool(tool: HttpToolDef, rawInput: unknown, ctx: ToolContext, base: ToolCallBase, stages?: ToolStageSupport, beginBody?: (preparedInput: unknown) => Promise<ToolOperationClaim | undefined>, shown?: HandlerEvents): AsyncGenerator<TurnEvent, ToolBodyOutcome>;
|
|
112
112
|
/** Preferred first. */
|
|
113
113
|
export declare const MCP_PROTOCOL_VERSIONS: readonly ["2026-07-28", "2025-11-25", "2025-06-18", "2025-03-26"];
|
|
114
|
+
/**
|
|
115
|
+
* The `_meta` an MCP request carries. Stateless servers (2026-07-28) read the client's revision and
|
|
116
|
+
* capabilities from each request, not from an initialize, and refuse one without both.
|
|
117
|
+
*/
|
|
118
|
+
export declare function mcpRequestMeta(protocolVersion: string): Record<string, unknown>;
|
|
114
119
|
/** An MCP protocol version the client can speak. */
|
|
115
120
|
export type McpProtocolVersion = (typeof MCP_PROTOCOL_VERSIONS)[number];
|
|
116
121
|
/** A JSON-RPC message from an MCP server: a result or an error. */
|
|
@@ -653,6 +653,16 @@ export const MCP_PROTOCOL_VERSIONS = [
|
|
|
653
653
|
'2025-06-18',
|
|
654
654
|
'2025-03-26',
|
|
655
655
|
];
|
|
656
|
+
/**
|
|
657
|
+
* The `_meta` an MCP request carries. Stateless servers (2026-07-28) read the client's revision and
|
|
658
|
+
* capabilities from each request, not from an initialize, and refuse one without both.
|
|
659
|
+
*/
|
|
660
|
+
export function mcpRequestMeta(protocolVersion) {
|
|
661
|
+
return {
|
|
662
|
+
'io.modelcontextprotocol/protocolVersion': protocolVersion,
|
|
663
|
+
'io.modelcontextprotocol/clientCapabilities': {},
|
|
664
|
+
};
|
|
665
|
+
}
|
|
656
666
|
/** Accepts a JSON body or an SSE (`data:`) stream. */
|
|
657
667
|
export function parseMcpRpcResponse(text) {
|
|
658
668
|
const trimmed = text.trim();
|
|
@@ -717,11 +727,7 @@ async function fetchMcpProtocolAttempt(transport, rpcId, mcpToolName, input, pro
|
|
|
717
727
|
params: {
|
|
718
728
|
name: mcpToolName,
|
|
719
729
|
arguments: input,
|
|
720
|
-
|
|
721
|
-
_meta: {
|
|
722
|
-
'io.modelcontextprotocol/protocolVersion': protocolVersion,
|
|
723
|
-
'io.modelcontextprotocol/clientCapabilities': {},
|
|
724
|
-
},
|
|
730
|
+
_meta: mcpRequestMeta(protocolVersion),
|
|
725
731
|
},
|
|
726
732
|
};
|
|
727
733
|
const response = await fetchGuarded(transport.url, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theoremjs/agents",
|
|
3
|
-
"version": "0.3.4-next.
|
|
3
|
+
"version": "0.3.4-next.452.gb2a8e30",
|
|
4
4
|
"description": "A flat TypeScript agent kernel for typed profiles, deterministic turn execution, registered tools, provider adapters, guardrails, and host-injected traces.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|