@tangle-network/agent-app 0.39.0 → 0.39.2

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.
Files changed (35) hide show
  1. package/dist/{auth-BlS9GWfL.d.ts → auth-DcK5ERaL.d.ts} +7 -4
  2. package/dist/{chunk-IOREXWLM.js → chunk-2FDTJIU4.js} +8 -35
  3. package/dist/{chunk-IOREXWLM.js.map → chunk-2FDTJIU4.js.map} +1 -1
  4. package/dist/{chunk-JT6HHO5P.js → chunk-BUUJ7TEQ.js} +8 -33
  5. package/dist/{chunk-JT6HHO5P.js.map → chunk-BUUJ7TEQ.js.map} +1 -1
  6. package/dist/{chunk-CDYYR3Z7.js → chunk-DBIG2PHS.js} +208 -36
  7. package/dist/chunk-DBIG2PHS.js.map +1 -0
  8. package/dist/{chunk-VT5DI6GL.js → chunk-FDJ6JQCI.js} +3 -3
  9. package/dist/{chunk-JZZ6AWF4.js → chunk-PPSZNVKT.js} +9 -7
  10. package/dist/chunk-PPSZNVKT.js.map +1 -0
  11. package/dist/{chunk-A76ZHWNF.js → chunk-RH74YJIK.js} +31 -1
  12. package/dist/chunk-RH74YJIK.js.map +1 -0
  13. package/dist/{chunk-4IQMTTNE.js → chunk-TQ5M7BFV.js} +2 -2
  14. package/dist/design-canvas/index.d.ts +8 -21
  15. package/dist/design-canvas/index.js +2 -2
  16. package/dist/eval/index.d.ts +1 -1
  17. package/dist/index.d.ts +6 -6
  18. package/dist/index.js +12 -9
  19. package/dist/{mcp-BShTlESm.d.ts → mcp-4I_RHhNa.d.ts} +38 -3
  20. package/dist/preset-cloudflare/index.d.ts +1 -1
  21. package/dist/runtime/index.d.ts +3 -3
  22. package/dist/runtime/index.js +2 -2
  23. package/dist/sandbox/index.d.ts +7 -3
  24. package/dist/sandbox/index.js +6 -4
  25. package/dist/sequences/index.d.ts +10 -27
  26. package/dist/sequences/index.js +5 -4
  27. package/dist/tools/index.d.ts +5 -5
  28. package/dist/tools/index.js +5 -3
  29. package/dist/{types-2rOJo8Hc.d.ts → types-wHs0rmtu.d.ts} +12 -1
  30. package/package.json +1 -1
  31. package/dist/chunk-A76ZHWNF.js.map +0 -1
  32. package/dist/chunk-CDYYR3Z7.js.map +0 -1
  33. package/dist/chunk-JZZ6AWF4.js.map +0 -1
  34. /package/dist/{chunk-VT5DI6GL.js.map → chunk-FDJ6JQCI.js.map} +0 -0
  35. /package/dist/{chunk-4IQMTTNE.js.map → chunk-TQ5M7BFV.js.map} +0 -0
