@gethelio/proxy 0.2.0 → 0.4.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/cli.js +743 -94
- package/dist/index.d.ts +64 -8
- package/dist/index.js +738 -86
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -81,6 +81,11 @@ declare const policiesSchema: z.ZodObject<{
|
|
|
81
81
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
82
82
|
}, z.core.$strict>>;
|
|
83
83
|
}, z.core.$strict>>>;
|
|
84
|
+
on_tool_drift: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
require_approval: "require_approval";
|
|
86
|
+
log: "log";
|
|
87
|
+
block: "block";
|
|
88
|
+
}>>;
|
|
84
89
|
hot_reload: z.ZodOptional<z.ZodBoolean>;
|
|
85
90
|
}, z.core.$strict>;
|
|
86
91
|
declare const approvalChannelSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -204,6 +209,11 @@ declare const helioConfigSchema: z.ZodObject<{
|
|
|
204
209
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
205
210
|
}, z.core.$strict>>;
|
|
206
211
|
}, z.core.$strict>>>;
|
|
212
|
+
on_tool_drift: z.ZodOptional<z.ZodEnum<{
|
|
213
|
+
require_approval: "require_approval";
|
|
214
|
+
log: "log";
|
|
215
|
+
block: "block";
|
|
216
|
+
}>>;
|
|
207
217
|
hot_reload: z.ZodOptional<z.ZodBoolean>;
|
|
208
218
|
}, z.core.$strict>>;
|
|
209
219
|
approval: z.ZodPrefault<z.ZodObject<{
|
|
@@ -366,6 +376,11 @@ interface CompiledPolicy {
|
|
|
366
376
|
readonly defaultAction: 'allow' | 'deny';
|
|
367
377
|
readonly flagDestructive?: 'log' | 'require_approval';
|
|
368
378
|
readonly dryRun?: boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Response to tool definition drift (issue #25). Undefined means "block"
|
|
381
|
+
* at the use site — conservative by default.
|
|
382
|
+
*/
|
|
383
|
+
readonly onToolDrift?: 'block' | 'require_approval' | 'log';
|
|
369
384
|
readonly rules: readonly CompiledPolicyRule[];
|
|
370
385
|
}
|
|
371
386
|
/** A non-fatal warning produced during policy compilation. */
|
|
@@ -484,8 +499,7 @@ declare function startServer(app: Hono, config: HelioConfig): ServerHandle;
|
|
|
484
499
|
*/
|
|
485
500
|
declare function startSidebandServer(app: Hono, port: number, host?: string): ServerHandle;
|
|
486
501
|
|
|
487
|
-
|
|
488
|
-
interface UpstreamForwarderOptions {
|
|
502
|
+
interface StreamableHttpForwarderOptions {
|
|
489
503
|
/** The upstream MCP server URL (e.g. "http://localhost:8080/mcp"). */
|
|
490
504
|
url: string;
|
|
491
505
|
/** Static headers to include on every upstream request (e.g. API keys). */
|
|
@@ -494,17 +508,44 @@ interface UpstreamForwarderOptions {
|
|
|
494
508
|
requestTimeoutMs?: number;
|
|
495
509
|
}
|
|
496
510
|
/**
|
|
497
|
-
*
|
|
511
|
+
* Spec-compliant upstream MCP Streamable HTTP client.
|
|
498
512
|
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
513
|
+
* Parses both `application/json` and `text/event-stream` POST responses, sends
|
|
514
|
+
* the negotiated protocol version, relays the upstream session id back
|
|
515
|
+
* downstream, and — for Helio-internal requests with no downstream session —
|
|
516
|
+
* borrows an internally-managed session established via `initialize`.
|
|
501
517
|
*/
|
|
502
|
-
declare class
|
|
518
|
+
declare class StreamableHttpForwarder implements McpForwarder {
|
|
503
519
|
private readonly url;
|
|
504
520
|
private readonly staticHeaders;
|
|
505
521
|
private readonly requestTimeoutMs;
|
|
506
|
-
|
|
522
|
+
private readonly sessions;
|
|
523
|
+
constructor(options: StreamableHttpForwarderOptions);
|
|
524
|
+
/** Lifecycle parity with sse/stdio. No eager connect — sessions are lazy. */
|
|
525
|
+
connect(): Promise<void>;
|
|
526
|
+
/** Lifecycle parity with sse/stdio. */
|
|
527
|
+
close(): Promise<void>;
|
|
507
528
|
forward(request: McpRequest): Promise<ForwardResult>;
|
|
529
|
+
/**
|
|
530
|
+
* Helio-internal execution path (startup prime / internal maintenance) that
|
|
531
|
+
* may borrow the proxy-managed internal session.
|
|
532
|
+
*/
|
|
533
|
+
forwardInternal(request: McpRequest): Promise<ForwardResult>;
|
|
534
|
+
private send;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/** Options for constructing an UpstreamForwarder. */
|
|
538
|
+
type UpstreamForwarderOptions = StreamableHttpForwarderOptions;
|
|
539
|
+
/**
|
|
540
|
+
* @deprecated Use `StreamableHttpForwarder` directly for new code.
|
|
541
|
+
*
|
|
542
|
+
* Backward-compatible alias for older integrations that imported
|
|
543
|
+
* `UpstreamForwarder`. Kept to avoid a breaking API change.
|
|
544
|
+
*
|
|
545
|
+
* Behavior matches `StreamableHttpForwarder` (including Streamable HTTP SSE
|
|
546
|
+
* response parsing and managed internal session support).
|
|
547
|
+
*/
|
|
548
|
+
declare class UpstreamForwarder extends StreamableHttpForwarder {
|
|
508
549
|
}
|
|
509
550
|
|
|
510
551
|
/** Options for constructing an SseUpstreamForwarder. */
|
|
@@ -1583,9 +1624,23 @@ declare class GovernedForwarder implements McpForwarder {
|
|
|
1583
1624
|
*
|
|
1584
1625
|
* This path is intended for startup warm-up and intentionally bypasses policy
|
|
1585
1626
|
* and audit handling. Runtime tools/list requests still flow through forward().
|
|
1627
|
+
*
|
|
1628
|
+
* When the inner forwarder exposes `forwardInternal` (duck-typed), the prime
|
|
1629
|
+
* request is routed through it so session-enforcing servers (e.g. Streamable
|
|
1630
|
+
* HTTP upstreams) receive the request on the managed internal session rather
|
|
1631
|
+
* than as a sessionless call that they would reject with HTTP 400.
|
|
1586
1632
|
*/
|
|
1587
1633
|
primeAnnotationCache(): Promise<AnnotationCachePrimeResult>;
|
|
1588
1634
|
forward(request: McpRequest): Promise<ForwardResult>;
|
|
1635
|
+
/**
|
|
1636
|
+
* Apply a tools/list response to the definition cache and surface any
|
|
1637
|
+
* drift: console warning + immediate audit record per event. Single entry
|
|
1638
|
+
* point for both runtime tools/list responses and startup priming, so the
|
|
1639
|
+
* cache is updated exactly once per response.
|
|
1640
|
+
*/
|
|
1641
|
+
private applyToolDefinitionUpdate;
|
|
1642
|
+
/** Write an immediate audit record for a drift event (not a tool call). */
|
|
1643
|
+
private writeDriftAuditRecord;
|
|
1589
1644
|
private handleToolsCall;
|
|
1590
1645
|
private handleApproval;
|
|
1591
1646
|
private handleRateLimit;
|
|
@@ -1600,6 +1655,7 @@ declare class GovernedForwarder implements McpForwarder {
|
|
|
1600
1655
|
/** Determine if the request was actually forwarded to the upstream MCP server. */
|
|
1601
1656
|
private wasForwardedUpstream;
|
|
1602
1657
|
private writeAuditRecord;
|
|
1658
|
+
private makeDriftBlockResult;
|
|
1603
1659
|
private makeDenyResult;
|
|
1604
1660
|
private makePolicyMisconfiguredResult;
|
|
1605
1661
|
private makeUnsupportedResult;
|
|
@@ -1872,4 +1928,4 @@ interface DashboardAppOptions {
|
|
|
1872
1928
|
*/
|
|
1873
1929
|
declare function createDashboardApp(deps: DashboardAppDeps, options?: DashboardAppOptions): Hono;
|
|
1874
1930
|
|
|
1875
|
-
export { type ApprovalAppOptions, type ApprovalChannel, type ApprovalOutcome, ApprovalQueue, type ApprovalQueueOptions, ApprovalRouter, type ApprovalRouterOptions, type ApprovalStatus, type ApprovalTicket, type AuditAggregateStats, type AuditListResult, type AuditPaginationOptions, type AuditQueryFilters, type AuditRecord, AuditStore, type AuditStoreOptions, type AuditTimeBucket, AuditWriter, type AuditWriterOptions, type CompilePoliciesResult, type CompiledPolicy, type CompiledPolicyRule, ConfigError, type CreateAppOptions, type DashboardAppDeps, type DashboardAppOptions, DashboardEventBus, type DashboardEventType, type DashboardEvents, type EvidenceEntry, EvidenceStore, type EvidenceStoreOptions, GovernedForwarder, type GovernedForwarderOptions, type HelioConfig, type MatchContext, type PolicyDecision, PolicyParseError, QueueChannel, type RateLimitCheckParams, type RateLimitKeyState, type RateLimitResult, RateLimiter, type RateLimiterOptions, type ServerHandle, type SessionState, type SlackActionAppOptions, SlackChannel, type SlackChannelOptions, type SpendLimitCheckParams, type SpendLimitKeyState, type SpendLimitResult, SpendLimiter, type SpendLimiterOptions, SseUpstreamForwarder, type SseUpstreamForwarderOptions, StdioForwarder, type StdioForwarderOptions, UpstreamForwarder, type UpstreamForwarderOptions, VERSION, WebhookChannel, type WebhookChannelOptions, compilePolicies, createApp, createApprovalApp, createChannels, createDashboardApp, createSidebandApp, createSlackActionApp, evaluatePolicy, loadConfig, matchRule, startServer, startSidebandServer };
|
|
1931
|
+
export { type ApprovalAppOptions, type ApprovalChannel, type ApprovalOutcome, ApprovalQueue, type ApprovalQueueOptions, ApprovalRouter, type ApprovalRouterOptions, type ApprovalStatus, type ApprovalTicket, type AuditAggregateStats, type AuditListResult, type AuditPaginationOptions, type AuditQueryFilters, type AuditRecord, AuditStore, type AuditStoreOptions, type AuditTimeBucket, AuditWriter, type AuditWriterOptions, type CompilePoliciesResult, type CompiledPolicy, type CompiledPolicyRule, ConfigError, type CreateAppOptions, type DashboardAppDeps, type DashboardAppOptions, DashboardEventBus, type DashboardEventType, type DashboardEvents, type EvidenceEntry, EvidenceStore, type EvidenceStoreOptions, GovernedForwarder, type GovernedForwarderOptions, type HelioConfig, type MatchContext, type PolicyDecision, PolicyParseError, QueueChannel, type RateLimitCheckParams, type RateLimitKeyState, type RateLimitResult, RateLimiter, type RateLimiterOptions, type ServerHandle, type SessionState, type SlackActionAppOptions, SlackChannel, type SlackChannelOptions, type SpendLimitCheckParams, type SpendLimitKeyState, type SpendLimitResult, SpendLimiter, type SpendLimiterOptions, SseUpstreamForwarder, type SseUpstreamForwarderOptions, StdioForwarder, type StdioForwarderOptions, StreamableHttpForwarder, type StreamableHttpForwarderOptions, UpstreamForwarder, type UpstreamForwarderOptions, VERSION, WebhookChannel, type WebhookChannelOptions, compilePolicies, createApp, createApprovalApp, createChannels, createDashboardApp, createSidebandApp, createSlackActionApp, evaluatePolicy, loadConfig, matchRule, startServer, startSidebandServer };
|