patchwork-os 0.2.0-alpha.35 → 0.2.0-alpha.37
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 +70 -15
- package/dist/activityLog.d.ts +49 -0
- package/dist/activityLog.js +78 -0
- package/dist/activityLog.js.map +1 -1
- package/dist/approvalHttp.d.ts +25 -0
- package/dist/approvalHttp.js +74 -18
- package/dist/approvalHttp.js.map +1 -1
- package/dist/approvalInsights.d.ts +49 -0
- package/dist/approvalInsights.js +97 -0
- package/dist/approvalInsights.js.map +1 -0
- package/dist/approvalQueue.d.ts +11 -0
- package/dist/approvalQueue.js +80 -1
- package/dist/approvalQueue.js.map +1 -1
- package/dist/approvalSignals.d.ts +124 -0
- package/dist/approvalSignals.js +512 -0
- package/dist/approvalSignals.js.map +1 -0
- package/dist/automation.d.ts +37 -0
- package/dist/automation.js +105 -61
- package/dist/automation.js.map +1 -1
- package/dist/automationSuggestions.d.ts +79 -0
- package/dist/automationSuggestions.js +150 -0
- package/dist/automationSuggestions.js.map +1 -0
- package/dist/bridge.js +46 -0
- package/dist/bridge.js.map +1 -1
- package/dist/ccPermissions.d.ts +15 -0
- package/dist/ccPermissions.js +15 -0
- package/dist/ccPermissions.js.map +1 -1
- package/dist/claudeDriver.js +74 -16
- package/dist/claudeDriver.js.map +1 -1
- package/dist/commands/patchworkInit.d.ts +8 -0
- package/dist/commands/patchworkInit.js +41 -5
- package/dist/commands/patchworkInit.js.map +1 -1
- package/dist/commands/recipe.d.ts +20 -0
- package/dist/commands/recipe.js +194 -5
- package/dist/commands/recipe.js.map +1 -1
- package/dist/commands/recipeInstall.js +93 -4
- package/dist/commands/recipeInstall.js.map +1 -1
- package/dist/commands/tracesExport.d.ts +83 -0
- package/dist/commands/tracesExport.js +269 -0
- package/dist/commands/tracesExport.js.map +1 -0
- package/dist/commands/tracesImport.d.ts +56 -0
- package/dist/commands/tracesImport.js +161 -0
- package/dist/commands/tracesImport.js.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +9 -1
- package/dist/config.js.map +1 -1
- package/dist/connectorRoutes.d.ts +43 -0
- package/dist/connectorRoutes.js +1713 -0
- package/dist/connectorRoutes.js.map +1 -0
- package/dist/connectors/asana.js +6 -7
- package/dist/connectors/asana.js.map +1 -1
- package/dist/connectors/baseConnector.d.ts +20 -0
- package/dist/connectors/baseConnector.js +45 -4
- package/dist/connectors/baseConnector.js.map +1 -1
- package/dist/connectors/discord.js +6 -7
- package/dist/connectors/discord.js.map +1 -1
- package/dist/connectors/gmail.js +39 -10
- package/dist/connectors/gmail.js.map +1 -1
- package/dist/connectors/googleCalendar.js +36 -10
- package/dist/connectors/googleCalendar.js.map +1 -1
- package/dist/connectors/googleDrive.js +22 -6
- package/dist/connectors/googleDrive.js.map +1 -1
- package/dist/connectors/linear.js +2 -2
- package/dist/connectors/linear.js.map +1 -1
- package/dist/connectors/mcpOAuth.js +26 -2
- package/dist/connectors/mcpOAuth.js.map +1 -1
- package/dist/connectors/oauthStateStore.d.ts +31 -0
- package/dist/connectors/oauthStateStore.js +52 -0
- package/dist/connectors/oauthStateStore.js.map +1 -0
- package/dist/connectors/slack.d.ts +15 -0
- package/dist/connectors/slack.js +54 -4
- package/dist/connectors/slack.js.map +1 -1
- package/dist/connectors/tokenStorage.js +27 -2
- package/dist/connectors/tokenStorage.js.map +1 -1
- package/dist/connectors/zendesk.js +19 -1
- package/dist/connectors/zendesk.js.map +1 -1
- package/dist/cors.d.ts +10 -0
- package/dist/cors.js +29 -0
- package/dist/cors.js.map +1 -0
- package/dist/decisionReplay.d.ts +72 -0
- package/dist/decisionReplay.js +92 -0
- package/dist/decisionReplay.js.map +1 -0
- package/dist/decisionTraceLog.d.ts +6 -0
- package/dist/decisionTraceLog.js +54 -2
- package/dist/decisionTraceLog.js.map +1 -1
- package/dist/fp/automationInterpreter.js +25 -21
- package/dist/fp/automationInterpreter.js.map +1 -1
- package/dist/fp/automationState.js +4 -1
- package/dist/fp/automationState.js.map +1 -1
- package/dist/fp/policyParser.js +4 -1
- package/dist/fp/policyParser.js.map +1 -1
- package/dist/inboxRoutes.d.ts +22 -0
- package/dist/inboxRoutes.js +114 -0
- package/dist/inboxRoutes.js.map +1 -0
- package/dist/index.js +479 -17
- package/dist/index.js.map +1 -1
- package/dist/mcpRoutes.d.ts +37 -0
- package/dist/mcpRoutes.js +76 -0
- package/dist/mcpRoutes.js.map +1 -0
- package/dist/oauth.d.ts +3 -0
- package/dist/oauth.js +151 -26
- package/dist/oauth.js.map +1 -1
- package/dist/oauthRoutes.d.ts +32 -0
- package/dist/oauthRoutes.js +124 -0
- package/dist/oauthRoutes.js.map +1 -0
- package/dist/orchestrator/orchestratorBridge.js +2 -2
- package/dist/orchestrator/orchestratorBridge.js.map +1 -1
- package/dist/patchworkConfig.d.ts +7 -0
- package/dist/patchworkConfig.js.map +1 -1
- package/dist/pluginLoader.d.ts +12 -0
- package/dist/pluginLoader.js +43 -4
- package/dist/pluginLoader.js.map +1 -1
- package/dist/pluginWatcher.js +8 -3
- package/dist/pluginWatcher.js.map +1 -1
- package/dist/preToolUseHook.d.ts +12 -0
- package/dist/preToolUseHook.js +23 -0
- package/dist/preToolUseHook.js.map +1 -1
- package/dist/recipeOrchestration.d.ts +1 -0
- package/dist/recipeOrchestration.js +173 -13
- package/dist/recipeOrchestration.js.map +1 -1
- package/dist/recipeRoutes.d.ts +154 -0
- package/dist/recipeRoutes.js +1107 -0
- package/dist/recipeRoutes.js.map +1 -0
- package/dist/recipes/chainedRunner.d.ts +15 -0
- package/dist/recipes/chainedRunner.js +73 -8
- package/dist/recipes/chainedRunner.js.map +1 -1
- package/dist/recipes/compiler.js +3 -3
- package/dist/recipes/compiler.js.map +1 -1
- package/dist/recipes/installer.js +3 -3
- package/dist/recipes/installer.js.map +1 -1
- package/dist/recipes/migrationWarnings.d.ts +12 -0
- package/dist/recipes/migrationWarnings.js +44 -0
- package/dist/recipes/migrationWarnings.js.map +1 -0
- package/dist/recipes/resolveRecipePath.d.ts +69 -0
- package/dist/recipes/resolveRecipePath.js +202 -0
- package/dist/recipes/resolveRecipePath.js.map +1 -0
- package/dist/recipes/tools/file.d.ts +6 -0
- package/dist/recipes/tools/file.js +12 -8
- package/dist/recipes/tools/file.js.map +1 -1
- package/dist/recipes/tools/index.d.ts +2 -0
- package/dist/recipes/tools/index.js +2 -0
- package/dist/recipes/tools/index.js.map +1 -1
- package/dist/recipes/tools/jira.d.ts +14 -0
- package/dist/recipes/tools/jira.js +369 -0
- package/dist/recipes/tools/jira.js.map +1 -0
- package/dist/recipes/tools/linear.js +6 -3
- package/dist/recipes/tools/linear.js.map +1 -1
- package/dist/recipes/tools/sentry.d.ts +12 -0
- package/dist/recipes/tools/sentry.js +73 -0
- package/dist/recipes/tools/sentry.js.map +1 -0
- package/dist/recipes/tools/slack.js +7 -3
- package/dist/recipes/tools/slack.js.map +1 -1
- package/dist/recipes/validation.js +83 -14
- package/dist/recipes/validation.js.map +1 -1
- package/dist/recipes/yamlRunner.d.ts +7 -0
- package/dist/recipes/yamlRunner.js +107 -13
- package/dist/recipes/yamlRunner.js.map +1 -1
- package/dist/recipesHttp.d.ts +44 -1
- package/dist/recipesHttp.js +168 -15
- package/dist/recipesHttp.js.map +1 -1
- package/dist/runLog.d.ts +14 -0
- package/dist/runLog.js +88 -4
- package/dist/runLog.js.map +1 -1
- package/dist/schemas/dry-run-plan.v1.json +139 -0
- package/dist/schemas/recipe.v1.json +684 -0
- package/dist/server.d.ts +71 -10
- package/dist/server.js +363 -1703
- package/dist/server.js.map +1 -1
- package/dist/ssrfGuard.d.ts +54 -0
- package/dist/ssrfGuard.js +122 -0
- package/dist/ssrfGuard.js.map +1 -0
- package/dist/streamableHttp.d.ts +8 -0
- package/dist/streamableHttp.js +112 -21
- package/dist/streamableHttp.js.map +1 -1
- package/dist/tools/getDocumentSymbols.d.ts +24 -0
- package/dist/tools/getDocumentSymbols.js +74 -8
- package/dist/tools/getDocumentSymbols.js.map +1 -1
- package/dist/tools/getSecurityAdvisories.js +10 -1
- package/dist/tools/getSecurityAdvisories.js.map +1 -1
- package/dist/tools/getSessionUsage.d.ts +3 -0
- package/dist/tools/getSessionUsage.js +3 -0
- package/dist/tools/getSessionUsage.js.map +1 -1
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +32 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/transaction.d.ts +19 -0
- package/dist/tools/transaction.js +29 -0
- package/dist/tools/transaction.js.map +1 -1
- package/dist/traceEncryption.d.ts +46 -0
- package/dist/traceEncryption.js +124 -0
- package/dist/traceEncryption.js.map +1 -0
- package/dist/transport.d.ts +39 -0
- package/dist/transport.js +88 -8
- package/dist/transport.js.map +1 -1
- package/package.json +4 -2
- package/templates/policies/README.md +72 -0
- package/templates/policies/conservative.json +14 -0
- package/templates/policies/developer.json +14 -0
- package/templates/policies/headless-ci.json +24 -0
- package/templates/policies/personal-assistant.json +15 -0
- package/templates/policies/regulated-industry.json +18 -0
- package/templates/recipes/webhook/README.md +70 -0
- package/templates/recipes/webhook/capture-thought.yaml +26 -0
- package/templates/recipes/webhook/customer-escalation.yaml +49 -0
- package/templates/recipes/webhook/incident-intake.yaml +46 -0
- package/templates/recipes/webhook/meeting-prep.yaml +48 -0
- package/templates/recipes/webhook/morning-brief.yaml +57 -0
package/dist/server.d.ts
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
2
|
import http from "node:http";
|
|
3
3
|
import { WebSocket } from "ws";
|
|
4
|
+
import type { ActivityListener } from "./activityTypes.js";
|
|
4
5
|
import type { Logger } from "./logger.js";
|
|
5
6
|
import type { OAuthServer } from "./oauth.js";
|
|
6
|
-
import type { ActivityListener } from "./activityTypes.js";
|
|
7
7
|
import type { RecipeDraft } from "./recipesHttp.js";
|
|
8
8
|
interface ServerEvents {
|
|
9
9
|
connection: [ws: WebSocket];
|
|
10
10
|
extension: [ws: WebSocket];
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* Loopback origins are always allowed. Additional origins can be passed via
|
|
15
|
-
* --cors-origin (e.g. https://claude.ai for remote deployments).
|
|
16
|
-
*/
|
|
17
|
-
export declare function corsOrigin(requestOrigin: string | undefined, extraOrigins?: string[]): string | null;
|
|
12
|
+
import { corsOrigin } from "./cors.js";
|
|
13
|
+
export { corsOrigin };
|
|
18
14
|
export interface SessionSummary {
|
|
19
15
|
id: string;
|
|
20
16
|
connectedAt: string;
|
|
@@ -38,6 +34,8 @@ export declare class Server extends EventEmitter<ServerEvents> {
|
|
|
38
34
|
private oauthServer;
|
|
39
35
|
private oauthIssuerUrl;
|
|
40
36
|
private sseSubscriberCount;
|
|
37
|
+
/** Cache for CC permission rules (30s TTL) to avoid filesystem walks on each dashboard poll */
|
|
38
|
+
private _explainRulesCache;
|
|
41
39
|
private static readonly MAX_SSE_SUBSCRIBERS;
|
|
42
40
|
/** Set by bridge to provide health data */
|
|
43
41
|
healthDataFn: (() => Record<string, unknown>) | null;
|
|
@@ -59,6 +57,19 @@ export declare class Server extends EventEmitter<ServerEvents> {
|
|
|
59
57
|
}) | null;
|
|
60
58
|
/** Set by bridge to cancel a running/pending task by id. Returns true if found. */
|
|
61
59
|
cancelTaskFn: ((id: string) => boolean) | null;
|
|
60
|
+
/** Patchwork: set by bridge to set the trust level for a recipe by name. */
|
|
61
|
+
setRecipeTrustFn: ((name: string, level: string) => {
|
|
62
|
+
ok: boolean;
|
|
63
|
+
error?: string;
|
|
64
|
+
}) | null;
|
|
65
|
+
/** Patchwork: set by bridge to generate a recipe YAML draft from a natural-language prompt. */
|
|
66
|
+
generateRecipeFn: ((prompt: string) => Promise<{
|
|
67
|
+
ok: boolean;
|
|
68
|
+
yaml?: string;
|
|
69
|
+
warnings?: string[];
|
|
70
|
+
error?: string;
|
|
71
|
+
unavailable?: boolean;
|
|
72
|
+
}>) | null;
|
|
62
73
|
/** Patchwork: set by bridge to list installed recipes for the dashboard. */
|
|
63
74
|
recipesFn: (() => Record<string, unknown>) | null;
|
|
64
75
|
/** Patchwork: set by bridge to load raw recipe source content by name. */
|
|
@@ -79,6 +90,22 @@ export declare class Server extends EventEmitter<ServerEvents> {
|
|
|
79
90
|
path?: string;
|
|
80
91
|
error?: string;
|
|
81
92
|
}) | null;
|
|
93
|
+
/** Patchwork: set by bridge to promote a variant recipe to the canonical name. */
|
|
94
|
+
promoteRecipeVariantFn: ((variantName: string, targetName: string, options?: {
|
|
95
|
+
force?: boolean;
|
|
96
|
+
}) => Promise<{
|
|
97
|
+
ok: boolean;
|
|
98
|
+
path?: string;
|
|
99
|
+
error?: string;
|
|
100
|
+
targetExists?: boolean;
|
|
101
|
+
}>) | null;
|
|
102
|
+
/** Patchwork: set by bridge to duplicate a recipe as a variant. */
|
|
103
|
+
duplicateRecipeFn: ((name: string) => {
|
|
104
|
+
ok: boolean;
|
|
105
|
+
variantName?: string;
|
|
106
|
+
path?: string;
|
|
107
|
+
error?: string;
|
|
108
|
+
}) | null;
|
|
82
109
|
/** Patchwork: set by bridge to lint raw recipe content without saving. */
|
|
83
110
|
lintRecipeContentFn: ((content: string) => {
|
|
84
111
|
ok: boolean;
|
|
@@ -133,6 +160,26 @@ export declare class Server extends EventEmitter<ServerEvents> {
|
|
|
133
160
|
pushServiceBaseUrl: string | undefined;
|
|
134
161
|
/** Patchwork: approval decision audit callback wired to activityLog.recordEvent. */
|
|
135
162
|
onApprovalDecision: ((event: string, meta: Record<string, unknown>) => void) | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* Patchwork: activity log handle, used by approvalHttp to compute
|
|
165
|
+
* passive risk personalization signals (`src/approvalSignals.ts`).
|
|
166
|
+
* When unset, personalSignals are simply omitted from queue entries.
|
|
167
|
+
*/
|
|
168
|
+
activityLog: import("./activityLog.js").ActivityLog | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Patchwork: recipe-run log handle, used by approvalHttp for the
|
|
171
|
+
* "recipe-step trust" heuristic (h6 in src/approvalSignals.ts). When
|
|
172
|
+
* unset, h6 is silently skipped; the other personalSignals heuristics
|
|
173
|
+
* still compute as long as `activityLog` is wired.
|
|
174
|
+
*/
|
|
175
|
+
recipeRunLog: import("./runLog.js").RecipeRunLog | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* Patchwork: opt-in switch for personalSignals heuristic 10
|
|
178
|
+
* (time-of-day anomaly). Off by default — see config.ts. Threaded into
|
|
179
|
+
* routeApprovalRequest deps so the personalSignals computation honors
|
|
180
|
+
* the user's preference.
|
|
181
|
+
*/
|
|
182
|
+
enableTimeOfDayAnomaly: boolean;
|
|
136
183
|
/** Patchwork: set by bridge to match + fire webhook-triggered recipes. */
|
|
137
184
|
webhookFn: ((path: string, payload: unknown) => Promise<{
|
|
138
185
|
ok: boolean;
|
|
@@ -140,6 +187,23 @@ export declare class Server extends EventEmitter<ServerEvents> {
|
|
|
140
187
|
name?: string;
|
|
141
188
|
error?: string;
|
|
142
189
|
}>) | null;
|
|
190
|
+
/**
|
|
191
|
+
* Patchwork: ring buffer of recent webhook payloads, keyed by path
|
|
192
|
+
* (e.g. "/incident-war-room"). The last MAX_WEBHOOK_PAYLOADS entries are
|
|
193
|
+
* retained per path so the dashboard can show what the recipe most
|
|
194
|
+
* recently received — answers "did the trigger fire? what did it send?"
|
|
195
|
+
* without forcing the user to dig through bridge logs. In-memory only;
|
|
196
|
+
* cleared on restart.
|
|
197
|
+
*/
|
|
198
|
+
webhookPayloads: Map<string, {
|
|
199
|
+
receivedAt: number;
|
|
200
|
+
payload: unknown;
|
|
201
|
+
ok: boolean;
|
|
202
|
+
error?: string;
|
|
203
|
+
taskId?: string;
|
|
204
|
+
recipeName?: string;
|
|
205
|
+
}[]>;
|
|
206
|
+
static readonly MAX_WEBHOOK_PAYLOADS = 5;
|
|
143
207
|
/** Set by bridge to handle MCP Streamable HTTP sessions (POST/GET/DELETE /mcp) */
|
|
144
208
|
httpMcpHandler: ((req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>) | null;
|
|
145
209
|
/** Set by bridge to subscribe a caller to real-time activity events. Returns unsubscribe fn. */
|
|
@@ -172,8 +236,6 @@ export declare class Server extends EventEmitter<ServerEvents> {
|
|
|
172
236
|
}) | null;
|
|
173
237
|
/** Patchwork: set by bridge to list active agent sessions for the dashboard. */
|
|
174
238
|
sessionsFn: (() => SessionSummary[]) | null;
|
|
175
|
-
private _templatesCache;
|
|
176
|
-
private _templatesCacheTs;
|
|
177
239
|
/** Patchwork: set by bridge to answer GET /sessions/:id with per-session event stream + approvals. */
|
|
178
240
|
sessionDetailFn: ((id: string) => {
|
|
179
241
|
summary: SessionSummary | null;
|
|
@@ -211,4 +273,3 @@ export declare class Server extends EventEmitter<ServerEvents> {
|
|
|
211
273
|
findAndListen(preferredPort: number | null, bindAddress?: string): Promise<number>;
|
|
212
274
|
close(): Promise<void>;
|
|
213
275
|
}
|
|
214
|
-
export {};
|