@wolpertingerlabs/drawlatch 1.0.0-alpha.3 → 1.0.0-alpha.35

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 (123) hide show
  1. package/CONNECTIONS.md +3 -0
  2. package/README.md +393 -465
  3. package/bin/drawlatch.js +1151 -49
  4. package/dist/auth/auth.d.ts +10 -0
  5. package/dist/auth/auth.js +146 -0
  6. package/dist/auth/env-writer.d.ts +6 -0
  7. package/dist/auth/env-writer.js +52 -0
  8. package/dist/auth/password.d.ts +8 -0
  9. package/dist/auth/password.js +28 -0
  10. package/dist/auth/sessions.d.ts +13 -0
  11. package/dist/auth/sessions.js +85 -0
  12. package/dist/cli/generate-keys.d.ts +4 -4
  13. package/dist/cli/generate-keys.js +30 -25
  14. package/dist/connections/{anthropic.json → ai/anthropic.json} +19 -1
  15. package/dist/connections/{devin.json → ai/devin.json} +7 -1
  16. package/dist/connections/{google-ai.json → ai/google-ai.json} +7 -1
  17. package/dist/connections/{openai.json → ai/openai.json} +7 -1
  18. package/dist/connections/{openrouter.json → ai/openrouter.json} +7 -1
  19. package/dist/connections/developer-tools/github.json +138 -0
  20. package/dist/connections/{hex.json → developer-tools/hex.json} +7 -1
  21. package/dist/connections/developer-tools/linear.json +75 -0
  22. package/dist/connections/{lichess.json → gaming/lichess.json} +7 -1
  23. package/dist/connections/messaging/agentmail.json +21 -0
  24. package/dist/connections/messaging/discord-bot.json +114 -0
  25. package/dist/connections/{discord-oauth.json → messaging/discord-oauth.json} +7 -1
  26. package/dist/connections/messaging/slack.json +75 -0
  27. package/dist/connections/messaging/telegram.json +66 -0
  28. package/dist/connections/{google.json → productivity/google.json} +7 -1
  29. package/dist/connections/productivity/notion.json +75 -0
  30. package/dist/connections/productivity/stripe.json +74 -0
  31. package/dist/connections/productivity/trello.json +113 -0
  32. package/dist/connections/{bluesky.json → social-media/bluesky.json} +41 -0
  33. package/dist/connections/social-media/mastodon.json +65 -0
  34. package/dist/connections/social-media/reddit.json +80 -0
  35. package/dist/connections/{twitch.json → social-media/twitch.json} +40 -0
  36. package/dist/connections/social-media/x.json +67 -0
  37. package/dist/mcp/server.js +544 -31
  38. package/dist/remote/admin-mutations.d.ts +43 -0
  39. package/dist/remote/admin-mutations.js +321 -0
  40. package/dist/remote/admin-types.d.ts +153 -0
  41. package/dist/remote/admin-types.js +11 -0
  42. package/dist/remote/admin.d.ts +37 -0
  43. package/dist/remote/admin.js +317 -0
  44. package/dist/remote/caller-bootstrap.d.ts +121 -0
  45. package/dist/remote/caller-bootstrap.js +270 -0
  46. package/dist/remote/ingestors/base-ingestor.d.ts +19 -3
  47. package/dist/remote/ingestors/base-ingestor.js +27 -6
  48. package/dist/remote/ingestors/discord/discord-gateway.d.ts +2 -2
  49. package/dist/remote/ingestors/discord/discord-gateway.js +29 -6
  50. package/dist/remote/ingestors/e2e/setup.d.ts +69 -0
  51. package/dist/remote/ingestors/e2e/setup.js +147 -0
  52. package/dist/remote/ingestors/manager.d.ts +110 -10
  53. package/dist/remote/ingestors/manager.js +449 -42
  54. package/dist/remote/ingestors/poll/poll-ingestor.d.ts +4 -2
  55. package/dist/remote/ingestors/poll/poll-ingestor.js +26 -5
  56. package/dist/remote/ingestors/registry.d.ts +2 -2
  57. package/dist/remote/ingestors/registry.js +2 -2
  58. package/dist/remote/ingestors/slack/socket-mode.d.ts +2 -2
  59. package/dist/remote/ingestors/slack/socket-mode.js +28 -6
  60. package/dist/remote/ingestors/types.d.ts +25 -0
  61. package/dist/remote/ingestors/webhook/base-webhook-ingestor.d.ts +46 -7
  62. package/dist/remote/ingestors/webhook/base-webhook-ingestor.js +115 -10
  63. package/dist/remote/ingestors/webhook/github-webhook-ingestor.d.ts +30 -0
  64. package/dist/remote/ingestors/webhook/github-webhook-ingestor.js +73 -2
  65. package/dist/remote/ingestors/webhook/lifecycle-types.d.ts +63 -0
  66. package/dist/remote/ingestors/webhook/lifecycle-types.js +12 -0
  67. package/dist/remote/ingestors/webhook/stripe-webhook-ingestor.js +2 -2
  68. package/dist/remote/ingestors/webhook/trello-webhook-ingestor.d.ts +17 -5
  69. package/dist/remote/ingestors/webhook/trello-webhook-ingestor.js +32 -26
  70. package/dist/remote/ingestors/webhook/webhook-lifecycle-manager.d.ts +46 -0
  71. package/dist/remote/ingestors/webhook/webhook-lifecycle-manager.js +261 -0
  72. package/dist/remote/server.d.ts +25 -33
  73. package/dist/remote/server.js +596 -187
  74. package/dist/remote/tool-dispatch.d.ts +84 -0
  75. package/dist/remote/tool-dispatch.js +910 -0
  76. package/dist/remote/triggers/rule-engine.d.ts +40 -0
  77. package/dist/remote/triggers/rule-engine.js +228 -0
  78. package/dist/remote/triggers/types.d.ts +69 -0
  79. package/dist/remote/triggers/types.js +10 -0
  80. package/dist/remote/tunnel-state.d.ts +14 -0
  81. package/dist/remote/tunnel-state.js +20 -0
  82. package/dist/remote/tunnel.d.ts +13 -0
  83. package/dist/remote/tunnel.js +33 -0
  84. package/dist/shared/config.d.ts +104 -25
  85. package/dist/shared/config.js +49 -36
  86. package/dist/shared/connections.d.ts +21 -5
  87. package/dist/shared/connections.js +56 -14
  88. package/dist/shared/crypto/index.d.ts +1 -0
  89. package/dist/shared/crypto/index.js +1 -0
  90. package/dist/shared/crypto/key-manager.d.ts +81 -0
  91. package/dist/shared/crypto/key-manager.js +174 -0
  92. package/dist/shared/env-utils.d.ts +42 -0
  93. package/dist/shared/env-utils.js +150 -0
  94. package/dist/shared/listener-config.d.ts +157 -0
  95. package/dist/shared/listener-config.js +10 -0
  96. package/dist/shared/migrations.d.ts +40 -0
  97. package/dist/shared/migrations.js +122 -0
  98. package/dist/shared/protocol/caller-bundle-crypto.d.ts +37 -0
  99. package/dist/shared/protocol/caller-bundle-crypto.js +62 -0
  100. package/dist/shared/protocol/caller-bundle.d.ts +75 -0
  101. package/dist/shared/protocol/caller-bundle.js +24 -0
  102. package/dist/shared/protocol/handshake.js +14 -1
  103. package/dist/shared/protocol/index.d.ts +2 -0
  104. package/dist/shared/protocol/index.js +2 -0
  105. package/dist/shared/protocol/sync-client.d.ts +52 -0
  106. package/dist/shared/protocol/sync-client.js +99 -0
  107. package/dist/shared/protocol/sync.d.ts +71 -0
  108. package/dist/shared/protocol/sync.js +176 -0
  109. package/frontend/dist/assets/index-BdCSPSZK.js +282 -0
  110. package/frontend/dist/assets/index-BmK26bY2.css +1 -0
  111. package/frontend/dist/index.html +15 -0
  112. package/package.json +65 -13
  113. package/dist/connections/discord-bot.json +0 -24
  114. package/dist/connections/github.json +0 -25
  115. package/dist/connections/linear.json +0 -29
  116. package/dist/connections/mastodon.json +0 -25
  117. package/dist/connections/notion.json +0 -33
  118. package/dist/connections/reddit.json +0 -28
  119. package/dist/connections/slack.json +0 -23
  120. package/dist/connections/stripe.json +0 -25
  121. package/dist/connections/telegram.json +0 -26
  122. package/dist/connections/trello.json +0 -25
  123. package/dist/connections/x.json +0 -27
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Canonical MCP tool implementations — the single source of truth.
3
+ *
4
+ * These handlers implement every proxy/management tool drawlatch exposes:
5
+ * http_request, list_routes, poll_events, ingestor_status,
6
+ * test_connection, test_ingestor, control_listener,
7
+ * list_listener_configs, resolve_listener_options,
8
+ * get/set_listener_params, list/delete_listener_instance,
9
+ * list_connection_templates, set_connection_enabled,
10
+ * set_secrets, get_secret_status.
11
+ *
12
+ * Consumed by:
13
+ * - The remote secure server's `/request` dispatch (src/remote/server.ts)
14
+ * - The password-gated admin API (src/remote/admin-mutations.ts)
15
+ * - Any in-process host (e.g. callboard) that imports
16
+ * `@wolpertingerlabs/drawlatch/remote/tool-dispatch` instead of
17
+ * re-implementing a LocalProxy.
18
+ *
19
+ * Pure in the sense that handlers take `routes` + `context` as input rather
20
+ * than reading global session state. The only side effects are the outbound
21
+ * fetch() and config/.env writes (which mirror what the live daemon does).
22
+ */
23
+ import { type ResolvedRoute } from '../shared/config.js';
24
+ import type { IngestorManager } from './ingestors/index.js';
25
+ export declare function isEndpointAllowed(url: string, patterns: string[]): boolean;
26
+ /**
27
+ * Find the first route whose allowedEndpoints match the given URL.
28
+ * Routes with empty allowedEndpoints match nothing.
29
+ */
30
+ export declare function matchRoute(url: string, routes: ResolvedRoute[]): ResolvedRoute | null;
31
+ /** A file attachment transmitted as base64 data through the encrypted channel. */
32
+ export interface FileAttachment {
33
+ /** Form field name (e.g., "files[0]", "file", "attachment") */
34
+ field: string;
35
+ /** Base64-encoded file content */
36
+ data: string;
37
+ /** Filename for the upload */
38
+ filename: string;
39
+ /** MIME type (e.g., "image/png", "application/pdf") */
40
+ contentType: string;
41
+ }
42
+ export interface ProxyRequestInput {
43
+ method: string;
44
+ url: string;
45
+ headers?: Record<string, string>;
46
+ body?: unknown;
47
+ /** File attachments — triggers multipart/form-data encoding */
48
+ files?: FileAttachment[];
49
+ /** Form field name for the JSON body part (default: "payload_json") */
50
+ bodyFieldName?: string;
51
+ }
52
+ export interface ProxyRequestResult {
53
+ status: number;
54
+ statusText: string;
55
+ headers: Record<string, string>;
56
+ body: unknown;
57
+ }
58
+ /**
59
+ * Core proxy request execution — route matching, secret injection, and fetch.
60
+ *
61
+ * Pure in the sense that it takes routes as input rather than reading global
62
+ * state. The only side effect is the outbound fetch().
63
+ */
64
+ export declare function executeProxyRequest(input: ProxyRequestInput, routes: ResolvedRoute[]): Promise<ProxyRequestResult>;
65
+ /** Context passed to every tool handler, providing caller identity and shared services. */
66
+ export interface ToolContext {
67
+ /** The caller alias for the session making this request. */
68
+ callerAlias: string;
69
+ /** The shared ingestor manager (for poll_events / ingestor_status). */
70
+ ingestorManager: IngestorManager;
71
+ /** Re-resolve routes for all sessions belonging to this caller.
72
+ * Call after secrets or connection list changes. */
73
+ refreshRoutes: () => void;
74
+ }
75
+ export type ToolHandler = (input: Record<string, unknown>, routes: ResolvedRoute[], context: ToolContext) => Promise<unknown> | object;
76
+ export declare const toolHandlers: Record<string, ToolHandler>;
77
+ /**
78
+ * Dispatch a single tool call by name. Throws on unknown tool.
79
+ *
80
+ * The canonical entry point for in-process hosts (admin API, callboard) that
81
+ * want to invoke a tool without going through the encrypted `/request` path.
82
+ */
83
+ export declare function dispatchTool(toolName: string, input: Record<string, unknown>, routes: ResolvedRoute[], context: ToolContext): Promise<unknown>;
84
+ //# sourceMappingURL=tool-dispatch.d.ts.map