@@ -11,7 +11,7 @@ import {
11
11
  instantiateTemplate,
12
12
  listTemplateSlots,
13
13
  validateBindings
14
- } from "../chunk-IOREXWLM.js";
14
+ } from "../chunk-2FDTJIU4.js";
15
15
  import {
16
16
  CHANNEL_PRESETS,
17
17
  EXPORT_PRESETS,
@@ -47,7 +47,7 @@ import {
47
47
  validateSlotValue
48
48
  } from "../chunk-M2EBUDZ7.js";
49
49
  import "../chunk-HFC4BTWJ.js";
50
- import "../chunk-A76ZHWNF.js";
50
+ import "../chunk-RH74YJIK.js";
51
51
  export {
52
52
  CANVAS_ELEMENT_KINDS,
53
53
  CANVAS_MCP_TOOLS,
@@ -1,6 +1,6 @@
1
1
  import { CompletionRequirement, RuntimeEventLike } from '@tangle-network/agent-eval';
2
2
  export { CompletionRequirement, CompletionVerdict, CorrectnessChecker, ProducedState, RuntimeEventLike, SatisfiedBy, TaskGold, createLlmCorrectnessChecker, extractProducedState, verifyCompletion, weightedComposite } from '@tangle-network/agent-eval';
3
- import { e as AppToolProducedEvent } from '../types-2rOJo8Hc.js';
3
+ import { e as AppToolProducedEvent } from '../types-wHs0rmtu.js';
4
4
 
5
5
  /**
6
6
  * Eval — the app-shell BRIDGE to `@tangle-network/agent-eval`, not a reimpl.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { AppToolRuntimeExecutor, CapabilityTokenOptions, DispatchOptions, ExpiringCapabilityTokenOptions, HandleToolRequestOptions, ResolveToolCapabilitiesOptions, ResolvedToolCapabilities, RuntimeExecutorOptions, ToolCapability, ToolInputError, createAppToolRuntimeExecutor, createCapabilityToken, createExpiringCapabilityToken, dispatchAppTool, handleAppToolRequest, outcomeStatus, resolveToolCapabilities, restrictTaxonomy, verifyCapabilityToken, verifyExpiringCapabilityToken } from './tools/index.js';
2
- export { A as APP_TOOL_NAMES, a as AppToolName, b as AuthenticateOptions, D as DEFAULT_HEADER_NAMES, O as OpenAIFunctionTool, T as ToolAuthResult, c as ToolHeaderNames, d as authenticateToolRequest, e as buildAppToolOpenAITools, i as isAppToolName, r as readToolArgs } from './auth-BlS9GWfL.js';
3
- export { A as AppToolMcpServer, B as BuildHttpMcpServerOptions, a as BuildMcpServerOptions, D as DEFAULT_APP_TOOL_PATHS, b as buildAppToolMcpServer, c as buildHttpMcpServer } from './mcp-BShTlESm.js';
4
- export { C as CreateMcpToolHandlerOptions, M as MCP_PROTOCOL_VERSIONS, a as McpProtocolVersion, b as McpServerInfo, c as McpToolDefinition, d as createMcpToolHandler } from './mcp-rpc-DLw_r9PQ.js';
5
- export { A as AddCitationArgs, a as AddCitationResult, b as AppToolContext, c as AppToolHandlers, d as AppToolOutcome, e as AppToolProducedEvent, f as AppToolTaxonomy, R as RenderUiArgs, g as RenderUiResult, S as ScheduleFollowupArgs, h as ScheduleFollowupResult, i as SubmitProposalArgs, j as SubmitProposalResult } from './types-2rOJo8Hc.js';
2
+ export { A as APP_TOOL_NAMES, a as AppToolName, b as AuthenticateOptions, D as DEFAULT_HEADER_NAMES, O as OpenAIFunctionTool, T as ToolAuthResult, c as ToolHeaderNames, d as authenticateToolRequest, e as buildAppToolOpenAITools, i as isAppToolName, r as readToolArgs } from './auth-DcK5ERaL.js';
3
+ export { A as AppToolMcpServer, B as BuildHttpMcpServerOptions, a as BuildMcpServerOptions, D as DEFAULT_APP_TOOL_PATHS, S as ScopedMcpServerEntryOptions, b as buildAppToolMcpServer, c as buildHttpMcpServer, d as buildScopedMcpServerEntry } from './mcp-4I_RHhNa.js';
4
+ export { C as CreateMcpToolHandlerOptions, M as MCP_PROTOCOL_VERSIONS, a as McpProtocolVersion, b as McpServerInfo, c as McpToolDefinition, M as SEQUENCES_MCP_PROTOCOL_VERSIONS, d as createMcpToolHandler } from './mcp-rpc-DLw_r9PQ.js';
5
+ export { A as AddCitationArgs, a as AddCitationResult, b as AppToolContext, c as AppToolHandlers, d as AppToolOutcome, e as AppToolProducedEvent, f as AppToolTaxonomy, B as BuildAppToolsOptions, R as RenderUiArgs, g as RenderUiResult, S as ScheduleFollowupArgs, h as ScheduleFollowupResult, i as SubmitProposalArgs, j as SubmitProposalResult } from './types-wHs0rmtu.js';
6
6
  export { BuildDelegationOptions, DELEGATION_MCP_SERVER_KEY, DELEGATION_TOOLS, DelegationMcpServer, buildDelegationMcpServer, delegationMcpForConfig } from './delegation/index.js';
7
7
  export { BrokerToken, BrokerTokenMinter, BrokerTokenProvider, BrokerTokenProviderOptions, ConsentUrlInput, buildConsentUrl, createBrokerTokenProvider } from './tangle/index.js';
8
8
  export { C as CatalogModel, M as ModelCatalog, R as RouterModel, _ as __resetCatalogCache, b as buildCatalog, f as fetchModelCatalog, n as normalizeModelId } from './model-catalog-BEAEVDaa.js';
@@ -20,7 +20,7 @@ export { BufferedTurnEvent, D1LikeForTurns, JsonRecord, PersistedChatMessageForT
20
20
  export { HubExecClient, HubExecClientOptions, HubExecErrorCode, HubExecResult, HubInvokeDeps, HubInvokeInput, HubInvokeOutcome, ParsedIntegrationAction, invokeIntegrationHub, resolveIntegrationAction } from './integrations/index.js';
21
21
  export { CompleteMissionInput, CreateMissionInput, DEFAULT_MISSION_STEP_KINDS, InMemoryMissionStore, MISSION_CONTROL_CHANNEL_ID, MissionApprovalsPort, MissionAuditEvent, MissionConcurrencyError, MissionCostLedger, MissionEngine, MissionEngineOptions, MissionEventSink, MissionGateKind, MissionGateOptions, MissionGateProposal, MissionOutcome, MissionPlanRunOptions, MissionProposalResolution, MissionRecord, MissionService, MissionServiceOptions, MissionState, MissionStatus, MissionStep, MissionStepState, MissionStepStatus, MissionStorePort, MissionStreamEvent, MissionStreamStatus, MissionStreamStep, MissionStreamStepStatus, MissionUpdateGuard, MissionUpdatePatch, ParseMissionBlocksOptions, ParsedMission, ParsedMissionStep, PlanOutcome, RetryableStepError, SandboxDispatch, SandboxDispatchDoneResult, SandboxDispatchInProgressResult, SandboxDispatchInput, SandboxDispatchResult, SetStepStatusPatch, StepGateClassification, StepOutcome, applyMissionEvent, asMissionStreamEvent, budgetGateProposalId, buildAgentMissionPlan, createInMemoryMissionStore, createMissionEngine, createMissionService, isMissionStopRequested, isMissionTerminal, mergeMissionState, noopEventSink, parseMissionBlocks, parseSessionStreamEnvelope, reduceMissionEvents, stepGateProposalId, volumeGateProposalId } from './missions/index.js';
22
22
  export { S as StepAgentActivity, W as WithAgentActivity, s as stepAgentActivity } from './agent-activity-C8ZG0F0M.js';
23
- export { AppToolDescriptor, AuthenticatedSandboxUser, BuildAppToolMcpServersOptions, BuildSandboxToolFileMountsOptions, DEFAULT_SANDBOX_RESOURCES, EnsureWorkspaceSandboxOptions, LivenessProbeConfig, MemberSyncSeam, Outcome, ProfileComposeOptions, ProviderResolutionConfig, ResolveSandboxClientCredentialsOptions, ResolvedModel, SandboxApiCredentials, SandboxBuildContext, SandboxClientCredentials, SandboxCredentialEnvironment, SandboxPermissionLevel, SandboxResourceConfig, SandboxRestoreSpec, SandboxRuntimeConfig, SandboxRuntimeConnection, SandboxScope, SandboxStepTransition, SandboxTerminalTokenOptions, SandboxTerminalTokenResult, SandboxTerminalTokenSubject, SandboxTerminalWsMatch, SandboxToolPathOptions, SandboxToolSpec, ScopedTokenResult, SecretStore, StreamSandboxPromptOptions, TerminalProxyIdentity, WorkspaceSandboxConnectionArgs, WorkspaceSandboxConnectionHandlerOptions, WorkspaceSandboxEnsureContext, WorkspaceSandboxInstanceLike, WorkspaceSandboxManager, WorkspaceSandboxManagerOptions, WorkspaceSandboxRuntimeProxyArgs, WorkspaceSandboxRuntimeProxyHandlerOptions, WorkspaceSandboxTerminalUpgradeHandlerOptions, WriteProfileFilesOptions, attachReasoningEffort, bearerSubprotocolToken, bearerToken, buildAppToolMcpServers, buildSandboxRuntimeProxyHeaders, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, createSandboxTerminalToken, createWorkspaceSandboxConnectionHandler, createWorkspaceSandboxManager, createWorkspaceSandboxRuntimeProxyHandler, createWorkspaceSandboxTerminalUpgradeHandler, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, encodeSandboxRuntimePath, ensureWorkspaceSandbox, flattenHistory, getClient, isSandboxTerminalWsUpgrade, isTerminalPromptEvent, matchSandboxTerminalWsPath, mergeExtraMcp, mintSandboxScopedToken, mintTerminalProxyToken, readSecret, resetClientCache, resolveModel, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, splitDeferredProfileFiles, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, terminalTokenFromRequest, verifySandboxTerminalToken, verifyTerminalProxyToken, writeProfileFilesToBox } from './sandbox/index.js';
23
+ export { AppToolDescriptor, AuthenticatedSandboxUser, BuildAppToolMcpServersOptions, BuildSandboxToolFileMountsOptions, DEFAULT_SANDBOX_RESOURCES, EnsureWorkspaceSandboxOptions, LivenessProbeConfig, MemberSyncSeam, Outcome, ProfileComposeOptions, ProviderResolutionConfig, ResolveSandboxClientCredentialsOptions, ResolvedModel, SandboxApiCredentials, SandboxBuildContext, SandboxClientCredentials, SandboxCredentialEnvironment, SandboxPermissionLevel, SandboxResourceConfig, SandboxRestoreSpec, SandboxRuntimeAuthRefreshError, SandboxRuntimeConfig, SandboxRuntimeConnection, SandboxScope, SandboxStepTransition, SandboxTerminalTokenOptions, SandboxTerminalTokenResult, SandboxTerminalTokenSubject, SandboxTerminalWsMatch, SandboxToolPathOptions, SandboxToolSpec, ScopedTokenResult, SecretStore, StreamSandboxPromptOptions, TerminalProxyIdentity, WorkspaceSandboxConnectionArgs, WorkspaceSandboxConnectionHandlerOptions, WorkspaceSandboxEnsureContext, WorkspaceSandboxInstanceLike, WorkspaceSandboxManager, WorkspaceSandboxManagerOptions, WorkspaceSandboxRuntimeProxyArgs, WorkspaceSandboxRuntimeProxyHandlerOptions, WorkspaceSandboxTerminalUpgradeHandlerOptions, WriteProfileFilesOptions, attachReasoningEffort, bearerSubprotocolToken, bearerToken, buildAppToolMcpServers, buildSandboxRuntimeProxyHeaders, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, createSandboxTerminalToken, createWorkspaceSandboxConnectionHandler, createWorkspaceSandboxManager, createWorkspaceSandboxRuntimeProxyHandler, createWorkspaceSandboxTerminalUpgradeHandler, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, encodeSandboxRuntimePath, ensureWorkspaceSandbox, flattenHistory, getClient, isSandboxTerminalWsUpgrade, isTerminalPromptEvent, matchSandboxTerminalWsPath, mergeExtraMcp, mintSandboxScopedToken, mintTerminalProxyToken, readSecret, resetClientCache, resolveModel, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, splitDeferredProfileFiles, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, terminalTokenFromRequest, verifySandboxTerminalToken, verifyTerminalProxyToken, writeProfileFilesToBox } from './sandbox/index.js';
24
24
  export { CookieOptions, JsonObject, KvLike, RateLimitResult, RequestContext, SecurityHeaderOptions, addSecurityHeaders, assertMediaUrl, checkRateLimit, clearCookieHeader, extractRequestContext, parseJsonObjectBody, readCookieValue, requireString, serializeCookie } from './web/index.js';
25
25
  export { BuildRedactedDocumentOptions, DEFAULT_REDACTION_PATTERNS, RedactForIngestionOptions, RedactedDocSegment, RedactedDocument, RedactionPattern, RedactionSpan, RevealResult, RevealSpanOptions, buildRedactedDocument, detectSpans, maskSpans, redactForIngestion, revealSpan } from './redact/index.js';
26
26
  export { ApprovalEvent, ApprovalEventSchema, AssetContentMap, AssetFormat, AssetSpec, AssetStatus, AssetVariant, BrandTokens, BrandTokensSchema, ConversionMetrics, ConversionMetricsSchema, CopyContent, CopyContentSchema, CopyPlatform, EmailBodySection, EmailContent, EmailContentSchema, EmailCtaSection, EmailDividerSection, EmailFeatureSection, EmailHeroSection, EmailSection, EmailTestimonialSection, ImageBackground, ImageContent, ImageContentSchema, ImageImageLayer, ImageLayer, ImageLayerType, ImageLogoLayer, ImageShapeLayer, ImageSlide, ImageTextLayer, VideoCaption, VideoContent, VideoContentSchema, VideoCountdownScene, VideoImageRevealScene, VideoScene, VideoSlideScene, VideoTextAnimationScene, parseAssetSpec, safeParseAssetSpec } from './assets/index.js';
@@ -28,7 +28,7 @@ export { AgentAppTheme, CanvasRenderPalette, darkTheme, lightTheme, themeColor,
28
28
  export { DistributionSummary, LoopTraceEventLike, MissionFlowStep, MissionTraceContext, StepSpanContext, TimedEvent, buildFlowTrace, childSpanContext, composeMissionFlowTrace, createMissionTraceContext, delegationActivityToFlowSpans, loopTraceEventsToFlowSpans, renderHistogram, renderWaterfall, stepActivityFlowTrace, summarize, timedEventsFromLines, traceEnv } from './trace/index.js';
29
29
  export { M as MIN_SEQUENCE_CLIP_FRAMES, N as NewSequenceClip, a as NewSequenceDecision, b as NewSequenceTrack, S as SequenceClip, c as SequenceClipMedia, d as SequenceClipPatch, e as SequenceDecision, f as SequenceExportFormat, g as SequenceExportRecord, h as SequenceExportStatus, i as SequenceFrameSnapshot, j as SequenceMediaKind, k as SequenceMeta, l as SequenceStatus, m as SequenceStore, n as SequenceStoreScope, o as SequenceTimeline, p as SequenceTrack, q as SequenceTrackKind, T as TimelineClipBounds, r as TimelineInterval, s as assertClipFitsSequence, t as chooseCaptionPlacement, u as clampClipDuration, v as clampClipStart, w as formatSeconds, x as formatTimecode, y as framesToSeconds, z as secondsToFrames, A as snapshotFrame, B as trackIntervals } from './store-gckrNq-g.js';
30
30
  export { A as AddCaptionOperation, C as CaptionTargetResolution, a as CreateTrackOperation, D as DeleteClipOperation, E as ExtendSequenceOperation, M as MoveClipOperation, P as PlaceClipOperation, Q as QueueExportOperation, S as SEQUENCE_OPERATION_TYPES, b as SequenceApplyResult, c as SequenceOperation, d as SequenceOperationContext, e as SequenceOperationType, f as SequencePlan, g as SetClipDisabledOperation, h as SetClipTextOperation, i as SplitClipOperation, T as TrimClipOperation, j as applySequenceOperation, k as applySequenceOperations, l as assertSequenceMediaUrl, m as captionTrackNameForLanguage, n as lastClipEndFrame, p as parseSequenceOperations, r as resolveCaptionPlacement, o as resolveCaptionTarget, q as resolvePlaceClipTrack, v as validateAddCaption, s as validateCreateTrack, t as validateDeleteClip, u as validateExtendSequence, w as validateMoveClip, x as validatePlaceClip, y as validateQueueExport, z as validateSequenceOperation, B as validateSequenceOperations, F as validateSetClipDisabled, G as validateSetClipText, H as validateSplitClip, I as validateTrimClip } from './apply-Gk4raT2j.js';
31
- export { BuildCaptionChunksOptions, BuildSequencesMcpServerEntryOptions, CaptionChunk, CaptionCoverageEntry, CaptionExportOptions, ContactSheetEntry, ContactSheetManifest, CreateSequencesMcpHandlerOptions, DEFAULT_SEQUENCES_MCP_DESCRIPTION, LanguageFanoutOptions, MAX_CAPTION_BATCH, OtioClip, OtioExternalReference, OtioGap, OtioMissingReference, OtioRationalTime, OtioStack, OtioTimeRange, OtioTimeline, OtioTrack, SEQUENCES_MCP_PROTOCOL_VERSIONS, SEQUENCE_EXPORT_FORMATS, SEQUENCE_MCP_TOOLS, SEQUENCE_MEDIA_KINDS, SEQUENCE_TRACK_KINDS, SequenceMcpToolDefinition, SequenceMcpToolEnv, SequencesMcpServerInfo, TranscriptSegment, buildCaptionChunks, buildContactSheetManifest, buildEdl, buildOtio, buildSequencesMcpServerEntry, buildSrt, buildVtt, captionCoverage, createSequencesMcpHandler, findSequenceMcpTool, normalizeLanguageTag, planLanguageFanout } from './sequences/index.js';
31
+ export { BuildCaptionChunksOptions, BuildSequencesMcpServerEntryOptions, CaptionChunk, CaptionCoverageEntry, CaptionExportOptions, ContactSheetEntry, ContactSheetManifest, CreateSequencesMcpHandlerOptions, DEFAULT_SEQUENCES_MCP_DESCRIPTION, LanguageFanoutOptions, MAX_CAPTION_BATCH, OtioClip, OtioExternalReference, OtioGap, OtioMissingReference, OtioRationalTime, OtioStack, OtioTimeRange, OtioTimeline, OtioTrack, SEQUENCE_EXPORT_FORMATS, SEQUENCE_MCP_TOOLS, SEQUENCE_MEDIA_KINDS, SEQUENCE_TRACK_KINDS, SequenceMcpToolDefinition, SequenceMcpToolEnv, SequencesMcpServerInfo, TranscriptSegment, buildCaptionChunks, buildContactSheetManifest, buildEdl, buildOtio, buildSequencesMcpServerEntry, buildSrt, buildVtt, captionCoverage, createSequencesMcpHandler, findSequenceMcpTool, normalizeLanguageTag, planLanguageFanout } from './sequences/index.js';
32
32
  export { B as Bounds, E as EllipseElement, G as GroupElement, I as ImageElement, L as LineElement, N as NewPageOptions, P as PageBleed, a as PageGuides, R as RectElement, S as SCENE_ELEMENT_KINDS, b as SCENE_SCHEMA_VERSION, c as SceneDocument, d as SceneElement, e as SceneElementBase, f as SceneElementKind, g as ScenePage, h as SceneSettings, T as TextElement, V as VideoElement, i as assertColor, j as assertFinite, k as assertPositiveFinite, l as assertSceneMediaSrc, m as boundsIntersect, n as collectSlots, o as createEmptyDocument, p as createPage, q as elementAabb, r as elementExtent, s as estimateTextHeight, t as findElement, u as requireElement, v as requirePage } from './model-BBwyOuWG.js';
33
33
  export { A as AddElementOperation, a as AddPageOperation, b as ApplyDataOperation, B as BindSlotOperation, D as DeleteElementOperation, c as DeletePageOperation, d as DuplicatePageOperation, G as GroupElementsOperation, R as ReorderElementOperation, e as ReorderPageOperation, S as SCENE_OPERATION_TYPES, f as SceneAttrsPatch, g as SceneOperation, h as SceneOperationType, i as ScenePlan, j as SetAttrsOperation, k as SetDocumentTitleOperation, l as SetPageGuidesOperation, m as SetPagePropsOperation, U as UngroupElementOperation } from './operations-DLIvvD00.js';
34
34
  export { N as NewSceneDecision, S as SceneDecision, a as SceneDocumentRecord, b as SceneExportFormat, c as SceneExportRecord, d as SceneStore, e as SceneStoreScope } from './store-CFyxgTlD.js';
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  instantiateTemplate,
13
13
  listTemplateSlots,
14
14
  validateBindings
15
- } from "./chunk-IOREXWLM.js";
15
+ } from "./chunk-2FDTJIU4.js";
16
16
  import {
17
17
  darkTheme,
18
18
  lightTheme,
@@ -91,7 +91,6 @@ import {
91
91
  import {
92
92
  DEFAULT_SEQUENCES_MCP_DESCRIPTION,
93
93
  MAX_CAPTION_BATCH,
94
- SEQUENCES_MCP_PROTOCOL_VERSIONS,
95
94
  SEQUENCE_EXPORT_FORMATS,
96
95
  SEQUENCE_MCP_TOOLS,
97
96
  SEQUENCE_MEDIA_KINDS,
@@ -131,7 +130,7 @@ import {
131
130
  validateSetClipText,
132
131
  validateSplitClip,
133
132
  validateTrimClip
134
- } from "./chunk-JT6HHO5P.js";
133
+ } from "./chunk-BUUJ7TEQ.js";
135
134
  import {
136
135
  MIN_SEQUENCE_CLIP_FRAMES,
137
136
  assertClipFitsSequence,
@@ -244,6 +243,7 @@ import {
244
243
  } from "./chunk-EEPJGZJW.js";
245
244
  import {
246
245
  DEFAULT_SANDBOX_RESOURCES,
246
+ SandboxRuntimeAuthRefreshError,
247
247
  attachReasoningEffort,
248
248
  bearerSubprotocolToken,
249
249
  bearerToken,
@@ -290,7 +290,7 @@ import {
290
290
  verifySandboxTerminalToken,
291
291
  verifyTerminalProxyToken,
292
292
  writeProfileFilesToBox
293
- } from "./chunk-CDYYR3Z7.js";
293
+ } from "./chunk-DBIG2PHS.js";
294
294
  import {
295
295
  DEFAULT_HARNESS,
296
296
  HARNESS_MODEL_POLICIES,
@@ -313,7 +313,7 @@ import {
313
313
  restrictTaxonomy,
314
314
  verifyCapabilityToken,
315
315
  verifyExpiringCapabilityToken
316
- } from "./chunk-VT5DI6GL.js";
316
+ } from "./chunk-FDJ6JQCI.js";
317
317
  import {
318
318
  DEFAULT_APP_TOOL_PATHS,
319
319
  DEFAULT_HEADER_NAMES,
@@ -321,9 +321,10 @@ import {
321
321
  authenticateToolRequest,
322
322
  buildAppToolMcpServer,
323
323
  buildHttpMcpServer,
324
+ buildScopedMcpServerEntry,
324
325
  createMcpToolHandler,
325
326
  readToolArgs
326
- } from "./chunk-A76ZHWNF.js";
327
+ } from "./chunk-RH74YJIK.js";
327
328
  import {
328
329
  DELEGATION_MCP_SERVER_KEY,
329
330
  DELEGATION_TOOLS,
@@ -348,7 +349,7 @@ import {
348
349
  runToolLoop,
349
350
  streamToolLoop,
350
351
  toLoopEvents
351
- } from "./chunk-4IQMTTNE.js";
352
+ } from "./chunk-TQ5M7BFV.js";
352
353
  import {
353
354
  DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
354
355
  DEFAULT_TANGLE_ROUTER_BASE_URL,
@@ -372,7 +373,7 @@ import {
372
373
  dispatchAppTool,
373
374
  isAppToolName,
374
375
  outcomeStatus
375
- } from "./chunk-JZZ6AWF4.js";
376
+ } from "./chunk-PPSZNVKT.js";
376
377
  import {
377
378
  createLlmCorrectnessChecker,
378
379
  createTokenRecallChecker,
@@ -425,13 +426,14 @@ export {
425
426
  SCENE_ELEMENT_KINDS,
426
427
  SCENE_OPERATION_TYPES,
427
428
  SCENE_SCHEMA_VERSION,
428
- SEQUENCES_MCP_PROTOCOL_VERSIONS,
429
+ MCP_PROTOCOL_VERSIONS as SEQUENCES_MCP_PROTOCOL_VERSIONS,
429
430
  SEQUENCE_EXPORT_FORMATS,
430
431
  SEQUENCE_MCP_TOOLS,
431
432
  SEQUENCE_MEDIA_KINDS,
432
433
  SEQUENCE_OPERATION_TYPES,
433
434
  SEQUENCE_TRACK_KINDS,
434
435
  SIZE_PRESETS,
436
+ SandboxRuntimeAuthRefreshError,
435
437
  TURN_EVENTS_MIGRATION_SQL,
436
438
  TangleExecutionKeyError,
437
439
  ToolInputError,
@@ -483,6 +485,7 @@ export {
483
485
  buildSandboxRuntimeProxyHeaders,
484
486
  buildSandboxToolFileMounts,
485
487
  buildSandboxToolPathSetupScript,
488
+ buildScopedMcpServerEntry,
486
489
  buildSequencesMcpServerEntry,
487
490
  buildSrt,
488
491
  buildUserTextParts,
@@ -1,5 +1,5 @@
1
- import { b as AppToolContext } from './types-2rOJo8Hc.js';
2
- import { c as ToolHeaderNames, a as AppToolName } from './auth-BlS9GWfL.js';
1
+ import { b as AppToolContext } from './types-wHs0rmtu.js';
2
+ import { c as ToolHeaderNames, a as AppToolName } from './auth-DcK5ERaL.js';
3
3
 
4
4
  /** Default route path each app tool is served at. A product mounts its routes
5
5
  * at these paths (or supplies its own via {@link BuildMcpServerOptions.paths}). */
@@ -38,6 +38,41 @@ interface BuildHttpMcpServerOptions {
38
38
  * {@link buildAppToolMcpServer} for the four app tools.
39
39
  */
40
40
  declare function buildHttpMcpServer(opts: BuildHttpMcpServerOptions): AppToolMcpServer;
41
+ /** Options for a per-document/scoped MCP channel entry (design-canvas,
42
+ * sequences, …). The capability token + path scope ONE resource; the document
43
+ * id lives in the path, never a tool argument. */
44
+ interface ScopedMcpServerEntryOptions {
45
+ /** App base URL the sandbox reaches back to (trailing slash tolerated). */
46
+ baseUrl: string;
47
+ /** Product route serving the resource's MCP handler — id is part of the path. */
48
+ path: string;
49
+ /** Capability token the product minted for this (user, resource) scope. With
50
+ * no token there is no entry to build — omit the server instead. */
51
+ token: string;
52
+ /** Override the channel's default tool-server description. */
53
+ description?: string;
54
+ /** Identity headers for products whose route recovers the user via
55
+ * `authenticateToolRequest`. Omit when the bearer token is self-contained. */
56
+ ctx?: AppToolContext;
57
+ headerNames?: ToolHeaderNames;
58
+ }
59
+ /**
60
+ * Build the `AgentProfileMcpServer`-shaped entry for a scoped, per-resource MCP
61
+ * channel. The shared mechanism behind the per-domain entry builders
62
+ * (`buildDesignCanvasMcpServerEntry`, `buildSequencesMcpServerEntry`): same
63
+ * token/path guards, same description default, same ctx-vs-self-contained-token
64
+ * branching. The domain is two parameters — `label` (for guard messages) and
65
+ * `defaultDescription` — never baked.
66
+ *
67
+ * The no-`ctx` branch is a GENUINE behavioral path, not a shortcut: it emits a
68
+ * self-contained-token entry with ONLY `Authorization` + `Content-Type`.
69
+ * Routing it through {@link buildHttpMcpServer} would unconditionally write a
70
+ * `userId` identity header (here `undefined`), so it stays a distinct branch.
71
+ */
72
+ declare function buildScopedMcpServerEntry(opts: ScopedMcpServerEntryOptions & {
73
+ label: string;
74
+ defaultDescription: string;
75
+ }): AppToolMcpServer;
41
76
  interface BuildMcpServerOptions {
42
77
  tool: AppToolName;
43
78
  baseUrl: string;
@@ -51,4 +86,4 @@ interface BuildMcpServerOptions {
51
86
  * {@link buildHttpMcpServer} that maps the tool name to its route path. */
52
87
  declare function buildAppToolMcpServer(opts: BuildMcpServerOptions): AppToolMcpServer;
53
88
 
54
- export { type AppToolMcpServer as A, type BuildHttpMcpServerOptions as B, DEFAULT_APP_TOOL_PATHS as D, type BuildMcpServerOptions as a, buildAppToolMcpServer as b, buildHttpMcpServer as c };
89
+ export { type AppToolMcpServer as A, type BuildHttpMcpServerOptions as B, DEFAULT_APP_TOOL_PATHS as D, type ScopedMcpServerEntryOptions as S, type BuildMcpServerOptions as a, buildAppToolMcpServer as b, buildHttpMcpServer as c, buildScopedMcpServerEntry as d };
@@ -1,6 +1,6 @@
1
1
  import { KeyProvisioner, KeyCrypto, WorkspaceKeyManager, WorkspaceKeyStore } from '../billing/index.js';
2
2
  import { KnowledgeStateAccessor } from '../knowledge/index.js';
3
- import { c as AppToolHandlers } from '../types-2rOJo8Hc.js';
3
+ import { c as AppToolHandlers } from '../types-wHs0rmtu.js';
4
4
  import { KvLike } from '../web/index.js';
5
5
  import '@tangle-network/agent-eval';
6
6
 
@@ -3,10 +3,10 @@ export { C as CreateTangleRouterModelConfigOptions, D as DEFAULT_TANGLE_BILLING_
3
3
  import * as _tangle_network_agent_runtime from '@tangle-network/agent-runtime';
4
4
  import { ToolLoopMessage, ToolLoopResult, StreamToolLoopYield, ToolLoopCall } from '@tangle-network/agent-runtime';
5
5
  export { RunToolLoopOptions as AppToolLoopOptions, ToolLoopAssistantToolCall as LoopAssistantToolCall, ToolLoopMessage as LoopMessage, ToolLoopCall as LoopToolCall, StreamToolLoopOptions as StreamAppToolLoopOptions, StreamToolLoopYield as StreamLoopYield, ToolLoopEvent, ToolLoopResult, ToolLoopStopReason, runToolLoop as runAppToolLoop, streamToolLoop as streamAppToolLoop } from '@tangle-network/agent-runtime';
6
- import { b as AppToolContext, e as AppToolProducedEvent, f as AppToolTaxonomy, c as AppToolHandlers, d as AppToolOutcome } from '../types-2rOJo8Hc.js';
6
+ import { b as AppToolContext, e as AppToolProducedEvent, f as AppToolTaxonomy, c as AppToolHandlers, d as AppToolOutcome } from '../types-wHs0rmtu.js';
7
7
  import { CertifiedProfile } from '@tangle-network/agent-runtime/intelligence';
8
- import { A as AppToolMcpServer } from '../mcp-BShTlESm.js';
9
- import '../auth-BlS9GWfL.js';
8
+ import { A as AppToolMcpServer } from '../mcp-4I_RHhNa.js';
9
+ import '../auth-DcK5ERaL.js';
10
10
 
11
11
  /**
12
12
  * Events the app's OpenAI-compat stream adapter ({@link toLoopEvents}) yields.
@@ -12,7 +12,7 @@ import {
12
12
  runToolLoop,
13
13
  streamToolLoop,
14
14
  toLoopEvents
15
- } from "../chunk-4IQMTTNE.js";
15
+ } from "../chunk-TQ5M7BFV.js";
16
16
  import {
17
17
  DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
18
18
  DEFAULT_TANGLE_ROUTER_BASE_URL,
@@ -28,7 +28,7 @@ import {
28
28
  tangleExecutionKeyHttpError,
29
29
  trimOrNull
30
30
  } from "../chunk-7W5XSTUF.js";
31
- import "../chunk-JZZ6AWF4.js";
31
+ import "../chunk-PPSZNVKT.js";
32
32
  export {
33
33
  DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
34
34
  DEFAULT_TANGLE_ROUTER_BASE_URL,
@@ -1,7 +1,7 @@
1
1
  import { AgentProfileFileMount, AgentProfileMcpServer, AgentProfile, StorageConfig, SandboxInstance, ScopedTokenScope, PromptResult, Sandbox } from '@tangle-network/sandbox';
2
2
  export { StorageConfig } from '@tangle-network/sandbox';
3
- import { a as AppToolName, c as ToolHeaderNames } from '../auth-BlS9GWfL.js';
4
- import { b as AppToolContext } from '../types-2rOJo8Hc.js';
3
+ import { a as AppToolName, c as ToolHeaderNames } from '../auth-DcK5ERaL.js';
4
+ import { b as AppToolContext } from '../types-wHs0rmtu.js';
5
5
  import { Harness } from '../harness/index.js';
6
6
  import { f as TangleExecutionEnvironment } from '../model-dF2h4xT9.js';
7
7
 
@@ -361,6 +361,10 @@ declare function splitDeferredProfileFiles(profile: AgentProfile): {
361
361
  leanProfile: AgentProfile;
362
362
  deferredFiles: AgentProfileFileMount[];
363
363
  };
364
+ type ExistingBoxStage = 'reused' | 'resumed';
365
+ declare class SandboxRuntimeAuthRefreshError extends Error {
366
+ constructor(stage: ExistingBoxStage, name: string, detail: string, cause?: unknown);
367
+ }
364
368
  interface WriteProfileFilesOptions {
365
369
  execTimeoutMs?: number;
366
370
  paceMs?: number;
@@ -452,4 +456,4 @@ declare function classifySeveredStream(event: unknown): SandboxStepTransition |
452
456
  declare function isTerminalPromptEvent(event: unknown): boolean;
453
457
  declare function detectInteractiveQuestion(event: unknown): string | null;
454
458
 
455
- export { type AppToolDescriptor, type AuthenticatedSandboxUser, type BuildAppToolMcpServersOptions, type BuildSandboxToolFileMountsOptions, DEFAULT_SANDBOX_RESOURCES, type EnsureWorkspaceSandboxOptions, type LivenessProbeConfig, type MemberSyncSeam, type Outcome, type ProfileComposeOptions, type ProviderResolutionConfig, type ResolveSandboxClientCredentialsOptions, type ResolvedModel, type SandboxApiCredentials, type SandboxBuildContext, type SandboxClientCredentials, type SandboxCredentialEnvironment, type SandboxPermissionLevel, type SandboxResourceConfig, type SandboxRestoreSpec, type SandboxRuntimeConfig, type SandboxRuntimeConnection, type SandboxScope, type SandboxStepTransition, type SandboxTerminalTokenOptions, type SandboxTerminalTokenResult, type SandboxTerminalTokenSubject, type SandboxTerminalWsMatch, type SandboxToolPathOptions, type SandboxToolSpec, type ScopedTokenResult, type SecretStore, type StreamSandboxPromptOptions, type TerminalProxyIdentity, type WorkspaceSandboxConnectionArgs, type WorkspaceSandboxConnectionHandlerOptions, type WorkspaceSandboxEnsureContext, type WorkspaceSandboxInstanceLike, type WorkspaceSandboxManager, type WorkspaceSandboxManagerOptions, type WorkspaceSandboxRuntimeProxyArgs, type WorkspaceSandboxRuntimeProxyHandlerOptions, type WorkspaceSandboxTerminalUpgradeHandlerOptions, type WriteProfileFilesOptions, attachReasoningEffort, bearerSubprotocolToken, bearerToken, buildAppToolMcpServers, buildSandboxRuntimeProxyHeaders, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, createSandboxTerminalToken, createWorkspaceSandboxConnectionHandler, createWorkspaceSandboxManager, createWorkspaceSandboxRuntimeProxyHandler, createWorkspaceSandboxTerminalUpgradeHandler, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, encodeSandboxRuntimePath, ensureWorkspaceSandbox, flattenHistory, getClient, isSandboxTerminalWsUpgrade, isTerminalPromptEvent, matchSandboxTerminalWsPath, mergeExtraMcp, mintSandboxScopedToken, mintTerminalProxyToken, readSecret, resetClientCache, resolveModel, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, splitDeferredProfileFiles, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, terminalTokenFromRequest, verifySandboxTerminalToken, verifyTerminalProxyToken, writeProfileFilesToBox };
459
+ export { type AppToolDescriptor, type AuthenticatedSandboxUser, type BuildAppToolMcpServersOptions, type BuildSandboxToolFileMountsOptions, DEFAULT_SANDBOX_RESOURCES, type EnsureWorkspaceSandboxOptions, type LivenessProbeConfig, type MemberSyncSeam, type Outcome, type ProfileComposeOptions, type ProviderResolutionConfig, type ResolveSandboxClientCredentialsOptions, type ResolvedModel, type SandboxApiCredentials, type SandboxBuildContext, type SandboxClientCredentials, type SandboxCredentialEnvironment, type SandboxPermissionLevel, type SandboxResourceConfig, type SandboxRestoreSpec, SandboxRuntimeAuthRefreshError, type SandboxRuntimeConfig, type SandboxRuntimeConnection, type SandboxScope, type SandboxStepTransition, type SandboxTerminalTokenOptions, type SandboxTerminalTokenResult, type SandboxTerminalTokenSubject, type SandboxTerminalWsMatch, type SandboxToolPathOptions, type SandboxToolSpec, type ScopedTokenResult, type SecretStore, type StreamSandboxPromptOptions, type TerminalProxyIdentity, type WorkspaceSandboxConnectionArgs, type WorkspaceSandboxConnectionHandlerOptions, type WorkspaceSandboxEnsureContext, type WorkspaceSandboxInstanceLike, type WorkspaceSandboxManager, type WorkspaceSandboxManagerOptions, type WorkspaceSandboxRuntimeProxyArgs, type WorkspaceSandboxRuntimeProxyHandlerOptions, type WorkspaceSandboxTerminalUpgradeHandlerOptions, type WriteProfileFilesOptions, attachReasoningEffort, bearerSubprotocolToken, bearerToken, buildAppToolMcpServers, buildSandboxRuntimeProxyHeaders, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, createSandboxTerminalToken, createWorkspaceSandboxConnectionHandler, createWorkspaceSandboxManager, createWorkspaceSandboxRuntimeProxyHandler, createWorkspaceSandboxTerminalUpgradeHandler, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, encodeSandboxRuntimePath, ensureWorkspaceSandbox, flattenHistory, getClient, isSandboxTerminalWsUpgrade, isTerminalPromptEvent, matchSandboxTerminalWsPath, mergeExtraMcp, mintSandboxScopedToken, mintTerminalProxyToken, readSecret, resetClientCache, resolveModel, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, splitDeferredProfileFiles, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, terminalTokenFromRequest, verifySandboxTerminalToken, verifyTerminalProxyToken, writeProfileFilesToBox };
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SANDBOX_RESOURCES,
3
+ SandboxRuntimeAuthRefreshError,
3
4
  attachReasoningEffort,
4
5
  bearerSubprotocolToken,
5
6
  bearerToken,
@@ -46,14 +47,15 @@ import {
46
47
  verifySandboxTerminalToken,
47
48
  verifyTerminalProxyToken,
48
49
  writeProfileFilesToBox
49
- } from "../chunk-CDYYR3Z7.js";
50
+ } from "../chunk-DBIG2PHS.js";
50
51
  import "../chunk-5VXPDXZJ.js";
51
- import "../chunk-VT5DI6GL.js";
52
- import "../chunk-A76ZHWNF.js";
52
+ import "../chunk-FDJ6JQCI.js";
53
+ import "../chunk-RH74YJIK.js";
53
54
  import "../chunk-7W5XSTUF.js";
54
- import "../chunk-JZZ6AWF4.js";
55
+ import "../chunk-PPSZNVKT.js";
55
56
  export {
56
57
  DEFAULT_SANDBOX_RESOURCES,
58
+ SandboxRuntimeAuthRefreshError,
57
59
  attachReasoningEffort,
58
60
  bearerSubprotocolToken,
59
61
  bearerToken,
@@ -1,9 +1,10 @@
1
1
  import { j as SequenceMediaKind, o as SequenceTimeline, r as TimelineInterval, m as SequenceStore } from '../store-gckrNq-g.js';
2
2
  export { M as MIN_SEQUENCE_CLIP_FRAMES, N as NewSequenceClip, a as NewSequenceDecision, b as NewSequenceTrack, S as SequenceClip, c as SequenceClipMedia, d as SequenceClipPatch, e as SequenceDecision, f as SequenceExportFormat, g as SequenceExportRecord, h as SequenceExportStatus, i as SequenceFrameSnapshot, k as SequenceMeta, l as SequenceStatus, n as SequenceStoreScope, p as SequenceTrack, q as SequenceTrackKind, T as TimelineClipBounds, s as assertClipFitsSequence, t as chooseCaptionPlacement, u as clampClipDuration, v as clampClipStart, w as formatSeconds, x as formatTimecode, y as framesToSeconds, z as secondsToFrames, A as snapshotFrame, B as trackIntervals } from '../store-gckrNq-g.js';
3
3
  export { A as AddCaptionOperation, C as CaptionTargetResolution, a as CreateTrackOperation, D as DeleteClipOperation, E as ExtendSequenceOperation, M as MoveClipOperation, P as PlaceClipOperation, Q as QueueExportOperation, S as SEQUENCE_OPERATION_TYPES, b as SequenceApplyResult, c as SequenceOperation, d as SequenceOperationContext, e as SequenceOperationType, f as SequencePlan, g as SetClipDisabledOperation, h as SetClipTextOperation, i as SplitClipOperation, T as TrimClipOperation, j as applySequenceOperation, k as applySequenceOperations, l as assertSequenceMediaUrl, m as captionTrackNameForLanguage, n as lastClipEndFrame, p as parseSequenceOperations, r as resolveCaptionPlacement, o as resolveCaptionTarget, q as resolvePlaceClipTrack, v as validateAddCaption, s as validateCreateTrack, t as validateDeleteClip, u as validateExtendSequence, w as validateMoveClip, x as validatePlaceClip, y as validateQueueExport, z as validateSequenceOperation, B as validateSequenceOperations, F as validateSetClipDisabled, G as validateSetClipText, H as validateSplitClip, I as validateTrimClip } from '../apply-Gk4raT2j.js';
4
- import { c as ToolHeaderNames } from '../auth-BlS9GWfL.js';
5
- import { A as AppToolMcpServer } from '../mcp-BShTlESm.js';
6
- import { b as AppToolContext } from '../types-2rOJo8Hc.js';
4
+ import { S as ScopedMcpServerEntryOptions, A as AppToolMcpServer } from '../mcp-4I_RHhNa.js';
5
+ export { M as SEQUENCES_MCP_PROTOCOL_VERSIONS } from '../mcp-rpc-DLw_r9PQ.js';
6
+ import '../types-wHs0rmtu.js';
7
+ import '../auth-DcK5ERaL.js';
7
8
 
8
9
  /**
9
10
  * Pure interchange-format builders over `SequenceTimeline` — SRT, WebVTT,
@@ -283,10 +284,6 @@ declare function findSequenceMcpTool(name: string): SequenceMcpToolDefinition |
283
284
  * is a thin adapter wiring the sequences tool list + playhead env.
284
285
  */
285
286
 
286
- /** Newest first. The handler echoes the client's requested version when
287
- * supported, else answers with the newest it speaks (per MCP negotiation the
288
- * client then disconnects if it cannot use it). */
289
- declare const SEQUENCES_MCP_PROTOCOL_VERSIONS: readonly ["2025-06-18", "2025-03-26", "2024-11-05"];
290
287
  interface SequencesMcpServerInfo {
291
288
  name: string;
292
289
  version: string;
@@ -304,29 +301,15 @@ declare function createSequencesMcpHandler(opts: CreateSequencesMcpHandlerOption
304
301
  /**
305
302
  * Profile entry for the sequences MCP server — what a product spreads into its
306
303
  * sandbox `AgentProfile.mcp` map so the in-sandbox agent gets the live
307
- * timeline channel. Same shape and conventions as the app-tool bridges in
308
- * ../tools/mcp: transport 'http', capability token in the Authorization
309
- * header (server-set, never a tool argument), identity headers when the
310
- * product recovers the user via `authenticateToolRequest`.
304
+ * timeline channel. A thin wrapper over the shared `buildScopedMcpServerEntry`
305
+ * mechanism (../tools/mcp): transport 'http', capability token in the
306
+ * Authorization header (server-set, never a tool argument). The only
307
+ * domain-specific values are this channel's default description and name.
311
308
  */
312
309
 
313
310
  declare const DEFAULT_SEQUENCES_MCP_DESCRIPTION = "Live timeline editor for the current video sequence: read timeline state, place/move/trim/split clips, add captions, manage tracks, and queue exports. All times are seconds.";
314
- interface BuildSequencesMcpServerEntryOptions {
315
- /** App base URL the sandbox reaches back to (trailing slash tolerated). */
316
- baseUrl: string;
317
- /** Product route serving `createSequencesMcpHandler` for ONE sequence —
318
- * the sequence id is part of the path, never a tool argument. */
319
- path: string;
320
- /** Capability token the product minted for this (user, sequence) scope.
321
- * With no token there is no entry to build — omit the server instead. */
322
- token: string;
323
- description?: string;
324
- /** Identity headers for products whose route recovers the user via
325
- * `authenticateToolRequest`. Omit when the bearer token is self-contained. */
326
- ctx?: AppToolContext;
327
- headerNames?: ToolHeaderNames;
328
- }
311
+ type BuildSequencesMcpServerEntryOptions = ScopedMcpServerEntryOptions;
329
312
  /** Build the `AgentProfileMcpServer`-shaped entry for the sequences channel. */
330
313
  declare function buildSequencesMcpServerEntry(opts: BuildSequencesMcpServerEntryOptions): AppToolMcpServer;
331
314
 
332
- export { type BuildCaptionChunksOptions, type BuildSequencesMcpServerEntryOptions, type CaptionChunk, type CaptionCoverageEntry, type CaptionExportOptions, type ContactSheetEntry, type ContactSheetManifest, type CreateSequencesMcpHandlerOptions, DEFAULT_SEQUENCES_MCP_DESCRIPTION, type LanguageFanoutOptions, MAX_CAPTION_BATCH, type OtioClip, type OtioExternalReference, type OtioGap, type OtioMissingReference, type OtioRationalTime, type OtioStack, type OtioTimeRange, type OtioTimeline, type OtioTrack, SEQUENCES_MCP_PROTOCOL_VERSIONS, SEQUENCE_EXPORT_FORMATS, SEQUENCE_MCP_TOOLS, SEQUENCE_MEDIA_KINDS, SEQUENCE_TRACK_KINDS, type SequenceMcpToolDefinition, type SequenceMcpToolEnv, SequenceMediaKind, SequenceStore, SequenceTimeline, type SequencesMcpServerInfo, TimelineInterval, type TranscriptSegment, buildCaptionChunks, buildContactSheetManifest, buildEdl, buildOtio, buildSequencesMcpServerEntry, buildSrt, buildVtt, captionCoverage, createSequencesMcpHandler, findSequenceMcpTool, normalizeLanguageTag, planLanguageFanout };
315
+ export { type BuildCaptionChunksOptions, type BuildSequencesMcpServerEntryOptions, type CaptionChunk, type CaptionCoverageEntry, type CaptionExportOptions, type ContactSheetEntry, type ContactSheetManifest, type CreateSequencesMcpHandlerOptions, DEFAULT_SEQUENCES_MCP_DESCRIPTION, type LanguageFanoutOptions, MAX_CAPTION_BATCH, type OtioClip, type OtioExternalReference, type OtioGap, type OtioMissingReference, type OtioRationalTime, type OtioStack, type OtioTimeRange, type OtioTimeline, type OtioTrack, SEQUENCE_EXPORT_FORMATS, SEQUENCE_MCP_TOOLS, SEQUENCE_MEDIA_KINDS, SEQUENCE_TRACK_KINDS, type SequenceMcpToolDefinition, type SequenceMcpToolEnv, SequenceMediaKind, SequenceStore, SequenceTimeline, type SequencesMcpServerInfo, TimelineInterval, type TranscriptSegment, buildCaptionChunks, buildContactSheetManifest, buildEdl, buildOtio, buildSequencesMcpServerEntry, buildSrt, buildVtt, captionCoverage, createSequencesMcpHandler, findSequenceMcpTool, normalizeLanguageTag, planLanguageFanout };
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SEQUENCES_MCP_DESCRIPTION,
3
3
  MAX_CAPTION_BATCH,
4
- SEQUENCES_MCP_PROTOCOL_VERSIONS,
5
4
  SEQUENCE_EXPORT_FORMATS,
6
5
  SEQUENCE_MCP_TOOLS,
7
6
  SEQUENCE_MEDIA_KINDS,
@@ -41,7 +40,7 @@ import {
41
40
  validateSetClipText,
42
41
  validateSplitClip,
43
42
  validateTrimClip
44
- } from "../chunk-JT6HHO5P.js";
43
+ } from "../chunk-BUUJ7TEQ.js";
45
44
  import {
46
45
  MIN_SEQUENCE_CLIP_FRAMES,
47
46
  assertClipFitsSequence,
@@ -56,12 +55,14 @@ import {
56
55
  trackIntervals
57
56
  } from "../chunk-ZYBWGSAZ.js";
58
57
  import "../chunk-HFC4BTWJ.js";
59
- import "../chunk-A76ZHWNF.js";
58
+ import {
59
+ MCP_PROTOCOL_VERSIONS
60
+ } from "../chunk-RH74YJIK.js";
60
61
  export {
61
62
  DEFAULT_SEQUENCES_MCP_DESCRIPTION,
62
63
  MAX_CAPTION_BATCH,
63
64
  MIN_SEQUENCE_CLIP_FRAMES,
64
- SEQUENCES_MCP_PROTOCOL_VERSIONS,
65
+ MCP_PROTOCOL_VERSIONS as SEQUENCES_MCP_PROTOCOL_VERSIONS,
65
66
  SEQUENCE_EXPORT_FORMATS,
66
67
  SEQUENCE_MCP_TOOLS,
67
68
  SEQUENCE_MEDIA_KINDS,
@@ -1,8 +1,8 @@
1
- import { a as AppToolName, c as ToolHeaderNames } from '../auth-BlS9GWfL.js';
2
- export { A as APP_TOOL_NAMES, b as AuthenticateOptions, D as DEFAULT_HEADER_NAMES, O as OpenAIFunctionTool, T as ToolAuthResult, d as authenticateToolRequest, e as buildAppToolOpenAITools, i as isAppToolName, r as readToolArgs } from '../auth-BlS9GWfL.js';
3
- import { f as AppToolTaxonomy, c as AppToolHandlers, b as AppToolContext, e as AppToolProducedEvent, d as AppToolOutcome } from '../types-2rOJo8Hc.js';
4
- export { A as AddCitationArgs, a as AddCitationResult, R as RenderUiArgs, g as RenderUiResult, S as ScheduleFollowupArgs, h as ScheduleFollowupResult, i as SubmitProposalArgs, j as SubmitProposalResult } from '../types-2rOJo8Hc.js';
5
- export { A as AppToolMcpServer, B as BuildHttpMcpServerOptions, a as BuildMcpServerOptions, D as DEFAULT_APP_TOOL_PATHS, b as buildAppToolMcpServer, c as buildHttpMcpServer } from '../mcp-BShTlESm.js';
1
+ import { a as AppToolName, c as ToolHeaderNames } from '../auth-DcK5ERaL.js';
2
+ export { A as APP_TOOL_NAMES, b as AuthenticateOptions, D as DEFAULT_HEADER_NAMES, O as OpenAIFunctionTool, T as ToolAuthResult, d as authenticateToolRequest, e as buildAppToolOpenAITools, i as isAppToolName, r as readToolArgs } from '../auth-DcK5ERaL.js';
3
+ import { f as AppToolTaxonomy, c as AppToolHandlers, b as AppToolContext, e as AppToolProducedEvent, d as AppToolOutcome } from '../types-wHs0rmtu.js';
4
+ export { A as AddCitationArgs, a as AddCitationResult, B as BuildAppToolsOptions, R as RenderUiArgs, g as RenderUiResult, S as ScheduleFollowupArgs, h as ScheduleFollowupResult, i as SubmitProposalArgs, j as SubmitProposalResult } from '../types-wHs0rmtu.js';
5
+ export { A as AppToolMcpServer, B as BuildHttpMcpServerOptions, a as BuildMcpServerOptions, D as DEFAULT_APP_TOOL_PATHS, S as ScopedMcpServerEntryOptions, b as buildAppToolMcpServer, c as buildHttpMcpServer, d as buildScopedMcpServerEntry } from '../mcp-4I_RHhNa.js';
6
6
  export { C as CreateMcpToolHandlerOptions, M as MCP_PROTOCOL_VERSIONS, a as McpProtocolVersion, b as McpServerInfo, c as McpToolDefinition, d as createMcpToolHandler } from '../mcp-rpc-DLw_r9PQ.js';
7
7
 
8
8
  /** A correctable bad-input error a tool handler throws; the HTTP layer maps it
@@ -6,7 +6,7 @@ import {
6
6
  restrictTaxonomy,
7
7
  verifyCapabilityToken,
8
8
  verifyExpiringCapabilityToken
9
- } from "../chunk-VT5DI6GL.js";
9
+ } from "../chunk-FDJ6JQCI.js";
10
10
  import {
11
11
  DEFAULT_APP_TOOL_PATHS,
12
12
  DEFAULT_HEADER_NAMES,
@@ -14,9 +14,10 @@ import {
14
14
  authenticateToolRequest,
15
15
  buildAppToolMcpServer,
16
16
  buildHttpMcpServer,
17
+ buildScopedMcpServerEntry,
17
18
  createMcpToolHandler,
18
19
  readToolArgs
19
- } from "../chunk-A76ZHWNF.js";
20
+ } from "../chunk-RH74YJIK.js";
20
21
  import {
21
22
  APP_TOOL_NAMES,
22
23
  ToolInputError,
@@ -25,7 +26,7 @@ import {
25
26
  dispatchAppTool,
26
27
  isAppToolName,
27
28
  outcomeStatus
28
- } from "../chunk-JZZ6AWF4.js";
29
+ } from "../chunk-PPSZNVKT.js";
29
30
  export {
30
31
  APP_TOOL_NAMES,
31
32
  DEFAULT_APP_TOOL_PATHS,
@@ -36,6 +37,7 @@ export {
36
37
  buildAppToolMcpServer,
37
38
  buildAppToolOpenAITools,
38
39
  buildHttpMcpServer,
40
+ buildScopedMcpServerEntry,
39
41
  createAppToolRuntimeExecutor,
40
42
  createCapabilityToken,
41
43
  createExpiringCapabilityToken,
@@ -37,6 +37,17 @@ interface AppToolTaxonomy {
37
37
  * approval executor. */
38
38
  regulatedTypes: readonly string[];
39
39
  }
40
+ /** Optional overrides for {@link buildAppToolOpenAITools}. The tool NAMES and
41
+ * JSON-Schema parameter shapes are mechanism (stable identifiers the model and
42
+ * both transports rely on); the model-facing PROSE and the follow-up priority
43
+ * vocabulary are domain — a product with no vault/contacts/OpenUI can retune
44
+ * them here instead of forking the shell. Omit for the defaults. */
45
+ interface BuildAppToolsOptions {
46
+ /** Override the model-facing description of any of the four tools. */
47
+ descriptions?: Partial<Record<'submit_proposal' | 'schedule_followup' | 'render_ui' | 'add_citation', string>>;
48
+ /** The `schedule_followup.priority` enum (defaults to `['low','medium','high']`). */
49
+ priorityValues?: readonly string[];
50
+ }
40
51
  interface SubmitProposalArgs {
41
52
  type: string;
42
53
  title: string;
@@ -131,4 +142,4 @@ type AppToolOutcome = {
131
142
  status?: number;
132
143
  };
133
144
 
134
- export type { AddCitationArgs as A, RenderUiArgs as R, ScheduleFollowupArgs as S, AddCitationResult as a, AppToolContext as b, AppToolHandlers as c, AppToolOutcome as d, AppToolProducedEvent as e, AppToolTaxonomy as f, RenderUiResult as g, ScheduleFollowupResult as h, SubmitProposalArgs as i, SubmitProposalResult as j };
145
+ export type { AddCitationArgs as A, BuildAppToolsOptions as B, RenderUiArgs as R, ScheduleFollowupArgs as S, AddCitationResult as a, AppToolContext as b, AppToolHandlers as c, AppToolOutcome as d, AppToolProducedEvent as e, AppToolTaxonomy as f, RenderUiResult as g, ScheduleFollowupResult as h, SubmitProposalArgs as i, SubmitProposalResult as j };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.39.0",
3
+ "version": "0.39.2",
4
4
  "packageManager": "pnpm@10.33.4",
5
5
  "description": "Application-shell framework for Tangle agent products: a bounded tool loop, the structured agent→app tool side channel, integration-hub client, per-workspace billing, and crypto — composed over the Tangle agent substrate through typed seams.",
6
6
  "keywords": [
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tools/auth.ts","../src/tools/mcp.ts","../src/tools/mcp-rpc.ts"],"sourcesContent":["import type { AppToolContext } from './types'\n\n/**\n * Header names carrying the server-set per-turn context + the capability token.\n * Defaults are product-neutral (`X-Agent-App-*`); a product that already ships\n * a header convention (e.g. `X-Acme-User-Id`) passes its own.\n */\nexport interface ToolHeaderNames {\n userId: string\n workspaceId: string\n threadId: string\n}\n\nexport const DEFAULT_HEADER_NAMES: ToolHeaderNames = {\n userId: 'X-Agent-App-User-Id',\n workspaceId: 'X-Agent-App-Workspace-Id',\n threadId: 'X-Agent-App-Thread-Id',\n}\n\nexport interface AuthenticateOptions {\n /** Verify the bearer capability token belongs to `userId`. The product's\n * HMAC/JWT impl — the seam that keeps token crypto out of this package. */\n verifyToken: (userId: string, bearer: string) => Promise<boolean>\n headerNames?: ToolHeaderNames\n}\n\nexport type ToolAuthResult =\n | { ok: true; ctx: AppToolContext }\n | { ok: false; response: Response }\n\n/**\n * Recover + verify the trusted context for a tool request. The user comes from\n * a server-set header and the bearer token MUST verify against THAT user; the\n * workspace comes from a header too — never from tool args — so the model can\n * neither forge identity nor target another workspace. Fail-closed: any missing\n * credential or a token minted for another user yields a 401/400 Response.\n */\nexport async function authenticateToolRequest(request: Request, opts: AuthenticateOptions): Promise<ToolAuthResult> {\n const h = opts.headerNames ?? DEFAULT_HEADER_NAMES\n const userId = request.headers.get(h.userId)?.trim()\n const workspaceId = request.headers.get(h.workspaceId)?.trim()\n const threadId = request.headers.get(h.threadId)?.trim() || null\n const bearer = request.headers.get('authorization')?.match(/^Bearer\\s+(.+)$/i)?.[1]\n\n if (!userId || !bearer) {\n return { ok: false, response: Response.json({ error: 'Missing capability credentials' }, { status: 401 }) }\n }\n if (!(await opts.verifyToken(userId, bearer))) {\n return { ok: false, response: Response.json({ error: 'Invalid capability token' }, { status: 401 }) }\n }\n if (!workspaceId) {\n return { ok: false, response: Response.json({ error: 'Missing workspace context' }, { status: 400 }) }\n }\n return { ok: true, ctx: { userId, workspaceId, threadId } }\n}\n\n/** Read a tool's argument object from the request body, tolerant of MCP host\n * aliases (`args` / `arguments`) or a bare body. Returns null on non-JSON. */\nexport async function readToolArgs<T>(request: Request): Promise<T | null> {\n let body: { args?: T; arguments?: T }\n try {\n body = (await request.json()) as typeof body\n } catch {\n return null\n }\n return (body.args ?? body.arguments ?? (body as T)) as T\n}\n","import type { AppToolContext } from './types'\nimport type { AppToolName } from './openai'\nimport type { ToolHeaderNames } from './auth'\nimport { DEFAULT_HEADER_NAMES } from './auth'\n\n/** Default route path each app tool is served at. A product mounts its routes\n * at these paths (or supplies its own via {@link BuildMcpServerOptions.paths}). */\nexport const DEFAULT_APP_TOOL_PATHS: Record<AppToolName, string> = {\n submit_proposal: '/api/tools/propose',\n schedule_followup: '/api/tools/followup',\n render_ui: '/api/tools/render-ui',\n add_citation: '/api/tools/citation',\n}\n\n/** The portable MCP server entry the sandbox SDK accepts (transport + url +\n * headers). Matches `AgentProfileMcpServer` structurally without importing the\n * sandbox SDK — products spread it into their profile's `mcp` map. */\nexport interface AppToolMcpServer {\n transport: 'http'\n url: string\n headers: Record<string, string>\n enabled: true\n metadata: { description: string }\n}\n\nexport interface BuildHttpMcpServerOptions {\n /** Route path on the app the sandbox POSTs to (e.g. `/api/tools/propose`). */\n path: string\n /** App base URL the sandbox reaches back to (no trailing slash required). */\n baseUrl: string\n /** Per-user capability token, baked into the Authorization header. */\n token: string\n ctx: AppToolContext\n /** Tool description the model sees. */\n description: string\n headerNames?: ToolHeaderNames\n}\n\n/**\n * Build ONE HTTP MCP server entry — the generic agent→app bridge. The\n * capability token + the user/workspace/thread ids ride in server-set headers\n * (never tool args), so the model can't forge identity or target another\n * workspace. Workspace/thread headers are omitted when their `ctx` value is\n * empty/null (e.g. an integration-invoke bridge that's user-scoped only). Used\n * directly for non-app-tool bridges (integration_invoke) and via\n * {@link buildAppToolMcpServer} for the four app tools.\n */\nexport function buildHttpMcpServer(opts: BuildHttpMcpServerOptions): AppToolMcpServer {\n const base = opts.baseUrl.replace(/\\/+$/, '')\n const h = opts.headerNames ?? DEFAULT_HEADER_NAMES\n return {\n transport: 'http',\n url: `${base}${opts.path}`,\n headers: {\n Authorization: `Bearer ${opts.token}`,\n [h.userId]: opts.ctx.userId,\n ...(opts.ctx.workspaceId ? { [h.workspaceId]: opts.ctx.workspaceId } : {}),\n ...(opts.ctx.threadId ? { [h.threadId]: opts.ctx.threadId } : {}),\n 'Content-Type': 'application/json',\n },\n enabled: true,\n metadata: { description: opts.description },\n }\n}\n\nexport interface BuildMcpServerOptions {\n tool: AppToolName\n baseUrl: string\n token: string\n ctx: AppToolContext\n description: string\n headerNames?: ToolHeaderNames\n paths?: Partial<Record<AppToolName, string>>\n}\n\n/** Build one of the four app-tool MCP servers — a thin wrapper over\n * {@link buildHttpMcpServer} that maps the tool name to its route path. */\nexport function buildAppToolMcpServer(opts: BuildMcpServerOptions): AppToolMcpServer {\n return buildHttpMcpServer({\n path: opts.paths?.[opts.tool] ?? DEFAULT_APP_TOOL_PATHS[opts.tool],\n baseUrl: opts.baseUrl,\n token: opts.token,\n ctx: opts.ctx,\n description: opts.description,\n headerNames: opts.headerNames,\n })\n}\n","/**\n * Generic streamable-HTTP JSON-RPC 2.0 envelope for a tools-only MCP server.\n * Stateless, Workers-compatible: no session table, no SSE — every request gets\n * a single `application/json` response, which the streamable-HTTP transport\n * explicitly permits for tools-only servers.\n *\n * Protocol surface:\n * initialize → echo client's protocolVersion if supported, else latest\n * ping → empty result {}\n * notifications/* (no `id`) → 202 with no body\n * tools/list → tool manifest\n * tools/call → run + surface execution failures as isError text results\n * anything else → -32601\n *\n * Execution failures (argument shape, validation, store throws) become `isError`\n * tool results carrying the thrown message verbatim — the model reads WHY and\n * retries. Protocol misuse becomes a JSON-RPC error object.\n */\n\nexport const MCP_PROTOCOL_VERSIONS = ['2025-06-18', '2025-03-26', '2024-11-05'] as const\nexport type McpProtocolVersion = (typeof MCP_PROTOCOL_VERSIONS)[number]\n\nconst LATEST_PROTOCOL_VERSION: McpProtocolVersion = MCP_PROTOCOL_VERSIONS[0]\n\nexport interface McpServerInfo {\n name: string\n version: string\n}\n\n/** One tool entry in the registry the handler owns. */\nexport interface McpToolDefinition<TEnv = Record<string, never>> {\n name: string\n description: string\n /** JSON Schema for the `params.arguments` object. */\n inputSchema: Record<string, unknown>\n /** Receive validated (Record) args + the env the handler threaded; throw to\n * surface an isError result — never throw for protocol/framing issues. */\n run(args: Record<string, unknown>, env: TEnv): Promise<unknown>\n}\n\nexport interface CreateMcpToolHandlerOptions<TEnv = Record<string, never>> {\n serverInfo: McpServerInfo\n /** Full tool list; order IS the tools/list order. */\n tools: McpToolDefinition<TEnv>[]\n /** Per-request environment threaded into every `run` call. If your tools are\n * stateless (or carry state through closure) pass an empty builder:\n * `() => ({} as TEnv)`. */\n buildEnv(request: Request): TEnv | Promise<TEnv>\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\ntype JsonRpcId = string | number | null\n\ninterface ToolCallContent {\n content: Array<{ type: 'text'; text: string }>\n isError?: true\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction rpcResult(id: JsonRpcId, result: unknown): Response {\n return Response.json({ jsonrpc: '2.0', id, result })\n}\n\nfunction rpcError(id: JsonRpcId, code: number, message: string, status = 200): Response {\n return Response.json({ jsonrpc: '2.0', id, error: { code, message } }, { status })\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\n/**\n * Build a request handler for a tools-only MCP server. The returned function\n * accepts a standard `Request` and resolves to a `Response` — mount it on any\n * Cloudflare Worker route or Remix `loader`.\n *\n * The handler calls `buildEnv` exactly ONCE per `tools/call` request (after\n * the tool is found, before `run`) — non-`tools/call` paths skip it entirely\n * so metadata requests do not pay env-build cost.\n */\nexport function createMcpToolHandler<TEnv = Record<string, never>>(\n opts: CreateMcpToolHandlerOptions<TEnv>,\n): (request: Request) => Promise<Response> {\n const toolMap = new Map<string, McpToolDefinition<TEnv>>()\n for (const tool of opts.tools) {\n if (toolMap.has(tool.name)) throw new Error(`duplicate MCP tool name: ${tool.name}`)\n toolMap.set(tool.name, tool)\n }\n\n return async (request: Request): Promise<Response> => {\n if (request.method !== 'POST') {\n return new Response('MCP server accepts JSON-RPC 2.0 over POST only', {\n status: 405,\n headers: { Allow: 'POST' },\n })\n }\n\n let body: unknown\n try {\n body = await request.json()\n } catch {\n return rpcError(null, -32700, 'Parse error: request body is not valid JSON', 400)\n }\n\n if (Array.isArray(body)) {\n return rpcError(null, -32600, 'Invalid request: JSON-RPC batching is not supported', 400)\n }\n if (!isRecord(body) || body.jsonrpc !== '2.0' || typeof body.method !== 'string') {\n return rpcError(\n null,\n -32600,\n 'Invalid request: expected a JSON-RPC 2.0 object with jsonrpc \"2.0\" and a string method',\n 400,\n )\n }\n\n const method = body.method\n const params = isRecord(body.params) ? body.params : {}\n\n // Notifications have no `id` — acknowledge without a JSON-RPC body.\n if (!('id' in body) || body.id === undefined) {\n return new Response(null, { status: 202 })\n }\n const id = body.id as JsonRpcId\n\n switch (method) {\n case 'initialize': {\n const requested = typeof params.protocolVersion === 'string' ? params.protocolVersion : undefined\n const protocolVersion =\n requested !== undefined && (MCP_PROTOCOL_VERSIONS as readonly string[]).includes(requested)\n ? requested\n : LATEST_PROTOCOL_VERSION\n return rpcResult(id, {\n protocolVersion,\n capabilities: { tools: { listChanged: false } },\n serverInfo: opts.serverInfo,\n })\n }\n\n case 'ping':\n return rpcResult(id, {})\n\n case 'tools/list':\n return rpcResult(id, {\n tools: opts.tools.map((tool) => ({\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n })),\n })\n\n case 'tools/call': {\n const name = params.name\n if (typeof name !== 'string' || name.length === 0) {\n return rpcError(id, -32602, 'tools/call requires params.name (string)')\n }\n const tool = toolMap.get(name)\n if (!tool) {\n return rpcError(\n id,\n -32602,\n `Unknown tool: ${name}. Available tools: ${opts.tools.map((t) => t.name).join(', ')}`,\n )\n }\n if (params.arguments !== undefined && !isRecord(params.arguments)) {\n return rpcError(id, -32602, 'tools/call params.arguments must be an object when provided')\n }\n const args = isRecord(params.arguments) ? params.arguments : {}\n let env: TEnv\n try {\n env = await opts.buildEnv(request)\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n const payload: ToolCallContent = {\n content: [{ type: 'text', text: `${name} failed to build env: ${message}` }],\n isError: true,\n }\n return rpcResult(id, payload)\n }\n try {\n const result = await tool.run(args, env)\n const payload: ToolCallContent = { content: [{ type: 'text', text: JSON.stringify(result) }] }\n return rpcResult(id, payload)\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n const payload: ToolCallContent = {\n content: [{ type: 'text', text: `${name} failed: ${message}` }],\n isError: true,\n }\n return rpcResult(id, payload)\n }\n }\n\n default:\n return rpcError(id, -32601, `Method not found: ${method}`)\n }\n }\n}\n"],"mappings":";AAaO,IAAM,uBAAwC;AAAA,EACnD,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,UAAU;AACZ;AAoBA,eAAsB,wBAAwB,SAAkB,MAAoD;AAClH,QAAM,IAAI,KAAK,eAAe;AAC9B,QAAM,SAAS,QAAQ,QAAQ,IAAI,EAAE,MAAM,GAAG,KAAK;AACnD,QAAM,cAAc,QAAQ,QAAQ,IAAI,EAAE,WAAW,GAAG,KAAK;AAC7D,QAAM,WAAW,QAAQ,QAAQ,IAAI,EAAE,QAAQ,GAAG,KAAK,KAAK;AAC5D,QAAM,SAAS,QAAQ,QAAQ,IAAI,eAAe,GAAG,MAAM,kBAAkB,IAAI,CAAC;AAElF,MAAI,CAAC,UAAU,CAAC,QAAQ;AACtB,WAAO,EAAE,IAAI,OAAO,UAAU,SAAS,KAAK,EAAE,OAAO,iCAAiC,GAAG,EAAE,QAAQ,IAAI,CAAC,EAAE;AAAA,EAC5G;AACA,MAAI,CAAE,MAAM,KAAK,YAAY,QAAQ,MAAM,GAAI;AAC7C,WAAO,EAAE,IAAI,OAAO,UAAU,SAAS,KAAK,EAAE,OAAO,2BAA2B,GAAG,EAAE,QAAQ,IAAI,CAAC,EAAE;AAAA,EACtG;AACA,MAAI,CAAC,aAAa;AAChB,WAAO,EAAE,IAAI,OAAO,UAAU,SAAS,KAAK,EAAE,OAAO,4BAA4B,GAAG,EAAE,QAAQ,IAAI,CAAC,EAAE;AAAA,EACvG;AACA,SAAO,EAAE,IAAI,MAAM,KAAK,EAAE,QAAQ,aAAa,SAAS,EAAE;AAC5D;AAIA,eAAsB,aAAgB,SAAqC;AACzE,MAAI;AACJ,MAAI;AACF,WAAQ,MAAM,QAAQ,KA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