patchwork-os 0.2.0-beta.0 → 0.2.0-beta.10
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.bridge.md +14 -14
- package/README.md +204 -34
- package/deploy/README.md +1 -1
- package/deploy/bootstrap-vps.sh +14 -9
- package/deploy/deploy-dashboard.sh +25 -1
- package/deploy/macos/README.md +153 -0
- package/deploy/macos/com.patchwork.bridge.plist.template +54 -0
- package/deploy/macos/com.patchwork.tunnel.plist.template +76 -0
- package/deploy/macos/install-mac-bridge.sh +244 -0
- package/deploy/macos/uninstall-mac-bridge.sh +22 -0
- package/dist/activityLog.d.ts +6 -0
- package/dist/activityLog.js +63 -26
- package/dist/activityLog.js.map +1 -1
- package/dist/adapters/claude.js +22 -16
- package/dist/adapters/claude.js.map +1 -1
- package/dist/adapters/gemini.js +15 -11
- package/dist/adapters/gemini.js.map +1 -1
- package/dist/adapters/openai.js +9 -9
- package/dist/adapters/openai.js.map +1 -1
- package/dist/ajv2020.d.ts +25 -0
- package/dist/ajv2020.js +33 -0
- package/dist/ajv2020.js.map +1 -0
- package/dist/analyticsAggregator.d.ts +5 -1
- package/dist/analyticsAggregator.js +16 -5
- package/dist/analyticsAggregator.js.map +1 -1
- package/dist/analyticsConfig.d.ts +29 -0
- package/dist/analyticsConfig.js +102 -0
- package/dist/analyticsConfig.js.map +1 -0
- package/dist/analyticsPrefs.d.ts +49 -2
- package/dist/analyticsPrefs.js +177 -19
- package/dist/analyticsPrefs.js.map +1 -1
- package/dist/analyticsSend.d.ts +17 -1
- package/dist/analyticsSend.js +67 -5
- package/dist/analyticsSend.js.map +1 -1
- package/dist/approvalHttp.d.ts +14 -0
- package/dist/approvalHttp.js +212 -9
- package/dist/approvalHttp.js.map +1 -1
- package/dist/approvalInsights.js +13 -5
- package/dist/approvalInsights.js.map +1 -1
- package/dist/approvalQueue.d.ts +97 -3
- package/dist/approvalQueue.js +193 -19
- package/dist/approvalQueue.js.map +1 -1
- package/dist/approvalSignals.js +19 -11
- package/dist/approvalSignals.js.map +1 -1
- package/dist/automation.d.ts +35 -10
- package/dist/automation.js +133 -37
- package/dist/automation.js.map +1 -1
- package/dist/automationSuggestions.js +10 -8
- package/dist/automationSuggestions.js.map +1 -1
- package/dist/bridge.d.ts +2 -0
- package/dist/bridge.js +238 -51
- package/dist/bridge.js.map +1 -1
- package/dist/bridgeLockDiscovery.d.ts +27 -1
- package/dist/bridgeLockDiscovery.js +38 -11
- package/dist/bridgeLockDiscovery.js.map +1 -1
- package/dist/bridgeToken.js +3 -2
- package/dist/bridgeToken.js.map +1 -1
- package/dist/claudeDriver.d.ts +0 -16
- package/dist/claudeDriver.js +42 -28
- package/dist/claudeDriver.js.map +1 -1
- package/dist/claudeMdPatch.d.ts +9 -3
- package/dist/claudeMdPatch.js +79 -13
- package/dist/claudeMdPatch.js.map +1 -1
- package/dist/claudeOrchestrator.d.ts +13 -1
- package/dist/claudeOrchestrator.js +89 -44
- package/dist/claudeOrchestrator.js.map +1 -1
- package/dist/commands/analytics.d.ts +8 -0
- package/dist/commands/analytics.js +134 -0
- package/dist/commands/analytics.js.map +1 -0
- package/dist/commands/auditEnv.d.ts +36 -0
- package/dist/commands/auditEnv.js +202 -0
- package/dist/commands/auditEnv.js.map +1 -0
- package/dist/commands/dashboard.js +8 -1
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/doctor.d.ts +35 -0
- package/dist/commands/doctor.js +51 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/install.js +3 -0
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/launchd.js +15 -16
- package/dist/commands/launchd.js.map +1 -1
- package/dist/commands/patchworkInit.d.ts +5 -0
- package/dist/commands/patchworkInit.js +89 -7
- package/dist/commands/patchworkInit.js.map +1 -1
- package/dist/commands/recipe.d.ts +110 -0
- package/dist/commands/recipe.js +512 -9
- package/dist/commands/recipe.js.map +1 -1
- package/dist/commands/recipeInstall.js +11 -4
- package/dist/commands/recipeInstall.js.map +1 -1
- package/dist/commands/shadowScan.d.ts +34 -0
- package/dist/commands/shadowScan.js +142 -0
- package/dist/commands/shadowScan.js.map +1 -0
- package/dist/commands/task.js +2 -2
- package/dist/commands/task.js.map +1 -1
- package/dist/commands/tools.d.ts +20 -1
- package/dist/commands/tools.js +112 -3
- package/dist/commands/tools.js.map +1 -1
- package/dist/commands/tracesImport.js +21 -4
- package/dist/commands/tracesImport.js.map +1 -1
- package/dist/commitIssueLinkLog.d.ts +24 -0
- package/dist/commitIssueLinkLog.js +160 -22
- package/dist/commitIssueLinkLog.js.map +1 -1
- package/dist/companions/registry.js +15 -7
- package/dist/companions/registry.js.map +1 -1
- package/dist/config.d.ts +49 -5
- package/dist/config.js +123 -22
- package/dist/config.js.map +1 -1
- package/dist/connectorRoutes.js +913 -413
- package/dist/connectorRoutes.js.map +1 -1
- package/dist/connectors/airtable.d.ts +230 -0
- package/dist/connectors/airtable.js +700 -0
- package/dist/connectors/airtable.js.map +1 -0
- package/dist/connectors/asana.js +13 -9
- package/dist/connectors/asana.js.map +1 -1
- package/dist/connectors/baseConnector.js +25 -3
- package/dist/connectors/baseConnector.js.map +1 -1
- package/dist/connectors/caldiy.d.ts +137 -0
- package/dist/connectors/caldiy.js +424 -0
- package/dist/connectors/caldiy.js.map +1 -0
- package/dist/connectors/circleci.d.ts +162 -0
- package/dist/connectors/circleci.js +576 -0
- package/dist/connectors/circleci.js.map +1 -0
- package/dist/connectors/cloudflare.d.ts +132 -0
- package/dist/connectors/cloudflare.js +622 -0
- package/dist/connectors/cloudflare.js.map +1 -0
- package/dist/connectors/confluence.js +35 -0
- package/dist/connectors/confluence.js.map +1 -1
- package/dist/connectors/connectorRedirectUri.d.ts +30 -0
- package/dist/connectors/connectorRedirectUri.js +38 -0
- package/dist/connectors/connectorRedirectUri.js.map +1 -0
- package/dist/connectors/connectorRegistry.d.ts +63 -0
- package/dist/connectors/connectorRegistry.js +354 -0
- package/dist/connectors/connectorRegistry.js.map +1 -0
- package/dist/connectors/datadog.js +33 -4
- package/dist/connectors/datadog.js.map +1 -1
- package/dist/connectors/discord.js +14 -10
- package/dist/connectors/discord.js.map +1 -1
- package/dist/connectors/elasticsearch.d.ts +141 -0
- package/dist/connectors/elasticsearch.js +601 -0
- package/dist/connectors/elasticsearch.js.map +1 -0
- package/dist/connectors/figma.d.ts +130 -0
- package/dist/connectors/figma.js +387 -0
- package/dist/connectors/figma.js.map +1 -0
- package/dist/connectors/github.d.ts +17 -0
- package/dist/connectors/github.js +53 -2
- package/dist/connectors/github.js.map +1 -1
- package/dist/connectors/gitlab.js +12 -6
- package/dist/connectors/gitlab.js.map +1 -1
- package/dist/connectors/gmail.js +72 -21
- package/dist/connectors/gmail.js.map +1 -1
- package/dist/connectors/googleCalendar.js +8 -8
- package/dist/connectors/googleCalendar.js.map +1 -1
- package/dist/connectors/googleDocs.d.ts +103 -0
- package/dist/connectors/googleDocs.js +409 -0
- package/dist/connectors/googleDocs.js.map +1 -0
- package/dist/connectors/googleDrive.d.ts +12 -0
- package/dist/connectors/googleDrive.js +35 -8
- package/dist/connectors/googleDrive.js.map +1 -1
- package/dist/connectors/grafana.d.ts +133 -0
- package/dist/connectors/grafana.js +478 -0
- package/dist/connectors/grafana.js.map +1 -0
- package/dist/connectors/jira.d.ts +25 -0
- package/dist/connectors/jira.js +245 -2
- package/dist/connectors/jira.js.map +1 -1
- package/dist/connectors/linear.js +1 -1
- package/dist/connectors/linear.js.map +1 -1
- package/dist/connectors/mcpOAuth.js +78 -16
- package/dist/connectors/mcpOAuth.js.map +1 -1
- package/dist/connectors/monday.d.ts +217 -0
- package/dist/connectors/monday.js +655 -0
- package/dist/connectors/monday.js.map +1 -0
- package/dist/connectors/mongodb.d.ts +139 -0
- package/dist/connectors/mongodb.js +455 -0
- package/dist/connectors/mongodb.js.map +1 -0
- package/dist/connectors/oauthStateStore.d.ts +20 -0
- package/dist/connectors/oauthStateStore.js +94 -4
- package/dist/connectors/oauthStateStore.js.map +1 -1
- package/dist/connectors/obsidian.d.ts +83 -0
- package/dist/connectors/obsidian.js +441 -0
- package/dist/connectors/obsidian.js.map +1 -0
- package/dist/connectors/paystack.d.ts +159 -0
- package/dist/connectors/paystack.js +607 -0
- package/dist/connectors/paystack.js.map +1 -0
- package/dist/connectors/pipedrive.d.ts +189 -0
- package/dist/connectors/pipedrive.js +559 -0
- package/dist/connectors/pipedrive.js.map +1 -0
- package/dist/connectors/postgres.d.ts +127 -0
- package/dist/connectors/postgres.js +512 -0
- package/dist/connectors/postgres.js.map +1 -0
- package/dist/connectors/posthog.d.ts +119 -0
- package/dist/connectors/posthog.js +479 -0
- package/dist/connectors/posthog.js.map +1 -0
- package/dist/connectors/redis.d.ts +140 -0
- package/dist/connectors/redis.js +571 -0
- package/dist/connectors/redis.js.map +1 -0
- package/dist/connectors/resend.d.ts +131 -0
- package/dist/connectors/resend.js +529 -0
- package/dist/connectors/resend.js.map +1 -0
- package/dist/connectors/salesforce.d.ts +136 -0
- package/dist/connectors/salesforce.js +603 -0
- package/dist/connectors/salesforce.js.map +1 -0
- package/dist/connectors/secrets.d.ts +51 -0
- package/dist/connectors/secrets.js +102 -0
- package/dist/connectors/secrets.js.map +1 -0
- package/dist/connectors/sendgrid.d.ts +102 -0
- package/dist/connectors/sendgrid.js +423 -0
- package/dist/connectors/sendgrid.js.map +1 -0
- package/dist/connectors/shopify.d.ts +145 -0
- package/dist/connectors/shopify.js +502 -0
- package/dist/connectors/shopify.js.map +1 -0
- package/dist/connectors/slack.d.ts +1 -1
- package/dist/connectors/slack.js +61 -9
- package/dist/connectors/slack.js.map +1 -1
- package/dist/connectors/snowflake.d.ts +119 -0
- package/dist/connectors/snowflake.js +615 -0
- package/dist/connectors/snowflake.js.map +1 -0
- package/dist/connectors/supabase.d.ts +92 -0
- package/dist/connectors/supabase.js +630 -0
- package/dist/connectors/supabase.js.map +1 -0
- package/dist/connectors/todoist.d.ts +117 -0
- package/dist/connectors/todoist.js +485 -0
- package/dist/connectors/todoist.js.map +1 -0
- package/dist/connectors/tokenStorage.js +56 -14
- package/dist/connectors/tokenStorage.js.map +1 -1
- package/dist/connectors/twilio.d.ts +118 -0
- package/dist/connectors/twilio.js +475 -0
- package/dist/connectors/twilio.js.map +1 -0
- package/dist/connectors/vercel.d.ts +110 -0
- package/dist/connectors/vercel.js +479 -0
- package/dist/connectors/vercel.js.map +1 -0
- package/dist/connectors/webflow.d.ts +118 -0
- package/dist/connectors/webflow.js +393 -0
- package/dist/connectors/webflow.js.map +1 -0
- package/dist/connectors/woocommerce.d.ts +220 -0
- package/dist/connectors/woocommerce.js +464 -0
- package/dist/connectors/woocommerce.js.map +1 -0
- package/dist/crypto.js +7 -2
- package/dist/crypto.js.map +1 -1
- package/dist/decisionReplay.js +15 -6
- package/dist/decisionReplay.js.map +1 -1
- package/dist/decisionTraceLog.d.ts +28 -0
- package/dist/decisionTraceLog.js +156 -29
- package/dist/decisionTraceLog.js.map +1 -1
- package/dist/drivers/claude/api.js +5 -4
- package/dist/drivers/claude/api.js.map +1 -1
- package/dist/drivers/claude/envSanitizer.d.ts +0 -6
- package/dist/drivers/claude/envSanitizer.js +17 -2
- package/dist/drivers/claude/envSanitizer.js.map +1 -1
- package/dist/drivers/claude/streamParser.js +5 -4
- package/dist/drivers/claude/streamParser.js.map +1 -1
- package/dist/drivers/claude/subprocess.d.ts +12 -2
- package/dist/drivers/claude/subprocess.js +100 -8
- package/dist/drivers/claude/subprocess.js.map +1 -1
- package/dist/drivers/gemini/api.d.ts +18 -0
- package/dist/drivers/gemini/api.js +29 -0
- package/dist/drivers/gemini/api.js.map +1 -0
- package/dist/drivers/gemini/index.d.ts +22 -0
- package/dist/drivers/gemini/index.js +256 -129
- package/dist/drivers/gemini/index.js.map +1 -1
- package/dist/drivers/index.d.ts +3 -1
- package/dist/drivers/index.js +9 -1
- package/dist/drivers/index.js.map +1 -1
- package/dist/drivers/local/index.d.ts +43 -0
- package/dist/drivers/local/index.js +140 -0
- package/dist/drivers/local/index.js.map +1 -0
- package/dist/drivers/openai/index.js +30 -2
- package/dist/drivers/openai/index.js.map +1 -1
- package/dist/extensionClient.d.ts +37 -4
- package/dist/extensionClient.js +58 -16
- package/dist/extensionClient.js.map +1 -1
- package/dist/featureFlags.d.ts +91 -0
- package/dist/featureFlags.js +174 -3
- package/dist/featureFlags.js.map +1 -1
- package/dist/fileLock.js +21 -12
- package/dist/fileLock.js.map +1 -1
- package/dist/fileLockSync.d.ts +67 -0
- package/dist/fileLockSync.js +126 -0
- package/dist/fileLockSync.js.map +1 -0
- package/dist/fp/activityAnalytics.js +26 -12
- package/dist/fp/activityAnalytics.js.map +1 -1
- package/dist/fp/automationInterpreter.d.ts +15 -1
- package/dist/fp/automationInterpreter.js +217 -82
- package/dist/fp/automationInterpreter.js.map +1 -1
- package/dist/fp/automationProgram.d.ts +30 -0
- package/dist/fp/automationProgram.js.map +1 -1
- package/dist/fp/automationState.d.ts +24 -5
- package/dist/fp/automationState.js +56 -9
- package/dist/fp/automationState.js.map +1 -1
- package/dist/fp/automationUtils.js +1 -1
- package/dist/fp/automationUtils.js.map +1 -1
- package/dist/fp/commandDescription.js +7 -1
- package/dist/fp/commandDescription.js.map +1 -1
- package/dist/fp/extensionSnapshot.js +8 -2
- package/dist/fp/extensionSnapshot.js.map +1 -1
- package/dist/fp/interpreterContext.d.ts +66 -1
- package/dist/fp/interpreterContext.js +91 -1
- package/dist/fp/interpreterContext.js.map +1 -1
- package/dist/fp/policyParser.js +29 -1
- package/dist/fp/policyParser.js.map +1 -1
- package/dist/fsWatchWithFallback.d.ts +36 -0
- package/dist/fsWatchWithFallback.js +128 -0
- package/dist/fsWatchWithFallback.js.map +1 -0
- package/dist/haltPushDispatch.d.ts +33 -0
- package/dist/haltPushDispatch.js +103 -0
- package/dist/haltPushDispatch.js.map +1 -0
- package/dist/httpBodyValidation.d.ts +41 -0
- package/dist/httpBodyValidation.js +45 -0
- package/dist/httpBodyValidation.js.map +1 -0
- package/dist/httpErrorResponse.d.ts +36 -0
- package/dist/httpErrorResponse.js +46 -0
- package/dist/httpErrorResponse.js.map +1 -0
- package/dist/inboxRoutes.d.ts +22 -0
- package/dist/inboxRoutes.js +151 -12
- package/dist/inboxRoutes.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1054 -76
- package/dist/index.js.map +1 -1
- package/dist/installGuard.js +6 -2
- package/dist/installGuard.js.map +1 -1
- package/dist/lockfile.js +31 -4
- package/dist/lockfile.js.map +1 -1
- package/dist/oauth.d.ts +22 -0
- package/dist/oauth.js +46 -0
- package/dist/oauth.js.map +1 -1
- package/dist/oauthRoutes.d.ts +1 -1
- package/dist/oauthRoutes.js +8 -11
- package/dist/oauthRoutes.js.map +1 -1
- package/dist/orchestrator/childBridgeRegistry.js +29 -11
- package/dist/orchestrator/childBridgeRegistry.js.map +1 -1
- package/dist/patchworkConfig.d.ts +57 -1
- package/dist/patchworkConfig.js +125 -5
- package/dist/patchworkConfig.js.map +1 -1
- package/dist/pluginLoader.js +10 -1
- package/dist/pluginLoader.js.map +1 -1
- package/dist/pluginWatcher.js +12 -14
- package/dist/pluginWatcher.js.map +1 -1
- package/dist/preToolUseHook.js +10 -3
- package/dist/preToolUseHook.js.map +1 -1
- package/dist/processTree.d.ts +34 -0
- package/dist/processTree.js +105 -0
- package/dist/processTree.js.map +1 -0
- package/dist/prompts.js +7 -3
- package/dist/prompts.js.map +1 -1
- package/dist/recipeOrchestration.d.ts +9 -0
- package/dist/recipeOrchestration.js +354 -27
- package/dist/recipeOrchestration.js.map +1 -1
- package/dist/recipeRoutes.d.ts +63 -2
- package/dist/recipeRoutes.js +790 -137
- package/dist/recipeRoutes.js.map +1 -1
- package/dist/recipes/RecipeOrchestrator.d.ts +2 -0
- package/dist/recipes/RecipeOrchestrator.js +6 -1
- package/dist/recipes/RecipeOrchestrator.js.map +1 -1
- package/dist/recipes/agentExecutor.d.ts +34 -5
- package/dist/recipes/agentExecutor.js +5 -4
- package/dist/recipes/agentExecutor.js.map +1 -1
- package/dist/recipes/chainedRunner.d.ts +2 -0
- package/dist/recipes/chainedRunner.js +142 -5
- package/dist/recipes/chainedRunner.js.map +1 -1
- package/dist/recipes/connectorPreflight.d.ts +66 -0
- package/dist/recipes/connectorPreflight.js +169 -0
- package/dist/recipes/connectorPreflight.js.map +1 -0
- package/dist/recipes/dependencyGraph.js +13 -5
- package/dist/recipes/dependencyGraph.js.map +1 -1
- package/dist/recipes/githubInstallSource.d.ts +128 -0
- package/dist/recipes/githubInstallSource.js +206 -0
- package/dist/recipes/githubInstallSource.js.map +1 -0
- package/dist/recipes/haltCategory.d.ts +119 -0
- package/dist/recipes/haltCategory.js +188 -0
- package/dist/recipes/haltCategory.js.map +1 -0
- package/dist/recipes/idempotencyKey.d.ts +134 -0
- package/dist/recipes/idempotencyKey.js +322 -0
- package/dist/recipes/idempotencyKey.js.map +1 -0
- package/dist/recipes/installer.js +48 -2
- package/dist/recipes/installer.js.map +1 -1
- package/dist/recipes/judgeSummary.d.ts +50 -0
- package/dist/recipes/judgeSummary.js +47 -0
- package/dist/recipes/judgeSummary.js.map +1 -0
- package/dist/recipes/judgeVerdict.d.ts +48 -0
- package/dist/recipes/judgeVerdict.js +174 -0
- package/dist/recipes/judgeVerdict.js.map +1 -0
- package/dist/recipes/migrations/index.d.ts +9 -0
- package/dist/recipes/migrations/index.js +133 -0
- package/dist/recipes/migrations/index.js.map +1 -1
- package/dist/recipes/names.d.ts +20 -0
- package/dist/recipes/names.js +25 -0
- package/dist/recipes/names.js.map +1 -1
- package/dist/recipes/parser.js +88 -5
- package/dist/recipes/parser.js.map +1 -1
- package/dist/recipes/replayRun.js +1 -1
- package/dist/recipes/replayRun.js.map +1 -1
- package/dist/recipes/runBudget.d.ts +70 -0
- package/dist/recipes/runBudget.js +109 -0
- package/dist/recipes/runBudget.js.map +1 -0
- package/dist/recipes/scheduler.d.ts +30 -0
- package/dist/recipes/scheduler.js +69 -19
- package/dist/recipes/scheduler.js.map +1 -1
- package/dist/recipes/schema.d.ts +36 -0
- package/dist/recipes/schemaGenerator.js +103 -5
- package/dist/recipes/schemaGenerator.js.map +1 -1
- package/dist/recipes/stepObservation.js +9 -0
- package/dist/recipes/stepObservation.js.map +1 -1
- package/dist/recipes/toolRegistry.js +20 -3
- package/dist/recipes/toolRegistry.js.map +1 -1
- package/dist/recipes/tools/fanOut.d.ts +20 -0
- package/dist/recipes/tools/fanOut.js +199 -0
- package/dist/recipes/tools/fanOut.js.map +1 -0
- package/dist/recipes/tools/file.js +5 -2
- package/dist/recipes/tools/file.js.map +1 -1
- package/dist/recipes/tools/github.d.ts +1 -1
- package/dist/recipes/tools/github.js +75 -1
- package/dist/recipes/tools/github.js.map +1 -1
- package/dist/recipes/tools/gmail.js +45 -6
- package/dist/recipes/tools/gmail.js.map +1 -1
- package/dist/recipes/tools/googleDrive.js +64 -0
- package/dist/recipes/tools/googleDrive.js.map +1 -1
- package/dist/recipes/tools/http.d.ts +10 -0
- package/dist/recipes/tools/http.js +176 -0
- package/dist/recipes/tools/http.js.map +1 -0
- 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/slack.js +1 -1
- package/dist/recipes/validation.d.ts +17 -0
- package/dist/recipes/validation.js +29 -11
- package/dist/recipes/validation.js.map +1 -1
- package/dist/recipes/workspaceRoot.d.ts +37 -0
- package/dist/recipes/workspaceRoot.js +73 -0
- package/dist/recipes/workspaceRoot.js.map +1 -0
- package/dist/recipes/yamlPositions.d.ts +56 -0
- package/dist/recipes/yamlPositions.js +183 -0
- package/dist/recipes/yamlPositions.js.map +1 -0
- package/dist/recipes/yamlRunner.d.ts +195 -8
- package/dist/recipes/yamlRunner.js +877 -209
- package/dist/recipes/yamlRunner.js.map +1 -1
- package/dist/recipesHttp.d.ts +33 -3
- package/dist/recipesHttp.js +126 -12
- package/dist/recipesHttp.js.map +1 -1
- package/dist/resources.js +21 -13
- package/dist/resources.js.map +1 -1
- package/dist/runLog.d.ts +58 -5
- package/dist/runLog.js +98 -21
- package/dist/runLog.js.map +1 -1
- package/dist/sanitizeParsedJson.d.ts +39 -0
- package/dist/sanitizeParsedJson.js +55 -0
- package/dist/sanitizeParsedJson.js.map +1 -0
- package/dist/schemas/recipe.v1.json +885 -196
- package/dist/server.d.ts +166 -3
- package/dist/server.js +1313 -332
- package/dist/server.js.map +1 -1
- package/dist/sessionCheckpoint.d.ts +8 -0
- package/dist/sessionCheckpoint.js +33 -3
- package/dist/sessionCheckpoint.js.map +1 -1
- package/dist/ssrfGuard.d.ts +16 -0
- package/dist/ssrfGuard.js +87 -4
- package/dist/ssrfGuard.js.map +1 -1
- package/dist/streamableHttp.d.ts +9 -4
- package/dist/streamableHttp.js +76 -20
- package/dist/streamableHttp.js.map +1 -1
- package/dist/telemetry.js +19 -12
- package/dist/telemetry.js.map +1 -1
- package/dist/testing/shadowRun.d.ts +52 -0
- package/dist/testing/shadowRun.js +71 -0
- package/dist/testing/shadowRun.js.map +1 -0
- package/dist/tools/batchLsp.d.ts +3 -0
- package/dist/tools/bridgeDoctor.d.ts +11 -0
- package/dist/tools/bridgeDoctor.js +48 -2
- package/dist/tools/bridgeDoctor.js.map +1 -1
- package/dist/tools/bridgeStatus.d.ts +0 -12
- package/dist/tools/bridgeStatus.js +2 -28
- package/dist/tools/bridgeStatus.js.map +1 -1
- package/dist/tools/cancelClaudeTask.d.ts +1 -0
- package/dist/tools/clipboard.d.ts +2 -0
- package/dist/tools/closeTabs.d.ts +1 -0
- package/dist/tools/codeLens.d.ts +1 -0
- package/dist/tools/createIssueFromAIComment.d.ts +1 -0
- package/dist/tools/ctxGetTaskContext.d.ts +9 -0
- package/dist/tools/ctxGetTaskContext.js +50 -2
- package/dist/tools/ctxGetTaskContext.js.map +1 -1
- package/dist/tools/ctxQueryTraces.js +32 -24
- package/dist/tools/ctxQueryTraces.js.map +1 -1
- package/dist/tools/ctxSaveTrace.d.ts +1 -0
- package/dist/tools/debug.d.ts +4 -0
- package/dist/tools/decorations.d.ts +2 -0
- package/dist/tools/detectUnusedCode.js +9 -7
- package/dist/tools/detectUnusedCode.js.map +1 -1
- package/dist/tools/documentLinks.d.ts +1 -0
- package/dist/tools/editText.d.ts +1 -0
- package/dist/tools/editText.js +2 -1
- package/dist/tools/editText.js.map +1 -1
- package/dist/tools/enrichCommit.d.ts +1 -0
- package/dist/tools/enrichStackTrace.js +11 -5
- package/dist/tools/enrichStackTrace.js.map +1 -1
- package/dist/tools/explainDiagnostic.d.ts +1 -0
- package/dist/tools/explainSymbol.d.ts +1 -0
- package/dist/tools/fileOperations.d.ts +3 -0
- package/dist/tools/fileOperations.js +2 -1
- package/dist/tools/fileOperations.js.map +1 -1
- package/dist/tools/fileWatcher.d.ts +2 -0
- package/dist/tools/fileWatcher.js +8 -2
- package/dist/tools/fileWatcher.js.map +1 -1
- package/dist/tools/findFiles.d.ts +1 -0
- package/dist/tools/fixAllLintErrors.d.ts +1 -0
- package/dist/tools/fixAllLintErrors.js +10 -5
- package/dist/tools/fixAllLintErrors.js.map +1 -1
- package/dist/tools/foldingRanges.d.ts +1 -0
- package/dist/tools/formatDocument.d.ts +1 -0
- package/dist/tools/formatDocument.js +10 -5
- package/dist/tools/formatDocument.js.map +1 -1
- package/dist/tools/generateTests.d.ts +1 -0
- package/dist/tools/getAIComments.d.ts +1 -0
- package/dist/tools/getAnalyticsReport.js +5 -1
- package/dist/tools/getAnalyticsReport.js.map +1 -1
- package/dist/tools/getBufferContent.d.ts +1 -0
- package/dist/tools/getChangeImpact.d.ts +1 -0
- package/dist/tools/getChangeImpact.js +23 -14
- package/dist/tools/getChangeImpact.js.map +1 -1
- package/dist/tools/getClaudeTaskStatus.d.ts +1 -0
- package/dist/tools/getCodeCoverage.d.ts +1 -0
- package/dist/tools/getCodeCoverage.js +32 -14
- package/dist/tools/getCodeCoverage.js.map +1 -1
- package/dist/tools/getCommitsForIssue.d.ts +1 -0
- package/dist/tools/getDebugState.d.ts +1 -0
- package/dist/tools/getDiagnostics.js +32 -29
- package/dist/tools/getDiagnostics.js.map +1 -1
- package/dist/tools/getDiffFromHandoff.js +8 -2
- package/dist/tools/getDiffFromHandoff.js.map +1 -1
- package/dist/tools/getDocumentSymbols.d.ts +1 -0
- package/dist/tools/getGitHotspots.d.ts +1 -0
- package/dist/tools/getImportedSignatures.d.ts +1 -0
- package/dist/tools/getImportedSignatures.js +18 -14
- package/dist/tools/getImportedSignatures.js.map +1 -1
- package/dist/tools/getPRTemplate.d.ts +1 -0
- package/dist/tools/getProjectContext.js +23 -10
- package/dist/tools/getProjectContext.js.map +1 -1
- package/dist/tools/getSymbolHistory.d.ts +1 -0
- package/dist/tools/getToolCapabilities.d.ts +10 -5
- package/dist/tools/getToolCapabilities.js +79 -202
- package/dist/tools/getToolCapabilities.js.map +1 -1
- package/dist/tools/getTypeSignature.d.ts +1 -0
- package/dist/tools/getWorkspaceSettings.d.ts +1 -0
- package/dist/tools/gitWrite.d.ts +11 -0
- package/dist/tools/github/actions.d.ts +2 -0
- package/dist/tools/github/composite.d.ts +3 -0
- package/dist/tools/github/issues.d.ts +4 -0
- package/dist/tools/github/pr.d.ts +7 -0
- package/dist/tools/handoffNote.d.ts +1 -0
- package/dist/tools/handoffNote.js +2 -1
- package/dist/tools/handoffNote.js.map +1 -1
- package/dist/tools/headless/lspClient.js +3 -0
- package/dist/tools/headless/lspClient.js.map +1 -1
- package/dist/tools/hoverAtCursor.d.ts +1 -0
- package/dist/tools/httpClient.d.ts +2 -0
- package/dist/tools/httpClient.js +38 -71
- package/dist/tools/httpClient.js.map +1 -1
- package/dist/tools/inlayHints.d.ts +1 -0
- package/dist/tools/launchQuickTask.d.ts +1 -0
- package/dist/tools/listClaudeTasks.d.ts +1 -0
- package/dist/tools/listClaudeTasks.js +10 -8
- package/dist/tools/listClaudeTasks.js.map +1 -1
- package/dist/tools/listTerminals.d.ts +1 -0
- package/dist/tools/lsp.d.ts +15 -0
- package/dist/tools/lsp.js +17 -0
- package/dist/tools/lsp.js.map +1 -1
- package/dist/tools/navigateToSymbolByName.d.ts +1 -0
- package/dist/tools/openDiff.d.ts +1 -0
- package/dist/tools/openDiff.js +4 -1
- package/dist/tools/openDiff.js.map +1 -1
- package/dist/tools/openFile.d.ts +1 -0
- package/dist/tools/openFile.js +4 -1
- package/dist/tools/openFile.js.map +1 -1
- package/dist/tools/openInBrowser.js +6 -1
- package/dist/tools/openInBrowser.js.map +1 -1
- package/dist/tools/organizeImports.d.ts +1 -0
- package/dist/tools/organizeImports.js +5 -3
- package/dist/tools/organizeImports.js.map +1 -1
- package/dist/tools/performanceReport.js +5 -3
- package/dist/tools/performanceReport.js.map +1 -1
- package/dist/tools/planPersistence.d.ts +3 -0
- package/dist/tools/planPersistence.js +4 -1
- package/dist/tools/planPersistence.js.map +1 -1
- package/dist/tools/previewEdit.d.ts +1 -0
- package/dist/tools/previewEdit.js +15 -4
- package/dist/tools/previewEdit.js.map +1 -1
- package/dist/tools/recentTracesDigest.js +54 -11
- package/dist/tools/recentTracesDigest.js.map +1 -1
- package/dist/tools/refactorAnalyze.d.ts +1 -0
- package/dist/tools/refactorExtractFunction.js +4 -1
- package/dist/tools/refactorExtractFunction.js.map +1 -1
- package/dist/tools/refactorPreview.d.ts +1 -0
- package/dist/tools/refactorPreview.js +10 -2
- package/dist/tools/refactorPreview.js.map +1 -1
- package/dist/tools/replaceBlock.d.ts +1 -0
- package/dist/tools/replaceBlock.js +2 -1
- package/dist/tools/replaceBlock.js.map +1 -1
- package/dist/tools/resumeClaudeTask.d.ts +1 -0
- package/dist/tools/runClaudeTask.d.ts +1 -0
- package/dist/tools/runCommand.js +5 -0
- package/dist/tools/runCommand.js.map +1 -1
- package/dist/tools/runTests.js +15 -4
- package/dist/tools/runTests.js.map +1 -1
- package/dist/tools/screenshot.d.ts +1 -0
- package/dist/tools/screenshotAndAnnotate.js +6 -2
- package/dist/tools/screenshotAndAnnotate.js.map +1 -1
- package/dist/tools/searchAndReplace.d.ts +1 -0
- package/dist/tools/searchAndReplace.js +17 -7
- package/dist/tools/searchAndReplace.js.map +1 -1
- package/dist/tools/searchTools.js +20 -19
- package/dist/tools/searchTools.js.map +1 -1
- package/dist/tools/searchWorkspace.d.ts +1 -0
- package/dist/tools/selectionRanges.d.ts +1 -0
- package/dist/tools/semanticTokens.d.ts +1 -0
- package/dist/tools/signatureHelp.d.ts +1 -0
- package/dist/tools/spawnWorkspace.js +15 -7
- package/dist/tools/spawnWorkspace.js.map +1 -1
- package/dist/tools/terminal.d.ts +6 -0
- package/dist/tools/terminal.js +4 -0
- package/dist/tools/terminal.js.map +1 -1
- package/dist/tools/testRunners/pytest.js +6 -2
- package/dist/tools/testRunners/pytest.js.map +1 -1
- package/dist/tools/testRunners/vitestJest.js +3 -1
- package/dist/tools/testRunners/vitestJest.js.map +1 -1
- package/dist/tools/testTraceToSource.d.ts +1 -0
- package/dist/tools/transaction.d.ts +4 -0
- package/dist/tools/transaction.js +4 -1
- package/dist/tools/transaction.js.map +1 -1
- package/dist/tools/typeHierarchy.d.ts +1 -0
- package/dist/tools/utils.d.ts +22 -0
- package/dist/tools/utils.js +158 -14
- package/dist/tools/utils.js.map +1 -1
- package/dist/tools/vscodeCommands.d.ts +2 -0
- package/dist/tools/vscodeTasks.d.ts +2 -0
- package/dist/tools/workspaceSettings.d.ts +1 -0
- package/dist/transport.d.ts +3 -1
- package/dist/transport.js +103 -52
- package/dist/transport.js.map +1 -1
- package/dist/winShim.d.ts +34 -0
- package/dist/winShim.js +94 -0
- package/dist/winShim.js.map +1 -0
- package/dist/wireHaltPushDispatch.d.ts +38 -0
- package/dist/wireHaltPushDispatch.js +71 -0
- package/dist/wireHaltPushDispatch.js.map +1 -0
- package/dist/writeFileAtomic.d.ts +23 -0
- package/dist/writeFileAtomic.js +121 -0
- package/dist/writeFileAtomic.js.map +1 -0
- package/package.json +23 -7
- package/scripts/postinstall.mjs +42 -2
- package/scripts/smoke/run-all.mjs +213 -0
- package/scripts/start-all.mjs +572 -0
- package/scripts/start-all.ps1 +209 -0
- package/scripts/start-all.sh +77 -19
- package/scripts/start-orchestrator.ps1 +158 -0
- package/scripts/start-remote.mjs +122 -0
- package/templates/automation-policies/recipe-authoring.json +1 -1
- package/templates/automation-policies/security-first.json +1 -1
- package/templates/automation-policies/strict-lint.json +1 -1
- package/templates/automation-policies/test-driven.json +1 -1
- package/templates/automation-policy.example.json +1 -1
- package/templates/co.patchwork-os.bridge.plist +2 -2
- package/templates/recipes/approval-queue-ui-test.yaml +205 -0
- package/templates/recipes/ctx-loop-test.yaml +1 -1
- package/templates/recipes/fix-errors-on-save.yaml +71 -0
- package/templates/recipes/morning-brief.yaml +5 -2
- package/templates/recipes/project-health-check.yaml +4 -1
- package/templates/recipes/sentry-to-linear.yaml +72 -38
- package/templates/recipes/webhook/apple-watch-health-log.yaml +145 -0
- package/templates/recipes/webhook/customer-escalation.yaml +8 -9
- package/templates/recipes/webhook/meeting-prep.yaml +11 -5
- package/dist/commands/marketplace.d.ts +0 -11
- package/dist/commands/marketplace.js +0 -120
- package/dist/commands/marketplace.js.map +0 -1
- package/dist/recipes/legacyRecipeCompat.d.ts +0 -10
- package/dist/recipes/legacyRecipeCompat.js +0 -131
- package/dist/recipes/legacyRecipeCompat.js.map +0 -1
|
@@ -1,8 +1,40 @@
|
|
|
1
|
-
import
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import { mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { parse as parseYaml } from "yaml";
|
|
4
5
|
import { compileRecipeFull } from "./compiler.js";
|
|
5
6
|
import { parseRecipe } from "./parser.js";
|
|
7
|
+
/**
|
|
8
|
+
* Atomic temp+rename for the default install write. Audit 2026-05-17:
|
|
9
|
+
* two concurrent installs of the same recipe (cross-process, e.g.
|
|
10
|
+
* dashboard + CLI racing) used to interleave bytes within the JSON
|
|
11
|
+
* payload because the previous `writeFileSync(destPath, ...)` is not
|
|
12
|
+
* atomic for sub-page writes. A torn JSON file fails to parse and the
|
|
13
|
+
* recipe becomes invisible to the scheduler.
|
|
14
|
+
*
|
|
15
|
+
* `rename` is atomic at the FS layer on every platform we ship on
|
|
16
|
+
* (apfs / ext4 / ntfs / xfs). With temp+rename, two concurrent writers
|
|
17
|
+
* each end up with their own intact file → last `rename` wins, but
|
|
18
|
+
* the file on disk is ALWAYS a valid JSON document.
|
|
19
|
+
*/
|
|
20
|
+
function atomicWriteSync(target, content) {
|
|
21
|
+
const tmp = `${target}.tmp.${process.pid}.${crypto
|
|
22
|
+
.randomBytes(6)
|
|
23
|
+
.toString("hex")}`;
|
|
24
|
+
try {
|
|
25
|
+
writeFileSync(tmp, content);
|
|
26
|
+
renameSync(tmp, target);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
try {
|
|
30
|
+
unlinkSync(tmp);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* already gone or never created */
|
|
34
|
+
}
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
6
38
|
export function installRecipeFromFile(sourcePath, opts) {
|
|
7
39
|
const ext = path.extname(sourcePath).toLowerCase();
|
|
8
40
|
if (ext !== ".json" && ext !== ".yaml" && ext !== ".yml") {
|
|
@@ -10,7 +42,10 @@ export function installRecipeFromFile(sourcePath, opts) {
|
|
|
10
42
|
}
|
|
11
43
|
const fs = opts.fs ?? {};
|
|
12
44
|
const readFile = fs.readFile ?? ((p) => readFileSync(p, "utf-8"));
|
|
13
|
-
|
|
45
|
+
// Default writer is atomic (temp+rename). Callers may inject their
|
|
46
|
+
// own writeFile (tests, in-memory fs); they are responsible for
|
|
47
|
+
// their own atomicity guarantees.
|
|
48
|
+
const writeFile = fs.writeFile ?? atomicWriteSync;
|
|
14
49
|
const mkdir = fs.mkdir ?? ((p) => mkdirSync(p, { recursive: true }));
|
|
15
50
|
const text = readFile(sourcePath);
|
|
16
51
|
const raw = ext === ".json"
|
|
@@ -39,6 +74,17 @@ export function installRecipeFromFile(sourcePath, opts) {
|
|
|
39
74
|
: compileRecipeFull(recipe);
|
|
40
75
|
mkdir(opts.recipesDir);
|
|
41
76
|
const destPath = path.join(opts.recipesDir, `${recipe.name}.json`);
|
|
77
|
+
// Belt-and-braces: parseRecipe already constrains `name` to the
|
|
78
|
+
// RECIPE_NAME_RE charset, but assert the resolved path stays inside
|
|
79
|
+
// recipesDir before writing. Defends against any future parser bypass
|
|
80
|
+
// and against callers reaching this function with a pre-parsed object
|
|
81
|
+
// that skipped parseRecipe.
|
|
82
|
+
const resolvedDir = path.resolve(opts.recipesDir);
|
|
83
|
+
const resolvedDest = path.resolve(destPath);
|
|
84
|
+
if (resolvedDest !== resolvedDir &&
|
|
85
|
+
!resolvedDest.startsWith(resolvedDir + path.sep)) {
|
|
86
|
+
throw new Error(`installRecipeFromFile: refusing to write outside recipesDir (dest=${resolvedDest} dir=${resolvedDir})`);
|
|
87
|
+
}
|
|
42
88
|
let action = "created";
|
|
43
89
|
try {
|
|
44
90
|
readFile(destPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.js","sourceRoot":"","sources":["../../src/recipes/installer.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"installer.js","sourceRoot":"","sources":["../../src/recipes/installer.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;;;;;;GAYG;AACH,SAAS,eAAe,CAAC,MAAc,EAAE,OAAe;IACtD,MAAM,GA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AC5B,CAAC,YAAY,CAAC,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,EAChD,CAAC;QACD,MAAM,IAAI,KAAK,CACb,qEAAqE,YAAY,QAAQ,WAAW,GAAG,CACxG,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,GAA2B,SAAS,CAAC;IAC/C,IAAI,CAAC;QACH,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,MAAM,GAAG,UAAU,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,gCAAgC;IAClC,CAAC;IACD,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAErD,+FAA+F;IAC/F,6EAA6E;IAC7E,2DAA2D;IAC3D,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CACpC,EAAE,WAAW,EAAE,QAAQ,CAAC,oBAAoB,EAAE,EAC9C,IAAI,EACJ,CAAC,CACF,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,aAAa,EAAE,QAAQ;QACvB,MAAM;QACN,eAAe;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Judge-verdict aggregation — PR3b.
|
|
3
|
+
*
|
|
4
|
+
* Parallel to haltCategory.summariseHalts: walks a window of runs and
|
|
5
|
+
* counts judge-step verdicts (`approve` / `request_changes` /
|
|
6
|
+
* `unparseable`). Surfaces through:
|
|
7
|
+
*
|
|
8
|
+
* - `/metrics` as `bridge_recipe_judgments{verdict="..."}` gauge
|
|
9
|
+
* - (later) dashboard panel + session-start digest in PR3c
|
|
10
|
+
*
|
|
11
|
+
* Augment-only invariant (see judgeVerdict.ts): a `request_changes`
|
|
12
|
+
* verdict never appears as a HaltCategory and never causes
|
|
13
|
+
* `status: "error"`. This module is the *separate* channel that makes
|
|
14
|
+
* cold-eyes review visible without re-introducing gate semantics.
|
|
15
|
+
*/
|
|
16
|
+
import type { JudgeVerdict, JudgeVerdictKind } from "./judgeVerdict.js";
|
|
17
|
+
export interface JudgeSummary {
|
|
18
|
+
/** Total step results scanned that carry a `judgeVerdict`. */
|
|
19
|
+
total: number;
|
|
20
|
+
/** Per-verdict counts; verdicts with zero hits are omitted. */
|
|
21
|
+
byVerdict: Partial<Record<JudgeVerdictKind, number>>;
|
|
22
|
+
/** Most recent 5 verdicts (with first reason) for UI surfacing. */
|
|
23
|
+
recent: Array<{
|
|
24
|
+
verdict: JudgeVerdictKind;
|
|
25
|
+
firstReason?: string;
|
|
26
|
+
runSeq: number;
|
|
27
|
+
stepId: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
interface JudgeSummaryInputRun {
|
|
31
|
+
seq: number;
|
|
32
|
+
stepResults?: Array<{
|
|
33
|
+
id: string;
|
|
34
|
+
judgeVerdict?: JudgeVerdict;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Aggregate judge verdicts across a set of runs. Runs are expected to
|
|
39
|
+
* be sorted newest-first so `recent` reflects the most recent
|
|
40
|
+
* verdicts.
|
|
41
|
+
*/
|
|
42
|
+
export declare function summariseJudgments(runs: JudgeSummaryInputRun[]): JudgeSummary;
|
|
43
|
+
/**
|
|
44
|
+
* Format a `JudgeSummary` as Prometheus text-exposition lines for the
|
|
45
|
+
* `bridge_recipe_judgments{verdict="..."} N` gauge. Returns an empty
|
|
46
|
+
* array when the summary is empty (no HELP/TYPE block so Prom scrapers
|
|
47
|
+
* don't see an orphan declaration).
|
|
48
|
+
*/
|
|
49
|
+
export declare function judgeSummaryToPrometheus(summary: JudgeSummary): string[];
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aggregate judge verdicts across a set of runs. Runs are expected to
|
|
3
|
+
* be sorted newest-first so `recent` reflects the most recent
|
|
4
|
+
* verdicts.
|
|
5
|
+
*/
|
|
6
|
+
export function summariseJudgments(runs) {
|
|
7
|
+
const byVerdict = {};
|
|
8
|
+
const recent = [];
|
|
9
|
+
let total = 0;
|
|
10
|
+
for (const run of runs) {
|
|
11
|
+
for (const step of run.stepResults ?? []) {
|
|
12
|
+
const v = step.judgeVerdict;
|
|
13
|
+
if (!v)
|
|
14
|
+
continue;
|
|
15
|
+
total++;
|
|
16
|
+
byVerdict[v.verdict] = (byVerdict[v.verdict] ?? 0) + 1;
|
|
17
|
+
if (recent.length < 5) {
|
|
18
|
+
recent.push({
|
|
19
|
+
verdict: v.verdict,
|
|
20
|
+
...(v.reasons[0] !== undefined && { firstReason: v.reasons[0] }),
|
|
21
|
+
runSeq: run.seq,
|
|
22
|
+
stepId: step.id,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return { total, byVerdict, recent };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Format a `JudgeSummary` as Prometheus text-exposition lines for the
|
|
31
|
+
* `bridge_recipe_judgments{verdict="..."} N` gauge. Returns an empty
|
|
32
|
+
* array when the summary is empty (no HELP/TYPE block so Prom scrapers
|
|
33
|
+
* don't see an orphan declaration).
|
|
34
|
+
*/
|
|
35
|
+
export function judgeSummaryToPrometheus(summary) {
|
|
36
|
+
if (summary.total === 0)
|
|
37
|
+
return [];
|
|
38
|
+
const lines = [
|
|
39
|
+
"# HELP bridge_recipe_judgments Recipe judge-step verdicts in the in-memory run-log window, by verdict",
|
|
40
|
+
"# TYPE bridge_recipe_judgments gauge",
|
|
41
|
+
];
|
|
42
|
+
for (const [verdict, count] of Object.entries(summary.byVerdict)) {
|
|
43
|
+
lines.push(`bridge_recipe_judgments{verdict="${verdict}"} ${count}`);
|
|
44
|
+
}
|
|
45
|
+
return lines;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=judgeSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judgeSummary.js","sourceRoot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C,OAAO,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACjE,KAAK,CAAC,IAAI,CAAC,oCAAoC,OAAO,MAAM,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Judge verdict — PR3a.
|
|
3
|
+
*
|
|
4
|
+
* Parses a free-form agent response into a structured `JudgeVerdict`.
|
|
5
|
+
* The judge prompt convention asks the model to end its response with
|
|
6
|
+
* a JSON object of the form:
|
|
7
|
+
*
|
|
8
|
+
* {"verdict": "approve" | "request_changes",
|
|
9
|
+
* "reasons": ["..."],
|
|
10
|
+
* "fixList": ["..."]}
|
|
11
|
+
*
|
|
12
|
+
* The parser walks back from the end of the string, finds the last
|
|
13
|
+
* JSON object, and validates its shape. On any failure we record the
|
|
14
|
+
* verdict as `unparseable` and keep the raw text — the runner *never*
|
|
15
|
+
* throws on a malformed judge response.
|
|
16
|
+
*
|
|
17
|
+
* **Augment-only invariant** — see the file-level comment in
|
|
18
|
+
* yamlRunner.ts. The verdict shape is intentionally separate from
|
|
19
|
+
* `StepResult.status`: a `request_changes` verdict produces
|
|
20
|
+
* `status: "ok"` with a stashed verdict, never `status: "error"`.
|
|
21
|
+
* That separation is what prevents the judge step from quietly
|
|
22
|
+
* becoming a gate.
|
|
23
|
+
*/
|
|
24
|
+
export type JudgeVerdictKind = "approve" | "request_changes" | "unparseable";
|
|
25
|
+
export interface JudgeVerdict {
|
|
26
|
+
verdict: JudgeVerdictKind;
|
|
27
|
+
/** Short bullet points; empty when unparseable. */
|
|
28
|
+
reasons: string[];
|
|
29
|
+
/** Optional fix-list when `verdict: "request_changes"`. */
|
|
30
|
+
fixList?: string[];
|
|
31
|
+
/** Original model text when parsing failed (or for audit). */
|
|
32
|
+
raw?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Append to the judge prompt to elicit the structured tail. Kept short
|
|
36
|
+
* so it doesn't crowd out the user-provided prompt body.
|
|
37
|
+
*/
|
|
38
|
+
export declare const JUDGE_PROMPT_SUFFIX = "\n\nYou are a cold-eyes reviewer. Respond with a brief assessment, then end\nwith a single JSON object on its own line:\n\n{\"verdict\": \"approve\" | \"request_changes\", \"reasons\": [\"...\"], \"fixList\": [\"...\"]}\n\nThe \"fixList\" is optional and only relevant when requesting changes.\nOutput only the JSON object as the final line.";
|
|
39
|
+
/**
|
|
40
|
+
* Build the artefact-injection block for a judge step that has a
|
|
41
|
+
* `reviews: <stepId>` reference. Returns an empty string when no
|
|
42
|
+
* artefact is available; the judge then sees the prompt as-is.
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildJudgeArtefactBlock(artefact: unknown): string;
|
|
45
|
+
/**
|
|
46
|
+
* Parse an agent response into a `JudgeVerdict`. Never throws.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseJudgeVerdict(text: string): JudgeVerdict;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Judge verdict — PR3a.
|
|
3
|
+
*
|
|
4
|
+
* Parses a free-form agent response into a structured `JudgeVerdict`.
|
|
5
|
+
* The judge prompt convention asks the model to end its response with
|
|
6
|
+
* a JSON object of the form:
|
|
7
|
+
*
|
|
8
|
+
* {"verdict": "approve" | "request_changes",
|
|
9
|
+
* "reasons": ["..."],
|
|
10
|
+
* "fixList": ["..."]}
|
|
11
|
+
*
|
|
12
|
+
* The parser walks back from the end of the string, finds the last
|
|
13
|
+
* JSON object, and validates its shape. On any failure we record the
|
|
14
|
+
* verdict as `unparseable` and keep the raw text — the runner *never*
|
|
15
|
+
* throws on a malformed judge response.
|
|
16
|
+
*
|
|
17
|
+
* **Augment-only invariant** — see the file-level comment in
|
|
18
|
+
* yamlRunner.ts. The verdict shape is intentionally separate from
|
|
19
|
+
* `StepResult.status`: a `request_changes` verdict produces
|
|
20
|
+
* `status: "ok"` with a stashed verdict, never `status: "error"`.
|
|
21
|
+
* That separation is what prevents the judge step from quietly
|
|
22
|
+
* becoming a gate.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Append to the judge prompt to elicit the structured tail. Kept short
|
|
26
|
+
* so it doesn't crowd out the user-provided prompt body.
|
|
27
|
+
*/
|
|
28
|
+
export const JUDGE_PROMPT_SUFFIX = `
|
|
29
|
+
|
|
30
|
+
You are a cold-eyes reviewer. Respond with a brief assessment, then end
|
|
31
|
+
with a single JSON object on its own line:
|
|
32
|
+
|
|
33
|
+
{"verdict": "approve" | "request_changes", "reasons": ["..."], "fixList": ["..."]}
|
|
34
|
+
|
|
35
|
+
The "fixList" is optional and only relevant when requesting changes.
|
|
36
|
+
Output only the JSON object as the final line.`;
|
|
37
|
+
/**
|
|
38
|
+
* Build the artefact-injection block for a judge step that has a
|
|
39
|
+
* `reviews: <stepId>` reference. Returns an empty string when no
|
|
40
|
+
* artefact is available; the judge then sees the prompt as-is.
|
|
41
|
+
*/
|
|
42
|
+
export function buildJudgeArtefactBlock(artefact) {
|
|
43
|
+
if (artefact === undefined || artefact === null)
|
|
44
|
+
return "";
|
|
45
|
+
let body;
|
|
46
|
+
if (typeof artefact === "string") {
|
|
47
|
+
body = artefact;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
try {
|
|
51
|
+
body = JSON.stringify(artefact, null, 2);
|
|
52
|
+
// `JSON.stringify` returns `undefined` for functions / symbols /
|
|
53
|
+
// top-level BigInt — the artefact block becomes
|
|
54
|
+
// `<artefact>\nundefined\n</artefact>` which is misleading. Fall
|
|
55
|
+
// back to a marker so downstream readers can spot the gap.
|
|
56
|
+
if (body === undefined)
|
|
57
|
+
body = "[unserialisable artefact]";
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// Circular references, BigInt inside the object graph, or any
|
|
61
|
+
// toJSON throwing. The judge step must never propagate this out
|
|
62
|
+
// of the prompt builder — augment-only invariant.
|
|
63
|
+
body = "[unserialisable artefact]";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return `\n\n<artefact>\n${body}\n</artefact>`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Walk `text` forward and emit `[start, endInclusive]` ranges for every
|
|
70
|
+
* balanced top-level `{...}` block, respecting JSON string syntax so a
|
|
71
|
+
* `}` inside a string doesn't offset the brace depth.
|
|
72
|
+
*
|
|
73
|
+
* The original implementation walked back from `lastIndexOf("}")` and
|
|
74
|
+
* counted braces literally. A judge response of the shape
|
|
75
|
+
* `Consider this snippet: { x: "} oops" }` would be miscounted — the
|
|
76
|
+
* `}` inside the string would close depth too early and the candidate
|
|
77
|
+
* slice would JSON.parse-fail, returning `unparseable` for an
|
|
78
|
+
* otherwise-legitimate verdict trailer.
|
|
79
|
+
*/
|
|
80
|
+
function findBalancedObjectRanges(text) {
|
|
81
|
+
const ranges = [];
|
|
82
|
+
let depth = 0;
|
|
83
|
+
let start = -1;
|
|
84
|
+
let inString = false;
|
|
85
|
+
let escaped = false;
|
|
86
|
+
for (let i = 0; i < text.length; i++) {
|
|
87
|
+
const ch = text[i];
|
|
88
|
+
if (inString) {
|
|
89
|
+
if (escaped) {
|
|
90
|
+
escaped = false;
|
|
91
|
+
}
|
|
92
|
+
else if (ch === "\\") {
|
|
93
|
+
escaped = true;
|
|
94
|
+
}
|
|
95
|
+
else if (ch === '"') {
|
|
96
|
+
inString = false;
|
|
97
|
+
}
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (ch === '"') {
|
|
101
|
+
inString = true;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (ch === "{") {
|
|
105
|
+
if (depth === 0)
|
|
106
|
+
start = i;
|
|
107
|
+
depth++;
|
|
108
|
+
}
|
|
109
|
+
else if (ch === "}") {
|
|
110
|
+
depth--;
|
|
111
|
+
if (depth === 0 && start !== -1) {
|
|
112
|
+
ranges.push([start, i]);
|
|
113
|
+
start = -1;
|
|
114
|
+
}
|
|
115
|
+
if (depth < 0) {
|
|
116
|
+
// Stray closing brace — reset so we don't underflow.
|
|
117
|
+
depth = 0;
|
|
118
|
+
start = -1;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return ranges;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Parse an agent response into a `JudgeVerdict`. Never throws.
|
|
126
|
+
*/
|
|
127
|
+
export function parseJudgeVerdict(text) {
|
|
128
|
+
const trimmed = text.trim();
|
|
129
|
+
if (trimmed.length === 0) {
|
|
130
|
+
return {
|
|
131
|
+
verdict: "unparseable",
|
|
132
|
+
reasons: [],
|
|
133
|
+
raw: text,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
// Collect every balanced `{...}` range, then try them last-to-first
|
|
137
|
+
// so the JSON tail wins over an in-prose snippet earlier in the
|
|
138
|
+
// response.
|
|
139
|
+
const ranges = findBalancedObjectRanges(trimmed);
|
|
140
|
+
for (let i = ranges.length - 1; i >= 0; i--) {
|
|
141
|
+
const range = ranges[i];
|
|
142
|
+
if (!range)
|
|
143
|
+
continue;
|
|
144
|
+
const [s, e] = range;
|
|
145
|
+
const candidate = trimmed.slice(s, e + 1);
|
|
146
|
+
let parsed;
|
|
147
|
+
try {
|
|
148
|
+
parsed = JSON.parse(candidate);
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (!parsed || typeof parsed !== "object")
|
|
154
|
+
continue;
|
|
155
|
+
const obj = parsed;
|
|
156
|
+
const verdictRaw = obj.verdict;
|
|
157
|
+
if (verdictRaw !== "approve" && verdictRaw !== "request_changes") {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const reasons = Array.isArray(obj.reasons)
|
|
161
|
+
? obj.reasons.filter((r) => typeof r === "string")
|
|
162
|
+
: [];
|
|
163
|
+
const fixList = Array.isArray(obj.fixList)
|
|
164
|
+
? obj.fixList.filter((r) => typeof r === "string")
|
|
165
|
+
: undefined;
|
|
166
|
+
return {
|
|
167
|
+
verdict: verdictRaw,
|
|
168
|
+
reasons,
|
|
169
|
+
...(fixList && fixList.length > 0 && { fixList }),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
return { verdict: "unparseable", reasons: [], raw: text };
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=judgeVerdict.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judgeVerdict.js","sourceRoot":"","sources":["../../src/recipes/judgeVerdict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAcH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;+CAQY,CAAC;AAEhD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAiB;IACvD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAC3D,IAAI,IAAY,CAAC;IACjB,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,IAAI,GAAG,QAAQ,CAAC;IAClB,CAAC;SAAM,CAAC;QACN,IAAI,CAAC;YACH,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACzC,iEAAiE;YACjE,gDAAgD;YAChD,iEAAiE;YACjE,2DAA2D;YAC3D,IAAI,IAAI,KAAK,SAAS;gBAAE,IAAI,GAAG,2BAA2B,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACP,8DAA8D;YAC9D,gEAAgE;YAChE,kDAAkD;YAClD,IAAI,GAAG,2BAA2B,CAAC;QACrC,CAAC;IACH,CAAC;IACD,OAAO,mBAAmB,IAAI,eAAe,CAAC;AAChD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,wBAAwB,CAAC,IAAY;IAC5C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CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;YACxC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;YAC/D,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;YACxC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;YAC/D,CAAC,CAAC,SAAS,CAAC;QACd,OAAO;YACL,OAAO,EAAE,UAAU;YACnB,OAAO;YACP,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;SAClD,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { WarnFn } from "./types.js";
|
|
2
2
|
export type { RecipeMigration, WarnFn } from "./types.js";
|
|
3
3
|
export { v1Migration } from "./v1.js";
|
|
4
|
+
/**
|
|
5
|
+
* Default deprecation-warning sink for the runtime/validation/fmt callers.
|
|
6
|
+
* Forwards to `console.warn` outside of tests so users see migration
|
|
7
|
+
* prompts in CLI output, but stays silent under vitest so the dozens of
|
|
8
|
+
* intentional legacy-shape regression fixtures don't flood stderr. Tests
|
|
9
|
+
* that need to assert warnings still pass their own `vi.fn()` directly.
|
|
10
|
+
*/
|
|
11
|
+
export declare const defaultDeprecationWarn: WarnFn;
|
|
4
12
|
/** apiVersion produced by the most recent migration. */
|
|
5
13
|
export declare const CURRENT_API_VERSION = "patchwork.sh/v1";
|
|
6
14
|
export interface MigrationResult {
|
|
@@ -22,3 +30,4 @@ export interface MigrationResult {
|
|
|
22
30
|
* through unchanged so downstream schema lint can flag it).
|
|
23
31
|
*/
|
|
24
32
|
export declare function migrateRecipeToCurrent(recipe: unknown, warn?: WarnFn): MigrationResult;
|
|
33
|
+
export declare function normalizeRecipeForRuntime(recipe: unknown, warn?: WarnFn): unknown;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { v1Migration } from "./v1.js";
|
|
2
2
|
export { v1Migration } from "./v1.js";
|
|
3
|
+
/**
|
|
4
|
+
* Default deprecation-warning sink for the runtime/validation/fmt callers.
|
|
5
|
+
* Forwards to `console.warn` outside of tests so users see migration
|
|
6
|
+
* prompts in CLI output, but stays silent under vitest so the dozens of
|
|
7
|
+
* intentional legacy-shape regression fixtures don't flood stderr. Tests
|
|
8
|
+
* that need to assert warnings still pass their own `vi.fn()` directly.
|
|
9
|
+
*/
|
|
10
|
+
export const defaultDeprecationWarn = (msg) => {
|
|
11
|
+
if (process.env.VITEST || process.env.NODE_ENV === "test")
|
|
12
|
+
return;
|
|
13
|
+
console.warn(msg);
|
|
14
|
+
};
|
|
3
15
|
/** apiVersion produced by the most recent migration. */
|
|
4
16
|
export const CURRENT_API_VERSION = "patchwork.sh/v1";
|
|
5
17
|
/**
|
|
@@ -52,4 +64,125 @@ export function migrateRecipeToCurrent(recipe, warn) {
|
|
|
52
64
|
}
|
|
53
65
|
return { recipe: current, applied };
|
|
54
66
|
}
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
// Field-level legacy normalisation (formerly legacyRecipeCompat.ts)
|
|
69
|
+
//
|
|
70
|
+
// These functions accept recipes in any historical shape and produce the
|
|
71
|
+
// current canonical shape. They run alongside the apiVersion migration
|
|
72
|
+
// chain above.
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
export function normalizeRecipeForRuntime(recipe, warn) {
|
|
75
|
+
if (!isRecord(recipe)) {
|
|
76
|
+
return recipe;
|
|
77
|
+
}
|
|
78
|
+
// Apply apiVersion migrations first so downstream field-level
|
|
79
|
+
// legacy compat operates on a recipe stamped with the current
|
|
80
|
+
// apiVersion (and so the deprecation warning for missing
|
|
81
|
+
// apiVersion fires once per call).
|
|
82
|
+
const migrated = migrateRecipeToCurrent(recipe, warn).recipe;
|
|
83
|
+
const source = isRecord(migrated) ? migrated : recipe;
|
|
84
|
+
const normalized = {
|
|
85
|
+
...source,
|
|
86
|
+
};
|
|
87
|
+
if (isRecord(normalized.trigger)) {
|
|
88
|
+
normalized.trigger = normalizeLegacyTriggerForRuntime(normalized.trigger, warn);
|
|
89
|
+
}
|
|
90
|
+
if (Array.isArray(normalized.steps)) {
|
|
91
|
+
normalized.steps = normalized.steps.map((step) => normalizeLegacyRuntimeStep(step, warn));
|
|
92
|
+
}
|
|
93
|
+
return normalized;
|
|
94
|
+
}
|
|
95
|
+
function normalizeLegacyTriggerForRuntime(trigger, warn) {
|
|
96
|
+
const normalized = { ...trigger };
|
|
97
|
+
if (normalized.type === "cron" &&
|
|
98
|
+
typeof normalized.schedule === "string" &&
|
|
99
|
+
typeof normalized.at !== "string") {
|
|
100
|
+
warn?.("Deprecated recipe field: trigger.schedule — rename to trigger.at (will be removed in a future major version)");
|
|
101
|
+
normalized.at = normalized.schedule;
|
|
102
|
+
}
|
|
103
|
+
delete normalized.schedule;
|
|
104
|
+
return normalized;
|
|
105
|
+
}
|
|
106
|
+
function normalizeLegacyRuntimeStep(step, warn) {
|
|
107
|
+
if (!isRecord(step)) {
|
|
108
|
+
return step;
|
|
109
|
+
}
|
|
110
|
+
const normalized = {};
|
|
111
|
+
for (const [key, value] of Object.entries(step)) {
|
|
112
|
+
if (key === "params" || key === "output" || key === "prompt") {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (key === "agent" && typeof value === "boolean") {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (key === "parallel" && Array.isArray(value)) {
|
|
119
|
+
normalized.parallel = value.map((entry) => normalizeLegacyRuntimeStep(entry, warn));
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (key === "branch" && Array.isArray(value)) {
|
|
123
|
+
normalized.branch = value.map((entry) => normalizeLegacyBranchEntry(entry, warn));
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
normalized[key] = value;
|
|
127
|
+
}
|
|
128
|
+
if (step.agent === true || isRecord(step.agent)) {
|
|
129
|
+
const agentConfig = isRecord(step.agent)
|
|
130
|
+
? { ...step.agent }
|
|
131
|
+
: {};
|
|
132
|
+
if (typeof step.prompt === "string" &&
|
|
133
|
+
typeof agentConfig.prompt !== "string") {
|
|
134
|
+
warn?.("Deprecated recipe step field: prompt at step level — move to step.agent.prompt (will be removed in a future major version)");
|
|
135
|
+
agentConfig.prompt = step.prompt;
|
|
136
|
+
}
|
|
137
|
+
if (typeof step.output === "string" &&
|
|
138
|
+
typeof agentConfig.into !== "string") {
|
|
139
|
+
warn?.("Deprecated recipe step field: output — use step.agent.into instead (will be removed in a future major version)");
|
|
140
|
+
agentConfig.into = step.output;
|
|
141
|
+
}
|
|
142
|
+
if (step.agent === true) {
|
|
143
|
+
warn?.("Deprecated recipe step field: agent: true — use agent: { prompt, into } object instead (will be removed in a future major version)");
|
|
144
|
+
}
|
|
145
|
+
normalized.agent = agentConfig;
|
|
146
|
+
return normalized;
|
|
147
|
+
}
|
|
148
|
+
if (isRecord(step.params)) {
|
|
149
|
+
warn?.("Deprecated recipe step field: params — inline fields directly on the step (will be removed in a future major version)");
|
|
150
|
+
Object.assign(normalized, step.params);
|
|
151
|
+
}
|
|
152
|
+
if (typeof normalized.recipe !== "string" &&
|
|
153
|
+
typeof normalized.chain === "string") {
|
|
154
|
+
warn?.("Deprecated recipe step field: chain — rename to recipe (will be removed in a future major version)");
|
|
155
|
+
normalized.recipe = normalized.chain;
|
|
156
|
+
}
|
|
157
|
+
delete normalized.chain;
|
|
158
|
+
if (typeof normalized.into !== "string" && typeof step.output === "string") {
|
|
159
|
+
warn?.("Deprecated recipe step field: output — rename to into (will be removed in a future major version)");
|
|
160
|
+
normalized.into = step.output;
|
|
161
|
+
}
|
|
162
|
+
if (normalized.tool === "file.append" &&
|
|
163
|
+
typeof normalized.content !== "string" &&
|
|
164
|
+
typeof normalized.line === "string") {
|
|
165
|
+
warn?.("Deprecated recipe step field: line (file.append) — rename to content (will be removed in a future major version)");
|
|
166
|
+
normalized.content = normalized.line;
|
|
167
|
+
delete normalized.line;
|
|
168
|
+
}
|
|
169
|
+
return normalized;
|
|
170
|
+
}
|
|
171
|
+
function normalizeLegacyBranchEntry(entry, warn) {
|
|
172
|
+
if (!isRecord(entry)) {
|
|
173
|
+
return entry;
|
|
174
|
+
}
|
|
175
|
+
const normalized = {};
|
|
176
|
+
for (const [key, value] of Object.entries(entry)) {
|
|
177
|
+
if (key === "otherwise" && isRecord(value)) {
|
|
178
|
+
normalized.otherwise = normalizeLegacyRuntimeStep(value, warn);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
normalized[key] = value;
|
|
182
|
+
}
|
|
183
|
+
if (Object.hasOwn(normalized, "otherwise")) {
|
|
184
|
+
return normalized;
|
|
185
|
+
}
|
|
186
|
+
return normalizeLegacyRuntimeStep(entry, warn);
|
|
187
|
+
}
|
|
55
188
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/recipes/migrations/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAErD;;;GAGG;AACH,MAAM,QAAQ,GAAmC,CAAC,WAAW,CAAC,CAAC;AAS/D,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAA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;IAED,IACE,UAAU,CAAC,IAAI,KAAK,aAAa;QACjC,OAAO,UAAU,CAAC,OAAO,KAAK,QAAQ;QACtC,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,EACnC,CAAC;QACD,IAAI,EAAE,CACJ,kHAAkH,CACnH,CAAC;QACF,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC;QACrC,OAAO,UAAU,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,0BAA0B,CAAC,KAAc,EAAE,IAAa;IAC/D,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,UAAU,GAA4B,EAAE,CAAC;IAC/C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,GAAG,KAAK,WAAW,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,UAAU,CAAC,SAAS,GAAG,0BAA0B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC/D,SAAS;QACX,CAAC;QACD,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC;QAC3C,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,0BAA0B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/recipes/names.d.ts
CHANGED
|
@@ -21,6 +21,26 @@
|
|
|
21
21
|
* regex (which disagreed with the schema by also allowing `_`).
|
|
22
22
|
*/
|
|
23
23
|
export declare const RECIPE_NAME_RE: RegExp;
|
|
24
|
+
/**
|
|
25
|
+
* Strip a registry scope from a recipe name.
|
|
26
|
+
*
|
|
27
|
+
* Marketplace registry recipes carry a *scoped* name in their
|
|
28
|
+
* `recipe.json` (`@patchworkos/sprint-review-prep`) but the bridge
|
|
29
|
+
* stores recipes on disk under the bare, unscoped kebab slug. The
|
|
30
|
+
* recipe YAML `name:` should be the bare slug, but registry data
|
|
31
|
+
* historically shipped the scoped form there too — which fails the
|
|
32
|
+
* `RECIPE_NAME_RE` kebab check at install time.
|
|
33
|
+
*
|
|
34
|
+
* This normalizes either shape to the last `/`-delimited segment:
|
|
35
|
+
* - `@patchworkos/sprint-review-prep` → `sprint-review-prep`
|
|
36
|
+
* - `patchworkos/sprint-review-prep` → `sprint-review-prep`
|
|
37
|
+
* - `sprint-review-prep` → `sprint-review-prep` (unchanged)
|
|
38
|
+
*
|
|
39
|
+
* Only the `@scope/` prefix is forgiven — the resulting slug is still
|
|
40
|
+
* validated by `RECIPE_NAME_RE` downstream, so a genuinely-invalid
|
|
41
|
+
* name (`@bad/UPPER`, `../escape`, empty) still fails.
|
|
42
|
+
*/
|
|
43
|
+
export declare function stripRecipeScope(name: string): string;
|
|
24
44
|
/**
|
|
25
45
|
* Canonical variable-name regex (for `trigger.vars[].name` and
|
|
26
46
|
* `trigger.inputs[].name`). Mirrors the runtime template-reference
|
package/dist/recipes/names.js
CHANGED
|
@@ -21,6 +21,31 @@
|
|
|
21
21
|
* regex (which disagreed with the schema by also allowing `_`).
|
|
22
22
|
*/
|
|
23
23
|
export const RECIPE_NAME_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
24
|
+
/**
|
|
25
|
+
* Strip a registry scope from a recipe name.
|
|
26
|
+
*
|
|
27
|
+
* Marketplace registry recipes carry a *scoped* name in their
|
|
28
|
+
* `recipe.json` (`@patchworkos/sprint-review-prep`) but the bridge
|
|
29
|
+
* stores recipes on disk under the bare, unscoped kebab slug. The
|
|
30
|
+
* recipe YAML `name:` should be the bare slug, but registry data
|
|
31
|
+
* historically shipped the scoped form there too — which fails the
|
|
32
|
+
* `RECIPE_NAME_RE` kebab check at install time.
|
|
33
|
+
*
|
|
34
|
+
* This normalizes either shape to the last `/`-delimited segment:
|
|
35
|
+
* - `@patchworkos/sprint-review-prep` → `sprint-review-prep`
|
|
36
|
+
* - `patchworkos/sprint-review-prep` → `sprint-review-prep`
|
|
37
|
+
* - `sprint-review-prep` → `sprint-review-prep` (unchanged)
|
|
38
|
+
*
|
|
39
|
+
* Only the `@scope/` prefix is forgiven — the resulting slug is still
|
|
40
|
+
* validated by `RECIPE_NAME_RE` downstream, so a genuinely-invalid
|
|
41
|
+
* name (`@bad/UPPER`, `../escape`, empty) still fails.
|
|
42
|
+
*/
|
|
43
|
+
export function stripRecipeScope(name) {
|
|
44
|
+
if (typeof name !== "string" || !name.includes("/"))
|
|
45
|
+
return name;
|
|
46
|
+
const segments = name.split("/");
|
|
47
|
+
return segments[segments.length - 1] ?? name;
|
|
48
|
+
}
|
|
24
49
|
/**
|
|
25
50
|
* Canonical variable-name regex (for `trigger.vars[].name` and
|
|
26
51
|
* `trigger.inputs[].name`). Mirrors the runtime template-reference
|