patchwork-os 0.2.0-beta.9.canary.93 → 1.1.0-beta.1
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 +15 -16
- package/README.md +46 -458
- package/dist/activationMetrics.js +2 -3
- package/dist/activationMetrics.js.map +1 -1
- package/dist/activityLog.d.ts +1 -0
- package/dist/activityLog.js +8 -3
- package/dist/activityLog.js.map +1 -1
- package/dist/adapters/gemini.js +2 -2
- package/dist/adapters/gemini.js.map +1 -1
- package/dist/adapters/grok.js +6 -1
- package/dist/adapters/grok.js.map +1 -1
- package/dist/adapters/openai.js +4 -0
- package/dist/adapters/openai.js.map +1 -1
- package/dist/approvalHttp.d.ts +9 -0
- package/dist/approvalHttp.js +210 -171
- package/dist/approvalHttp.js.map +1 -1
- package/dist/approvalKpi.d.ts +102 -0
- package/dist/approvalKpi.js +282 -0
- package/dist/approvalKpi.js.map +1 -0
- package/dist/approvalQueue.d.ts +1 -1
- package/dist/approvalQueue.js.map +1 -1
- package/dist/automation.d.ts +45 -4
- package/dist/automation.js +123 -15
- package/dist/automation.js.map +1 -1
- package/dist/bridge.d.ts +10 -0
- package/dist/bridge.js +225 -46
- package/dist/bridge.js.map +1 -1
- package/dist/bridgeLockDiscovery.d.ts +16 -1
- package/dist/bridgeLockDiscovery.js +38 -4
- package/dist/bridgeLockDiscovery.js.map +1 -1
- package/dist/bridgeToolsRules.js +3 -18
- package/dist/bridgeToolsRules.js.map +1 -1
- package/dist/claudeAuthHttp.d.ts +25 -0
- package/dist/claudeAuthHttp.js +219 -0
- package/dist/claudeAuthHttp.js.map +1 -0
- package/dist/claudeDriver.js +4 -1
- package/dist/claudeDriver.js.map +1 -1
- package/dist/claudeOrchestrator.d.ts +15 -0
- package/dist/claudeOrchestrator.js +44 -0
- package/dist/claudeOrchestrator.js.map +1 -1
- package/dist/commands/connect.d.ts +47 -0
- package/dist/commands/connect.js +419 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/install.js +3 -10
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/launchd.d.ts +7 -0
- package/dist/commands/launchd.js +20 -2
- package/dist/commands/launchd.js.map +1 -1
- package/dist/commands/patchworkInit.d.ts +7 -0
- package/dist/commands/patchworkInit.js +26 -0
- package/dist/commands/patchworkInit.js.map +1 -1
- package/dist/commands/recipe.d.ts +59 -4
- package/dist/commands/recipe.js +206 -5
- package/dist/commands/recipe.js.map +1 -1
- package/dist/commands/recipeInstall.d.ts +9 -0
- package/dist/commands/recipeInstall.js +56 -3
- package/dist/commands/recipeInstall.js.map +1 -1
- package/dist/commands/task.d.ts +25 -0
- package/dist/commands/task.js +61 -41
- package/dist/commands/task.js.map +1 -1
- package/dist/commands/tokenEfficiency.d.ts +4 -0
- package/dist/commands/tokenEfficiency.js +23 -26
- package/dist/commands/tokenEfficiency.js.map +1 -1
- package/dist/commands/tracesExport.d.ts +15 -1
- package/dist/commands/tracesExport.js +39 -5
- package/dist/commands/tracesExport.js.map +1 -1
- package/dist/config.js +16 -0
- package/dist/config.js.map +1 -1
- package/dist/connectorRoutes.js +613 -62
- package/dist/connectorRoutes.js.map +1 -1
- package/dist/connectors/asana.js +9 -3
- package/dist/connectors/asana.js.map +1 -1
- package/dist/connectors/baseConnector.d.ts +16 -0
- package/dist/connectors/baseConnector.js +2 -0
- package/dist/connectors/baseConnector.js.map +1 -1
- package/dist/connectors/caldiy.js +34 -0
- package/dist/connectors/caldiy.js.map +1 -1
- package/dist/connectors/confluence.js +9 -2
- package/dist/connectors/confluence.js.map +1 -1
- package/dist/connectors/connectorActivity.d.ts +24 -0
- package/dist/connectors/connectorActivity.js +32 -0
- package/dist/connectors/connectorActivity.js.map +1 -0
- package/dist/connectors/connectorRedirectUri.js +22 -2
- package/dist/connectors/connectorRedirectUri.js.map +1 -1
- package/dist/connectors/connectorRegistry.d.ts +0 -3
- package/dist/connectors/connectorRegistry.js +8 -8
- package/dist/connectors/connectorRegistry.js.map +1 -1
- package/dist/connectors/datadog.js +8 -1
- package/dist/connectors/datadog.js.map +1 -1
- package/dist/connectors/discord.js +4 -3
- package/dist/connectors/discord.js.map +1 -1
- package/dist/connectors/elasticsearch.js +22 -0
- package/dist/connectors/elasticsearch.js.map +1 -1
- package/dist/connectors/github.d.ts +38 -0
- package/dist/connectors/github.js +91 -5
- package/dist/connectors/github.js.map +1 -1
- package/dist/connectors/gitlab.js +19 -16
- package/dist/connectors/gitlab.js.map +1 -1
- package/dist/connectors/gmail.d.ts +5 -0
- package/dist/connectors/gmail.js +53 -11
- package/dist/connectors/gmail.js.map +1 -1
- package/dist/connectors/googleCalendar.js +5 -4
- package/dist/connectors/googleCalendar.js.map +1 -1
- package/dist/connectors/googleDocs.js +7 -6
- package/dist/connectors/googleDocs.js.map +1 -1
- package/dist/connectors/googleDrive.js +15 -8
- package/dist/connectors/googleDrive.js.map +1 -1
- package/dist/connectors/grafana.js +39 -3
- package/dist/connectors/grafana.js.map +1 -1
- package/dist/connectors/jira.d.ts +1 -1
- package/dist/connectors/jira.js +19 -4
- package/dist/connectors/jira.js.map +1 -1
- package/dist/connectors/linear.js +2 -2
- package/dist/connectors/linear.js.map +1 -1
- package/dist/connectors/mcpClient.d.ts +29 -1
- package/dist/connectors/mcpClient.js +114 -44
- package/dist/connectors/mcpClient.js.map +1 -1
- package/dist/connectors/mcpOAuth.d.ts +1 -0
- package/dist/connectors/mcpOAuth.js +49 -4
- package/dist/connectors/mcpOAuth.js.map +1 -1
- package/dist/connectors/monday.js +5 -4
- package/dist/connectors/monday.js.map +1 -1
- package/dist/connectors/mongodb.js +32 -5
- package/dist/connectors/mongodb.js.map +1 -1
- package/dist/connectors/notion.d.ts +1 -1
- package/dist/connectors/notion.js +22 -6
- package/dist/connectors/notion.js.map +1 -1
- package/dist/connectors/oauthError.d.ts +17 -0
- package/dist/connectors/oauthError.js +50 -0
- package/dist/connectors/oauthError.js.map +1 -0
- package/dist/connectors/postgres.d.ts +7 -0
- package/dist/connectors/postgres.js +32 -2
- package/dist/connectors/postgres.js.map +1 -1
- package/dist/connectors/posthog.js +26 -0
- package/dist/connectors/posthog.js.map +1 -1
- package/dist/connectors/redis.d.ts +1 -0
- package/dist/connectors/redis.js +47 -20
- package/dist/connectors/redis.js.map +1 -1
- package/dist/connectors/salesforce.js +66 -5
- package/dist/connectors/salesforce.js.map +1 -1
- package/dist/connectors/sentry.js +2 -2
- package/dist/connectors/sentry.js.map +1 -1
- package/dist/connectors/slack.js +37 -14
- package/dist/connectors/slack.js.map +1 -1
- package/dist/connectors/snowflake.js +24 -0
- package/dist/connectors/snowflake.js.map +1 -1
- package/dist/connectors/stripe.js +9 -2
- package/dist/connectors/stripe.js.map +1 -1
- package/dist/connectors/supabase.js +34 -0
- package/dist/connectors/supabase.js.map +1 -1
- package/dist/connectors/tokenStorage.d.ts +20 -0
- package/dist/connectors/tokenStorage.js +196 -64
- package/dist/connectors/tokenStorage.js.map +1 -1
- package/dist/connectors/woocommerce.js +34 -0
- package/dist/connectors/woocommerce.js.map +1 -1
- package/dist/copilot/parseIntent.d.ts +58 -0
- package/dist/copilot/parseIntent.js +149 -0
- package/dist/copilot/parseIntent.js.map +1 -0
- package/dist/decisionReplay.d.ts +8 -6
- package/dist/decisionReplay.js +35 -11
- package/dist/decisionReplay.js.map +1 -1
- package/dist/decisionTraceLog.d.ts +9 -0
- package/dist/decisionTraceLog.js +6 -0
- package/dist/decisionTraceLog.js.map +1 -1
- package/dist/drivers/claude/api.js +49 -7
- package/dist/drivers/claude/api.js.map +1 -1
- package/dist/drivers/claude/envSanitizer.d.ts +9 -1
- package/dist/drivers/claude/envSanitizer.js +41 -3
- package/dist/drivers/claude/envSanitizer.js.map +1 -1
- package/dist/drivers/claude/streamParser.d.ts +13 -0
- package/dist/drivers/claude/streamParser.js.map +1 -1
- package/dist/drivers/claude/subprocess.js +131 -16
- package/dist/drivers/claude/subprocess.js.map +1 -1
- package/dist/drivers/claude/subprocessSettings.d.ts +1 -1
- package/dist/drivers/claude/subprocessSettings.js +18 -4
- package/dist/drivers/claude/subprocessSettings.js.map +1 -1
- package/dist/drivers/gemini/index.d.ts +13 -0
- package/dist/drivers/gemini/index.js +211 -67
- package/dist/drivers/gemini/index.js.map +1 -1
- package/dist/drivers/local/index.d.ts +2 -17
- package/dist/drivers/local/index.js +5 -92
- package/dist/drivers/local/index.js.map +1 -1
- package/dist/drivers/openai/index.js +69 -9
- package/dist/drivers/openai/index.js.map +1 -1
- package/dist/drivers/outputCap.d.ts +27 -0
- package/dist/drivers/outputCap.js +50 -0
- package/dist/drivers/outputCap.js.map +1 -0
- package/dist/embeddings/cosine.d.ts +23 -0
- package/dist/embeddings/cosine.js +59 -0
- package/dist/embeddings/cosine.js.map +1 -0
- package/dist/embeddings/index.d.ts +19 -0
- package/dist/embeddings/index.js +35 -0
- package/dist/embeddings/index.js.map +1 -0
- package/dist/embeddings/localEmbeddings.d.ts +29 -0
- package/dist/embeddings/localEmbeddings.js +103 -0
- package/dist/embeddings/localEmbeddings.js.map +1 -0
- package/dist/embeddings/localEndpoints.d.ts +24 -0
- package/dist/embeddings/localEndpoints.js +37 -0
- package/dist/embeddings/localEndpoints.js.map +1 -0
- package/dist/embeddings/types.d.ts +32 -0
- package/dist/embeddings/types.js +12 -0
- package/dist/embeddings/types.js.map +1 -0
- package/dist/featureFlags.d.ts +18 -0
- package/dist/featureFlags.js +32 -0
- package/dist/featureFlags.js.map +1 -1
- package/dist/fp/automationInterpreter.js +118 -39
- package/dist/fp/automationInterpreter.js.map +1 -1
- package/dist/fp/automationProgram.d.ts +10 -0
- package/dist/fp/automationProgram.js.map +1 -1
- package/dist/fp/automationState.d.ts +6 -0
- package/dist/fp/automationState.js +38 -0
- package/dist/fp/automationState.js.map +1 -1
- package/dist/fp/commandDescription.d.ts +6 -0
- package/dist/fp/commandDescription.js +18 -5
- package/dist/fp/commandDescription.js.map +1 -1
- package/dist/fp/interpreterContext.d.ts +16 -5
- package/dist/fp/interpreterContext.js +59 -3
- package/dist/fp/interpreterContext.js.map +1 -1
- package/dist/fp/policyParser.js +18 -8
- package/dist/fp/policyParser.js.map +1 -1
- package/dist/haltPushDispatch.d.ts +4 -0
- package/dist/haltPushDispatch.js +7 -22
- package/dist/haltPushDispatch.js.map +1 -1
- package/dist/inboxRoutes.js +2 -2
- package/dist/inboxRoutes.js.map +1 -1
- package/dist/index.js +672 -135
- package/dist/index.js.map +1 -1
- package/dist/installGuard.js +6 -0
- package/dist/installGuard.js.map +1 -1
- package/dist/localEndpointGuard.d.ts +25 -0
- package/dist/localEndpointGuard.js +101 -0
- package/dist/localEndpointGuard.js.map +1 -0
- package/dist/mcpRoutes.js +1 -1
- package/dist/mcpRoutes.js.map +1 -1
- package/dist/oauth.d.ts +13 -0
- package/dist/oauth.js +53 -9
- package/dist/oauth.js.map +1 -1
- package/dist/orchestrator/childBridgeClient.d.ts +7 -0
- package/dist/orchestrator/childBridgeClient.js +42 -1
- package/dist/orchestrator/childBridgeClient.js.map +1 -1
- package/dist/orchestrator/orchestratorBridge.d.ts +33 -0
- package/dist/orchestrator/orchestratorBridge.js +75 -9
- package/dist/orchestrator/orchestratorBridge.js.map +1 -1
- package/dist/patchworkConfig.d.ts +4 -0
- package/dist/patchworkConfig.js +33 -4
- package/dist/patchworkConfig.js.map +1 -1
- package/dist/probe.js +39 -5
- package/dist/probe.js.map +1 -1
- package/dist/recipeOrchestration.d.ts +59 -0
- package/dist/recipeOrchestration.js +314 -60
- package/dist/recipeOrchestration.js.map +1 -1
- package/dist/recipeRoutes.d.ts +93 -0
- package/dist/recipeRoutes.js +664 -27
- package/dist/recipeRoutes.js.map +1 -1
- package/dist/recipes/RecipeOrchestrator.d.ts +14 -0
- package/dist/recipes/RecipeOrchestrator.js +42 -2
- package/dist/recipes/RecipeOrchestrator.js.map +1 -1
- package/dist/recipes/agentExecutor.d.ts +51 -2
- package/dist/recipes/agentExecutor.js +86 -13
- package/dist/recipes/agentExecutor.js.map +1 -1
- package/dist/recipes/chainedRunner.d.ts +111 -3
- package/dist/recipes/chainedRunner.js +440 -45
- package/dist/recipes/chainedRunner.js.map +1 -1
- package/dist/recipes/compiler.js +42 -29
- package/dist/recipes/compiler.js.map +1 -1
- package/dist/recipes/connectorPreflight.js +31 -0
- package/dist/recipes/connectorPreflight.js.map +1 -1
- package/dist/recipes/dependencyGraph.d.ts +16 -0
- package/dist/recipes/dependencyGraph.js +37 -2
- package/dist/recipes/dependencyGraph.js.map +1 -1
- package/dist/recipes/eventTriggerPrograms.d.ts +36 -0
- package/dist/recipes/eventTriggerPrograms.js +158 -0
- package/dist/recipes/eventTriggerPrograms.js.map +1 -0
- package/dist/recipes/githubInstallSource.d.ts +9 -2
- package/dist/recipes/githubInstallSource.js +36 -6
- package/dist/recipes/githubInstallSource.js.map +1 -1
- package/dist/recipes/haltCategory.d.ts +10 -0
- package/dist/recipes/haltCategory.js +11 -1
- package/dist/recipes/haltCategory.js.map +1 -1
- package/dist/recipes/idempotencyKey.d.ts +30 -3
- package/dist/recipes/idempotencyKey.js +89 -5
- package/dist/recipes/idempotencyKey.js.map +1 -1
- package/dist/recipes/installer.js +12 -35
- package/dist/recipes/installer.js.map +1 -1
- package/dist/recipes/judgeVerdict.d.ts +11 -1
- package/dist/recipes/judgeVerdict.js +47 -7
- package/dist/recipes/judgeVerdict.js.map +1 -1
- package/dist/recipes/names.d.ts +5 -0
- package/dist/recipes/names.js +10 -5
- package/dist/recipes/names.js.map +1 -1
- package/dist/recipes/parser.js +74 -10
- package/dist/recipes/parser.js.map +1 -1
- package/dist/recipes/pricing/costRouter.d.ts +43 -0
- package/dist/recipes/pricing/costRouter.js +44 -0
- package/dist/recipes/pricing/costRouter.js.map +1 -0
- package/dist/recipes/pricing/priceTable.d.ts +76 -0
- package/dist/recipes/pricing/priceTable.js +144 -0
- package/dist/recipes/pricing/priceTable.js.map +1 -0
- package/dist/recipes/replayRun.js +5 -2
- package/dist/recipes/replayRun.js.map +1 -1
- package/dist/recipes/resolveRecipePath.js +15 -1
- package/dist/recipes/resolveRecipePath.js.map +1 -1
- package/dist/recipes/runBudget.d.ts +93 -32
- package/dist/recipes/runBudget.js +213 -49
- package/dist/recipes/runBudget.js.map +1 -1
- package/dist/recipes/runRegistry.d.ts +32 -0
- package/dist/recipes/runRegistry.js +54 -0
- package/dist/recipes/runRegistry.js.map +1 -0
- package/dist/recipes/scheduler.js +6 -2
- package/dist/recipes/scheduler.js.map +1 -1
- package/dist/recipes/schema.d.ts +59 -6
- package/dist/recipes/schemaGenerator.d.ts +9 -0
- package/dist/recipes/schemaGenerator.js +446 -77
- package/dist/recipes/schemaGenerator.js.map +1 -1
- package/dist/recipes/simulation/aggregateRunRisk.d.ts +46 -0
- package/dist/recipes/simulation/aggregateRunRisk.js +120 -0
- package/dist/recipes/simulation/aggregateRunRisk.js.map +1 -0
- package/dist/recipes/simulation/costProjector.d.ts +32 -0
- package/dist/recipes/simulation/costProjector.js +194 -0
- package/dist/recipes/simulation/costProjector.js.map +1 -0
- package/dist/recipes/simulation/sideEffects.d.ts +32 -0
- package/dist/recipes/simulation/sideEffects.js +62 -0
- package/dist/recipes/simulation/sideEffects.js.map +1 -0
- package/dist/recipes/simulation/simulate.d.ts +36 -0
- package/dist/recipes/simulation/simulate.js +264 -0
- package/dist/recipes/simulation/simulate.js.map +1 -0
- package/dist/recipes/simulation/simulateMockedRun.d.ts +52 -0
- package/dist/recipes/simulation/simulateMockedRun.js +84 -0
- package/dist/recipes/simulation/simulateMockedRun.js.map +1 -0
- package/dist/recipes/simulation/synthesizeMockedOutputs.d.ts +31 -0
- package/dist/recipes/simulation/synthesizeMockedOutputs.js +50 -0
- package/dist/recipes/simulation/synthesizeMockedOutputs.js.map +1 -0
- package/dist/recipes/simulation/types.d.ts +198 -0
- package/dist/recipes/simulation/types.js +30 -0
- package/dist/recipes/simulation/types.js.map +1 -0
- package/dist/recipes/stepObservation.d.ts +12 -0
- package/dist/recipes/stepObservation.js +21 -1
- package/dist/recipes/stepObservation.js.map +1 -1
- package/dist/recipes/toolRegistry.js +61 -24
- package/dist/recipes/toolRegistry.js.map +1 -1
- package/dist/recipes/tools/airtable.d.ts +15 -0
- package/dist/recipes/tools/airtable.js +240 -0
- package/dist/recipes/tools/airtable.js.map +1 -0
- package/dist/recipes/tools/caldiy.d.ts +13 -0
- package/dist/recipes/tools/caldiy.js +215 -0
- package/dist/recipes/tools/caldiy.js.map +1 -0
- package/dist/recipes/tools/circleci.d.ts +10 -0
- package/dist/recipes/tools/circleci.js +204 -0
- package/dist/recipes/tools/circleci.js.map +1 -0
- package/dist/recipes/tools/cloudflare.d.ts +13 -0
- package/dist/recipes/tools/cloudflare.js +211 -0
- package/dist/recipes/tools/cloudflare.js.map +1 -0
- package/dist/recipes/tools/confluence.js +11 -10
- package/dist/recipes/tools/confluence.js.map +1 -1
- package/dist/recipes/tools/datadog.js +13 -12
- package/dist/recipes/tools/datadog.js.map +1 -1
- package/dist/recipes/tools/docs.d.ts +18 -0
- package/dist/recipes/tools/docs.js +95 -0
- package/dist/recipes/tools/docs.js.map +1 -0
- package/dist/recipes/tools/elasticsearch.d.ts +11 -0
- package/dist/recipes/tools/elasticsearch.js +157 -0
- package/dist/recipes/tools/elasticsearch.js.map +1 -0
- package/dist/recipes/tools/fanOut.js +4 -4
- package/dist/recipes/tools/fanOut.js.map +1 -1
- package/dist/recipes/tools/figma.d.ts +12 -0
- package/dist/recipes/tools/figma.js +195 -0
- package/dist/recipes/tools/figma.js.map +1 -0
- package/dist/recipes/tools/file.js +43 -22
- package/dist/recipes/tools/file.js.map +1 -1
- package/dist/recipes/tools/github.js +162 -5
- package/dist/recipes/tools/github.js.map +1 -1
- package/dist/recipes/tools/gmail.js +45 -33
- package/dist/recipes/tools/gmail.js.map +1 -1
- package/dist/recipes/tools/grafana.d.ts +11 -0
- package/dist/recipes/tools/grafana.js +216 -0
- package/dist/recipes/tools/grafana.js.map +1 -0
- package/dist/recipes/tools/http.d.ts +1 -1
- package/dist/recipes/tools/http.js +10 -28
- package/dist/recipes/tools/http.js.map +1 -1
- package/dist/recipes/tools/hubspot.js +13 -12
- package/dist/recipes/tools/hubspot.js.map +1 -1
- package/dist/recipes/tools/index.d.ts +28 -0
- package/dist/recipes/tools/index.js +28 -0
- package/dist/recipes/tools/index.js.map +1 -1
- package/dist/recipes/tools/intercom.js +11 -10
- package/dist/recipes/tools/intercom.js.map +1 -1
- package/dist/recipes/tools/jira.js +13 -0
- package/dist/recipes/tools/jira.js.map +1 -1
- package/dist/recipes/tools/meetingNotes.js +2 -2
- package/dist/recipes/tools/monday.d.ts +22 -0
- package/dist/recipes/tools/monday.js +242 -0
- package/dist/recipes/tools/monday.js.map +1 -0
- package/dist/recipes/tools/mongodb.d.ts +19 -0
- package/dist/recipes/tools/mongodb.js +194 -0
- package/dist/recipes/tools/mongodb.js.map +1 -0
- package/dist/recipes/tools/notion.js +11 -10
- package/dist/recipes/tools/notion.js.map +1 -1
- package/dist/recipes/tools/obsidian.d.ts +15 -0
- package/dist/recipes/tools/obsidian.js +173 -0
- package/dist/recipes/tools/obsidian.js.map +1 -0
- package/dist/recipes/tools/outcomes.d.ts +15 -0
- package/dist/recipes/tools/outcomes.js +111 -0
- package/dist/recipes/tools/outcomes.js.map +1 -0
- package/dist/recipes/tools/paystack.d.ts +11 -0
- package/dist/recipes/tools/paystack.js +212 -0
- package/dist/recipes/tools/paystack.js.map +1 -0
- package/dist/recipes/tools/pipedrive.d.ts +16 -0
- package/dist/recipes/tools/pipedrive.js +234 -0
- package/dist/recipes/tools/pipedrive.js.map +1 -0
- package/dist/recipes/tools/postgres.d.ts +15 -0
- package/dist/recipes/tools/postgres.js +186 -0
- package/dist/recipes/tools/postgres.js.map +1 -0
- package/dist/recipes/tools/posthog.d.ts +16 -0
- package/dist/recipes/tools/posthog.js +219 -0
- package/dist/recipes/tools/posthog.js.map +1 -0
- package/dist/recipes/tools/redis.d.ts +9 -0
- package/dist/recipes/tools/redis.js +141 -0
- package/dist/recipes/tools/redis.js.map +1 -0
- package/dist/recipes/tools/resend.d.ts +8 -0
- package/dist/recipes/tools/resend.js +153 -0
- package/dist/recipes/tools/resend.js.map +1 -0
- package/dist/recipes/tools/salesforce.d.ts +16 -0
- package/dist/recipes/tools/salesforce.js +184 -0
- package/dist/recipes/tools/salesforce.js.map +1 -0
- package/dist/recipes/tools/sendgrid.d.ts +9 -0
- package/dist/recipes/tools/sendgrid.js +175 -0
- package/dist/recipes/tools/sendgrid.js.map +1 -0
- package/dist/recipes/tools/shopify.d.ts +16 -0
- package/dist/recipes/tools/shopify.js +266 -0
- package/dist/recipes/tools/shopify.js.map +1 -0
- package/dist/recipes/tools/snowflake.d.ts +16 -0
- package/dist/recipes/tools/snowflake.js +173 -0
- package/dist/recipes/tools/snowflake.js.map +1 -0
- package/dist/recipes/tools/stripe.js +13 -12
- package/dist/recipes/tools/stripe.js.map +1 -1
- package/dist/recipes/tools/supabase.d.ts +9 -0
- package/dist/recipes/tools/supabase.js +133 -0
- package/dist/recipes/tools/supabase.js.map +1 -0
- package/dist/recipes/tools/todoist.d.ts +15 -0
- package/dist/recipes/tools/todoist.js +228 -0
- package/dist/recipes/tools/todoist.js.map +1 -0
- package/dist/recipes/tools/twilio.d.ts +11 -0
- package/dist/recipes/tools/twilio.js +180 -0
- package/dist/recipes/tools/twilio.js.map +1 -0
- package/dist/recipes/tools/vercel.d.ts +9 -0
- package/dist/recipes/tools/vercel.js +146 -0
- package/dist/recipes/tools/vercel.js.map +1 -0
- package/dist/recipes/tools/webflow.d.ts +11 -0
- package/dist/recipes/tools/webflow.js +244 -0
- package/dist/recipes/tools/webflow.js.map +1 -0
- package/dist/recipes/tools/woocommerce.d.ts +18 -0
- package/dist/recipes/tools/woocommerce.js +260 -0
- package/dist/recipes/tools/woocommerce.js.map +1 -0
- package/dist/recipes/tools/wrapConnectorExecute.d.ts +25 -0
- package/dist/recipes/tools/wrapConnectorExecute.js +37 -0
- package/dist/recipes/tools/wrapConnectorExecute.js.map +1 -0
- package/dist/recipes/tools/zendesk.js +11 -10
- package/dist/recipes/tools/zendesk.js.map +1 -1
- package/dist/recipes/triggerVars.d.ts +15 -0
- package/dist/recipes/triggerVars.js +57 -0
- package/dist/recipes/triggerVars.js.map +1 -0
- package/dist/recipes/validation.d.ts +1 -1
- package/dist/recipes/validation.js +536 -12
- package/dist/recipes/validation.js.map +1 -1
- package/dist/recipes/yamlPositions.d.ts +1 -1
- package/dist/recipes/yamlPositions.js +7 -2
- package/dist/recipes/yamlPositions.js.map +1 -1
- package/dist/recipes/yamlRunner.d.ts +216 -4
- package/dist/recipes/yamlRunner.js +1030 -96
- package/dist/recipes/yamlRunner.js.map +1 -1
- package/dist/recipesHttp.d.ts +5 -0
- package/dist/recipesHttp.js +68 -6
- package/dist/recipesHttp.js.map +1 -1
- package/dist/resources.js +14 -1
- package/dist/resources.js.map +1 -1
- package/dist/riskSignals.d.ts +42 -0
- package/dist/riskSignals.js +197 -0
- package/dist/riskSignals.js.map +1 -0
- package/dist/riskTier.d.ts +9 -0
- package/dist/riskTier.js +48 -0
- package/dist/riskTier.js.map +1 -1
- package/dist/runLog.d.ts +53 -0
- package/dist/runLog.js +75 -16
- package/dist/runLog.js.map +1 -1
- package/dist/schemas/recipe.v1.json +360 -16
- package/dist/server.d.ts +60 -0
- package/dist/server.js +192 -31
- package/dist/server.js.map +1 -1
- package/dist/sessionCheckpoint.js +4 -1
- package/dist/sessionCheckpoint.js.map +1 -1
- package/dist/sessionDetail.d.ts +43 -0
- package/dist/sessionDetail.js +59 -0
- package/dist/sessionDetail.js.map +1 -0
- package/dist/settingsEnv.d.ts +47 -0
- package/dist/settingsEnv.js +88 -0
- package/dist/settingsEnv.js.map +1 -0
- package/dist/streamableHttp.js +44 -10
- package/dist/streamableHttp.js.map +1 -1
- package/dist/ta/backtest/abnday.d.ts +53 -0
- package/dist/ta/backtest/abnday.js +123 -0
- package/dist/ta/backtest/abnday.js.map +1 -0
- package/dist/ta/backtest/directional.d.ts +48 -0
- package/dist/ta/backtest/directional.js +103 -0
- package/dist/ta/backtest/directional.js.map +1 -0
- package/dist/ta/backtest/fundx.d.ts +67 -0
- package/dist/ta/backtest/fundx.js +264 -0
- package/dist/ta/backtest/fundx.js.map +1 -0
- package/dist/ta/backtest/fvg.d.ts +62 -0
- package/dist/ta/backtest/fvg.js +236 -0
- package/dist/ta/backtest/fvg.js.map +1 -0
- package/dist/ta/backtest/ichimoku.d.ts +41 -0
- package/dist/ta/backtest/ichimoku.js +146 -0
- package/dist/ta/backtest/ichimoku.js.map +1 -0
- package/dist/ta/backtest/ingest.d.ts +20 -0
- package/dist/ta/backtest/ingest.js +104 -0
- package/dist/ta/backtest/ingest.js.map +1 -0
- package/dist/ta/backtest/msb.d.ts +49 -0
- package/dist/ta/backtest/msb.js +162 -0
- package/dist/ta/backtest/msb.js.map +1 -0
- package/dist/ta/backtest/scoring.d.ts +33 -0
- package/dist/ta/backtest/scoring.js +82 -0
- package/dist/ta/backtest/scoring.js.map +1 -0
- package/dist/ta/backtest/summary.d.ts +20 -0
- package/dist/ta/backtest/summary.js +42 -0
- package/dist/ta/backtest/summary.js.map +1 -0
- package/dist/ta/backtest/tsmom.d.ts +72 -0
- package/dist/ta/backtest/tsmom.js +202 -0
- package/dist/ta/backtest/tsmom.js.map +1 -0
- package/dist/ta/backtest/volsq.d.ts +34 -0
- package/dist/ta/backtest/volsq.js +154 -0
- package/dist/ta/backtest/volsq.js.map +1 -0
- package/dist/ta/backtest/walkForward.d.ts +45 -0
- package/dist/ta/backtest/walkForward.js +136 -0
- package/dist/ta/backtest/walkForward.js.map +1 -0
- package/dist/ta/cycles.d.ts +15 -0
- package/dist/ta/cycles.js +31 -0
- package/dist/ta/cycles.js.map +1 -0
- package/dist/ta/desk/accrualEmitter.d.ts +59 -0
- package/dist/ta/desk/accrualEmitter.js +136 -0
- package/dist/ta/desk/accrualEmitter.js.map +1 -0
- package/dist/ta/desk/cellBacktest.d.ts +179 -0
- package/dist/ta/desk/cellBacktest.js +514 -0
- package/dist/ta/desk/cellBacktest.js.map +1 -0
- package/dist/ta/desk/cells/wpMaRejection.d.ts +49 -0
- package/dist/ta/desk/cells/wpMaRejection.js +141 -0
- package/dist/ta/desk/cells/wpMaRejection.js.map +1 -0
- package/dist/ta/desk/cells/wpVolumeClimax.d.ts +57 -0
- package/dist/ta/desk/cells/wpVolumeClimax.js +193 -0
- package/dist/ta/desk/cells/wpVolumeClimax.js.map +1 -0
- package/dist/ta/desk/collectors.d.ts +18 -0
- package/dist/ta/desk/collectors.js +450 -0
- package/dist/ta/desk/collectors.js.map +1 -0
- package/dist/ta/desk/contract.d.ts +51 -0
- package/dist/ta/desk/contract.js +261 -0
- package/dist/ta/desk/contract.js.map +1 -0
- package/dist/ta/desk/deskLedger.d.ts +36 -0
- package/dist/ta/desk/deskLedger.js +239 -0
- package/dist/ta/desk/deskLedger.js.map +1 -0
- package/dist/ta/desk/liqTape.d.ts +37 -0
- package/dist/ta/desk/liqTape.js +99 -0
- package/dist/ta/desk/liqTape.js.map +1 -0
- package/dist/ta/desk/post.d.ts +20 -0
- package/dist/ta/desk/post.js +65 -0
- package/dist/ta/desk/post.js.map +1 -0
- package/dist/ta/desk/render.d.ts +25 -0
- package/dist/ta/desk/render.js +398 -0
- package/dist/ta/desk/render.js.map +1 -0
- package/dist/ta/desk/surfaces.d.ts +216 -0
- package/dist/ta/desk/surfaces.js +472 -0
- package/dist/ta/desk/surfaces.js.map +1 -0
- package/dist/ta/desk/types.d.ts +174 -0
- package/dist/ta/desk/types.js +104 -0
- package/dist/ta/desk/types.js.map +1 -0
- package/dist/ta/index.d.ts +23 -0
- package/dist/ta/index.js +54 -0
- package/dist/ta/index.js.map +1 -0
- package/dist/ta/ledger.d.ts +44 -0
- package/dist/ta/ledger.js +95 -0
- package/dist/ta/ledger.js.map +1 -0
- package/dist/ta/levels.d.ts +21 -0
- package/dist/ta/levels.js +41 -0
- package/dist/ta/levels.js.map +1 -0
- package/dist/ta/swings.d.ts +30 -0
- package/dist/ta/swings.js +83 -0
- package/dist/ta/swings.js.map +1 -0
- package/dist/ta/types.d.ts +81 -0
- package/dist/ta/types.js +20 -0
- package/dist/ta/types.js.map +1 -0
- package/dist/telemetry.js +20 -9
- package/dist/telemetry.js.map +1 -1
- package/dist/tokenUsageTracker.d.ts +2 -1
- package/dist/tokenUsageTracker.js +38 -20
- package/dist/tokenUsageTracker.js.map +1 -1
- package/dist/tools/contextBundle.js +13 -9
- package/dist/tools/contextBundle.js.map +1 -1
- package/dist/tools/ctxGetTaskContext.js +8 -3
- package/dist/tools/ctxGetTaskContext.js.map +1 -1
- package/dist/tools/ctxQueryTraces.d.ts +18 -1
- package/dist/tools/ctxQueryTraces.js +176 -27
- package/dist/tools/ctxQueryTraces.js.map +1 -1
- package/dist/tools/enrichCommit.js +5 -2
- package/dist/tools/enrichCommit.js.map +1 -1
- package/dist/tools/getDependencyTree.js +2 -2
- package/dist/tools/getDependencyTree.js.map +1 -1
- package/dist/tools/getDiagnostics.js +3 -0
- package/dist/tools/getDiagnostics.js.map +1 -1
- package/dist/tools/getDocumentSymbols.js +5 -1
- package/dist/tools/getDocumentSymbols.js.map +1 -1
- package/dist/tools/getGitHotspots.js +12 -1
- package/dist/tools/getGitHotspots.js.map +1 -1
- package/dist/tools/getGitLog.js +5 -2
- package/dist/tools/getGitLog.js.map +1 -1
- package/dist/tools/getGitStatus.js +6 -1
- package/dist/tools/getGitStatus.js.map +1 -1
- package/dist/tools/getProjectContext.js +3 -1
- package/dist/tools/getProjectContext.js.map +1 -1
- package/dist/tools/getToolCapabilities.js +39 -4
- package/dist/tools/getToolCapabilities.js.map +1 -1
- package/dist/tools/gitWrite.js +12 -3
- package/dist/tools/gitWrite.js.map +1 -1
- package/dist/tools/github/composite.d.ts +1 -1
- package/dist/tools/github/composite.js +7 -7
- package/dist/tools/github/composite.js.map +1 -1
- package/dist/tools/github/pr.d.ts +6 -6
- package/dist/tools/github/pr.js +18 -11
- package/dist/tools/github/pr.js.map +1 -1
- package/dist/tools/httpClient.js +55 -3
- package/dist/tools/httpClient.js.map +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +19 -12
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/lsp.d.ts +6 -0
- package/dist/tools/lsp.js +81 -12
- package/dist/tools/lsp.js.map +1 -1
- package/dist/tools/previewEdit.js +16 -1
- package/dist/tools/previewEdit.js.map +1 -1
- package/dist/tools/resumeClaudeTask.js +17 -0
- package/dist/tools/resumeClaudeTask.js.map +1 -1
- package/dist/tools/searchAndReplace.js +9 -5
- package/dist/tools/searchAndReplace.js.map +1 -1
- package/dist/tools/searchTools.d.ts +26 -0
- package/dist/tools/searchTools.js +42 -2
- package/dist/tools/searchTools.js.map +1 -1
- package/dist/tools/terminal.js +23 -51
- package/dist/tools/terminal.js.map +1 -1
- package/dist/tools/transaction.d.ts +9 -1
- package/dist/tools/transaction.js +59 -4
- package/dist/tools/transaction.js.map +1 -1
- package/dist/tools/utils.d.ts +16 -0
- package/dist/tools/utils.js +77 -7
- package/dist/tools/utils.js.map +1 -1
- package/dist/transport.d.ts +31 -0
- package/dist/transport.js +117 -14
- package/dist/transport.js.map +1 -1
- package/dist/wireHaltPushDispatch.js +12 -0
- package/dist/wireHaltPushDispatch.js.map +1 -1
- package/dist/workerGateDecisionLog.d.ts +141 -0
- package/dist/workerGateDecisionLog.js +361 -0
- package/dist/workerGateDecisionLog.js.map +1 -0
- package/dist/workers/actionClass.d.ts +38 -0
- package/dist/workers/actionClass.js +155 -0
- package/dist/workers/actionClass.js.map +1 -0
- package/dist/workers/backtest.d.ts +68 -0
- package/dist/workers/backtest.js +113 -0
- package/dist/workers/backtest.js.map +1 -0
- package/dist/workers/contextRisk.d.ts +35 -0
- package/dist/workers/contextRisk.js +20 -0
- package/dist/workers/contextRisk.js.map +1 -0
- package/dist/workers/contextRiskScorer.d.ts +48 -0
- package/dist/workers/contextRiskScorer.js +94 -0
- package/dist/workers/contextRiskScorer.js.map +1 -0
- package/dist/workers/graduation.d.ts +61 -0
- package/dist/workers/graduation.js +112 -0
- package/dist/workers/graduation.js.map +1 -0
- package/dist/workers/outcomeStore.d.ts +98 -0
- package/dist/workers/outcomeStore.js +146 -0
- package/dist/workers/outcomeStore.js.map +1 -0
- package/dist/workers/outcomesCli.d.ts +34 -0
- package/dist/workers/outcomesCli.js +91 -0
- package/dist/workers/outcomesCli.js.map +1 -0
- package/dist/workers/runWorkerShadow.d.ts +90 -0
- package/dist/workers/runWorkerShadow.js +323 -0
- package/dist/workers/runWorkerShadow.js.map +1 -0
- package/dist/workers/shadowGate.d.ts +30 -0
- package/dist/workers/shadowGate.js +58 -0
- package/dist/workers/shadowGate.js.map +1 -0
- package/dist/workers/shadowObserver.d.ts +165 -0
- package/dist/workers/shadowObserver.js +203 -0
- package/dist/workers/shadowObserver.js.map +1 -0
- package/dist/workers/shadowReport.d.ts +16 -0
- package/dist/workers/shadowReport.js +61 -0
- package/dist/workers/shadowReport.js.map +1 -0
- package/dist/workers/shadowRun.d.ts +38 -0
- package/dist/workers/shadowRun.js +44 -0
- package/dist/workers/shadowRun.js.map +1 -0
- package/dist/workers/trustLevel.d.ts +82 -0
- package/dist/workers/trustLevel.js +100 -0
- package/dist/workers/trustLevel.js.map +1 -0
- package/dist/workers/worker.d.ts +49 -0
- package/dist/workers/worker.js +88 -0
- package/dist/workers/worker.js.map +1 -0
- package/dist/workers/workerGate.d.ts +101 -0
- package/dist/workers/workerGate.js +210 -0
- package/dist/workers/workerGate.js.map +1 -0
- package/dist/workers/workerLevelStore.d.ts +33 -0
- package/dist/workers/workerLevelStore.js +87 -0
- package/dist/workers/workerLevelStore.js.map +1 -0
- package/dist/workers/workerLoader.d.ts +7 -0
- package/dist/workers/workerLoader.js +31 -0
- package/dist/workers/workerLoader.js.map +1 -0
- package/dist/writeFileAtomic.js +40 -13
- package/dist/writeFileAtomic.js.map +1 -1
- package/package.json +14 -6
- package/scripts/mcp-stdio-shim.cjs +247 -87
- package/templates/CLAUDE.bridge.md +1 -1
- package/templates/recipes/dependency-bump.yaml +33 -0
- package/templates/recipes/incident-to-pr.yaml +187 -0
- package/templates/recipes/outcome-ingester.yaml +53 -0
- package/templates/recipes/release-notes.yaml +30 -0
- package/templates/recipes/triage-failing-tests-autofile.yaml +152 -0
- package/templates/recipes/triage-failing-tests.yaml +38 -0
- package/templates/workers/dependency-upkeep.worker.yaml +26 -0
- package/templates/workers/release-notes.worker.yaml +17 -0
- package/templates/workers/test-guardian.worker.yaml +24 -0
- package/deploy/README.md +0 -172
- package/deploy/bootstrap-new-vps.sh +0 -364
- package/deploy/bootstrap-vps.sh +0 -192
- package/deploy/claude-ide-bridge.service.template +0 -67
- package/deploy/claude-ide-bridge@.service +0 -31
- package/deploy/deploy-dashboard.sh +0 -198
- package/deploy/deploy-landing.sh +0 -136
- package/deploy/ecosystem.config.js.example +0 -36
- package/deploy/install-vps-service.sh +0 -240
- package/deploy/macos/README.md +0 -153
- package/deploy/macos/com.patchwork.bridge.plist.template +0 -54
- package/deploy/macos/com.patchwork.tunnel.plist.template +0 -76
- package/deploy/macos/install-mac-bridge.sh +0 -244
- package/deploy/macos/uninstall-mac-bridge.sh +0 -22
- package/deploy/nginx-claude-bridge.conf.template +0 -129
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { classifyActionClass, outcomeWeight, reachableLevels, } from "./actionClass.js";
|
|
2
|
+
import { applyOutcome, levelFromPosterior, } from "./trustLevel.js";
|
|
3
|
+
/** Default novel-class floor — MUST match levelFromPosterior's internal `?? 10`
|
|
4
|
+
* so a config that omits the field behaves identically through both paths. */
|
|
5
|
+
const DEFAULT_MIN_EVIDENCE = 10;
|
|
6
|
+
export const DEFAULT_GRADUATION_CONFIG = {
|
|
7
|
+
dwellMs: 6 * 60 * 60 * 1000, // 6h between climbs
|
|
8
|
+
demoteCooldownMs: 24 * 60 * 60 * 1000, // 24h freeze after a fall
|
|
9
|
+
minEvidenceForGraduation: DEFAULT_MIN_EVIDENCE,
|
|
10
|
+
};
|
|
11
|
+
export function initialState(classKey, prior, at = 0) {
|
|
12
|
+
return {
|
|
13
|
+
classKey,
|
|
14
|
+
posterior: prior,
|
|
15
|
+
prior,
|
|
16
|
+
level: 0,
|
|
17
|
+
lastChangeAt: at,
|
|
18
|
+
demoteUntil: 0,
|
|
19
|
+
observations: 0,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function graduate(state, outcome, cfg = DEFAULT_GRADUATION_CONFIG) {
|
|
23
|
+
const ac = classifyActionClass(outcome.toolName, outcome.params);
|
|
24
|
+
const weight = outcomeWeight(ac, outcome.good);
|
|
25
|
+
const posterior = applyOutcome(state.posterior, outcome.good, weight);
|
|
26
|
+
const observations = state.observations + 1;
|
|
27
|
+
// Novel-class floor threshold. For a class already ABOVE L1, honour the
|
|
28
|
+
// (possibly looser) threshold it graduated under so a later config TIGHTENING
|
|
29
|
+
// can't retroactively floor it back to L1 and trigger a spurious demote. A
|
|
30
|
+
// class still in cold-start (≤ L1) always faces the current config in full.
|
|
31
|
+
// `Math.min` also lets a config LOOSENING apply immediately. Genuine
|
|
32
|
+
// evidence-based demotions (LCB crash from real failures) are unaffected —
|
|
33
|
+
// they don't go through the floor.
|
|
34
|
+
// Resolve to a concrete number (matches levelFromPosterior's internal `?? 10`)
|
|
35
|
+
// so the recorded threshold is always defined.
|
|
36
|
+
const cfgMinEvidence = cfg.minEvidenceForGraduation ?? DEFAULT_MIN_EVIDENCE;
|
|
37
|
+
const floorMinEvidence = state.level > 1 && state.minEvidenceAtLastPromotion !== undefined
|
|
38
|
+
? Math.min(cfgMinEvidence, state.minEvidenceAtLastPromotion)
|
|
39
|
+
: cfgMinEvidence;
|
|
40
|
+
const result = levelFromPosterior(posterior, state.prior, {
|
|
41
|
+
k: cfg.k,
|
|
42
|
+
minEvidenceForGraduation: floorMinEvidence,
|
|
43
|
+
reachable: reachableLevels(ac),
|
|
44
|
+
});
|
|
45
|
+
const candidate = result.level;
|
|
46
|
+
const base = {
|
|
47
|
+
...state,
|
|
48
|
+
posterior,
|
|
49
|
+
observations,
|
|
50
|
+
};
|
|
51
|
+
// DEMOTE — instant, may skip rungs.
|
|
52
|
+
if (candidate < state.level) {
|
|
53
|
+
const next = {
|
|
54
|
+
...base,
|
|
55
|
+
level: candidate,
|
|
56
|
+
lastChangeAt: outcome.at,
|
|
57
|
+
demoteUntil: outcome.at + cfg.demoteCooldownMs,
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
state: next,
|
|
61
|
+
event: {
|
|
62
|
+
type: "demote",
|
|
63
|
+
classKey: state.classKey,
|
|
64
|
+
from: state.level,
|
|
65
|
+
to: candidate,
|
|
66
|
+
at: outcome.at,
|
|
67
|
+
lcb: result.lcb,
|
|
68
|
+
evidence: result.evidence,
|
|
69
|
+
reason: `blast-weighted failure (weight=${weight})`,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// PROMOTE — gated by dwell + cooldown, one reachable rung at a time.
|
|
74
|
+
if (candidate > state.level) {
|
|
75
|
+
const dwellOk = outcome.at >= state.lastChangeAt + cfg.dwellMs;
|
|
76
|
+
const cooldownOk = outcome.at >= state.demoteUntil;
|
|
77
|
+
if (dwellOk && cooldownOk) {
|
|
78
|
+
const nextRung = reachableLevels(ac)
|
|
79
|
+
.filter((r) => r > state.level && r <= candidate)
|
|
80
|
+
.sort((a, b) => a - b)[0];
|
|
81
|
+
if (nextRung !== undefined) {
|
|
82
|
+
const to = nextRung;
|
|
83
|
+
return {
|
|
84
|
+
state: {
|
|
85
|
+
...base,
|
|
86
|
+
level: to,
|
|
87
|
+
lastChangeAt: outcome.at,
|
|
88
|
+
// Record the floor it just cleared (only meaningful above L1, where
|
|
89
|
+
// the floor actually gates). Keeps the running threshold the class
|
|
90
|
+
// has demonstrably satisfied, for the retroactive-demotion guard.
|
|
91
|
+
...(to > 1 && {
|
|
92
|
+
minEvidenceAtLastPromotion: floorMinEvidence,
|
|
93
|
+
}),
|
|
94
|
+
},
|
|
95
|
+
event: {
|
|
96
|
+
type: "promote",
|
|
97
|
+
classKey: state.classKey,
|
|
98
|
+
from: state.level,
|
|
99
|
+
to,
|
|
100
|
+
at: outcome.at,
|
|
101
|
+
lcb: result.lcb,
|
|
102
|
+
evidence: result.evidence,
|
|
103
|
+
reason: `sustained evidence (lcb=${result.lcb.toFixed(3)})`,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// No level change — posterior still updates.
|
|
110
|
+
return { state: base };
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=graduation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graduation.js","sourceRoot":"","sources":["../../src/workers/graduation.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,aAAa,EACb,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,kBAAkB,GAGnB,MAAM,iBAAiB,CAAC;AAkDzB;+EAC+E;AAC/E,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,MAAM,CAAC,MAAM,yBAAyB,GAAqB;IACzD,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,oBAAoB;IACjD,gBAAgB,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,0BAA0B;IACjE,wBAAwB,EAAE,oBAAoB;CAC/C,CAAC;AAaF,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,KAAgB,EAChB,EAAE,GAAG,CAAC;IAEN,OAAO;QACL,QAAQ;QACR,SAAS,EAAE,KAAK;QAChB,KAAK;QACL,KAAK,EAAE,CAAC;QACR,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;KAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,KAAsB,EACtB,OAAgB,EAChB,MAAwB,yBAAyB;IAEjD,MAAM,EAAE,GAAgB,mBAAmB,CAA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G,CAAC,IAAI;4BACZ,0BAA0B,EAAE,gBAAgB;yBAC7C,CAAC;qBACH;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,SAAS;wBACf,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,IAAI,EAAE,KAAK,CAAC,KAAK;wBACjB,EAAE;wBACF,EAAE,EAAE,OAAO,CAAC,EAAE;wBACd,GAAG,EAAE,MAAM,CAAC,GAAG;wBACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;wBACzB,MAAM,EAAE,2BAA2B,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;qBAC5D;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,6CAA6C;IAC7C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outcome disposition for a filed issue. Drives the trust signal the ramp
|
|
3
|
+
* folds in once the durability window has elapsed:
|
|
4
|
+
*
|
|
5
|
+
* confirmed — issue closed-as-completed or labelled valid. Strong positive:
|
|
6
|
+
* the worker's filing was real and accepted. Counts as good:true
|
|
7
|
+
* with full weight (same as today, but now human-verified).
|
|
8
|
+
* junk — issue closed-as-not-planned, labelled invalid/duplicate/wontfix,
|
|
9
|
+
* or otherwise dismissed. Strong negative: the worker filed noise.
|
|
10
|
+
* Flipped to good:false in trust-replay — junk must lower trust,
|
|
11
|
+
* not be neutral (surviving 24h unopened ≠ correctness).
|
|
12
|
+
* unknown — issue still open past the window, or no signal yet. WITHHELD —
|
|
13
|
+
* not folded as evidence at all (an unactioned filing must not
|
|
14
|
+
* earn trust just by sitting unopened; trust-by-neglect fix,
|
|
15
|
+
* #1064). A null return from getDisposition is treated identically.
|
|
16
|
+
*/
|
|
17
|
+
export type OutcomeDisposition = "confirmed" | "junk" | "unknown";
|
|
18
|
+
/**
|
|
19
|
+
* The directory that holds `outcome-log.jsonl`. Honors `PATCHWORK_HOME` (when
|
|
20
|
+
* set) so the WRITE path — `patchwork outcomes confirm|reject`, the
|
|
21
|
+
* outcome-ingester, and `POST /outcomes` — and the READ path — the trust-replay
|
|
22
|
+
* dial + the live gate in `runWorkerShadow` — always resolve to the SAME file.
|
|
23
|
+
* An explicit `override` (a test tmp dir, or the shadow's `opts.patchworkDir`)
|
|
24
|
+
* wins. This is the single source of truth for the log location: resolving it
|
|
25
|
+
* inconsistently on the read vs write side silently breaks the confirm loop on
|
|
26
|
+
* any box that sets `PATCHWORK_HOME` (a dashboard/CLI confirm writes one file
|
|
27
|
+
* while the dial reads another).
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveOutcomeLogDir(override?: string): string;
|
|
30
|
+
export interface OutcomeRecord {
|
|
31
|
+
/** GitHub issue URL — the lookup key. */
|
|
32
|
+
issueUrl: string;
|
|
33
|
+
disposition: OutcomeDisposition;
|
|
34
|
+
/** Epoch ms when this record was written by the ingester. */
|
|
35
|
+
checkedAt: number;
|
|
36
|
+
/** Optional context for auditing. */
|
|
37
|
+
recipeName?: string;
|
|
38
|
+
workerClass?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Persist + query outcome dispositions for filed issues.
|
|
42
|
+
*
|
|
43
|
+
* Storage: append-only JSONL at `~/.patchwork/outcome-log.jsonl` (one record
|
|
44
|
+
* per line). Later writes for the same issueUrl supersede earlier ones — the
|
|
45
|
+
* in-memory cache always resolves to the LAST record for a URL (last-writer-
|
|
46
|
+
* wins). This lets the ingester update a disposition as an issue evolves
|
|
47
|
+
* (e.g. open → closed-as-completed over days).
|
|
48
|
+
*
|
|
49
|
+
* Write path: `upsert()` — called by the outcome-ingester cron recipe.
|
|
50
|
+
* Read path: `getDisposition(url)` — called by WorkerShadowObserver.ingestRun
|
|
51
|
+
* on the hot trust-replay path. Cache is lazy-loaded once per
|
|
52
|
+
* instance; create a new instance per trust-replay (the observer
|
|
53
|
+
* already does one replay per gate decision).
|
|
54
|
+
*/
|
|
55
|
+
export declare class OutcomeStore {
|
|
56
|
+
private readonly logPath;
|
|
57
|
+
/** Lazy-loaded from disk. null = not yet loaded. */
|
|
58
|
+
private _cache;
|
|
59
|
+
constructor(patchworkDir: string);
|
|
60
|
+
/** Last-writer-wins map of issueUrl → disposition. Loaded once per instance. */
|
|
61
|
+
private get cache();
|
|
62
|
+
/**
|
|
63
|
+
* Disposition for `issueUrl`, or null when no record exists.
|
|
64
|
+
* Null is treated by trust-replay as "unknown" — WITHHELD (not folded as
|
|
65
|
+
* evidence). A filing with no recorded disposition can neither raise nor
|
|
66
|
+
* lower trust. (#1064)
|
|
67
|
+
*/
|
|
68
|
+
getDisposition(issueUrl: string): OutcomeDisposition | null;
|
|
69
|
+
/**
|
|
70
|
+
* Persist a disposition for `issueUrl`. Later calls supersede earlier ones
|
|
71
|
+
* (both on disk via append, and in the in-memory cache).
|
|
72
|
+
*/
|
|
73
|
+
upsert(record: OutcomeRecord): void;
|
|
74
|
+
/** All records (deduped, last-writer-wins). For reporting / ingester diffing. */
|
|
75
|
+
readAll(): OutcomeRecord[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Map a GitHub issue's state/labels to an OutcomeDisposition.
|
|
79
|
+
* Pure function — used both by the ingester recipe agent prompt and by tests.
|
|
80
|
+
*
|
|
81
|
+
* Junk signals (any one → junk):
|
|
82
|
+
* - state_reason: "not_planned"
|
|
83
|
+
* - labels containing: "invalid", "duplicate", "wontfix", "won't fix",
|
|
84
|
+
* "not a bug", "by design", "spam"
|
|
85
|
+
*
|
|
86
|
+
* Confirmed signals (issue closed with a positive signal):
|
|
87
|
+
* - state: "closed" + state_reason: "completed" (GitHub's default close)
|
|
88
|
+
* - labels containing: "patchwork:valid", "confirmed", "verified"
|
|
89
|
+
*
|
|
90
|
+
* Unknown: still open, or closed with no clear signal.
|
|
91
|
+
*/
|
|
92
|
+
export declare function classifyIssueDisposition(issue: {
|
|
93
|
+
state?: string;
|
|
94
|
+
state_reason?: string | null;
|
|
95
|
+
labels?: Array<string | {
|
|
96
|
+
name?: string;
|
|
97
|
+
}>;
|
|
98
|
+
}): OutcomeDisposition;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { appendFileSync, existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
/**
|
|
5
|
+
* The directory that holds `outcome-log.jsonl`. Honors `PATCHWORK_HOME` (when
|
|
6
|
+
* set) so the WRITE path — `patchwork outcomes confirm|reject`, the
|
|
7
|
+
* outcome-ingester, and `POST /outcomes` — and the READ path — the trust-replay
|
|
8
|
+
* dial + the live gate in `runWorkerShadow` — always resolve to the SAME file.
|
|
9
|
+
* An explicit `override` (a test tmp dir, or the shadow's `opts.patchworkDir`)
|
|
10
|
+
* wins. This is the single source of truth for the log location: resolving it
|
|
11
|
+
* inconsistently on the read vs write side silently breaks the confirm loop on
|
|
12
|
+
* any box that sets `PATCHWORK_HOME` (a dashboard/CLI confirm writes one file
|
|
13
|
+
* while the dial reads another).
|
|
14
|
+
*/
|
|
15
|
+
export function resolveOutcomeLogDir(override) {
|
|
16
|
+
return (override ?? process.env.PATCHWORK_HOME ?? path.join(homedir(), ".patchwork"));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Persist + query outcome dispositions for filed issues.
|
|
20
|
+
*
|
|
21
|
+
* Storage: append-only JSONL at `~/.patchwork/outcome-log.jsonl` (one record
|
|
22
|
+
* per line). Later writes for the same issueUrl supersede earlier ones — the
|
|
23
|
+
* in-memory cache always resolves to the LAST record for a URL (last-writer-
|
|
24
|
+
* wins). This lets the ingester update a disposition as an issue evolves
|
|
25
|
+
* (e.g. open → closed-as-completed over days).
|
|
26
|
+
*
|
|
27
|
+
* Write path: `upsert()` — called by the outcome-ingester cron recipe.
|
|
28
|
+
* Read path: `getDisposition(url)` — called by WorkerShadowObserver.ingestRun
|
|
29
|
+
* on the hot trust-replay path. Cache is lazy-loaded once per
|
|
30
|
+
* instance; create a new instance per trust-replay (the observer
|
|
31
|
+
* already does one replay per gate decision).
|
|
32
|
+
*/
|
|
33
|
+
export class OutcomeStore {
|
|
34
|
+
logPath;
|
|
35
|
+
/** Lazy-loaded from disk. null = not yet loaded. */
|
|
36
|
+
_cache = null;
|
|
37
|
+
constructor(patchworkDir) {
|
|
38
|
+
this.logPath = path.join(patchworkDir, "outcome-log.jsonl");
|
|
39
|
+
}
|
|
40
|
+
/** Last-writer-wins map of issueUrl → disposition. Loaded once per instance. */
|
|
41
|
+
get cache() {
|
|
42
|
+
if (this._cache)
|
|
43
|
+
return this._cache;
|
|
44
|
+
this._cache = new Map();
|
|
45
|
+
if (!existsSync(this.logPath))
|
|
46
|
+
return this._cache;
|
|
47
|
+
const text = readFileSync(this.logPath, "utf-8");
|
|
48
|
+
for (const line of text.split("\n")) {
|
|
49
|
+
const t = line.trim();
|
|
50
|
+
if (!t)
|
|
51
|
+
continue;
|
|
52
|
+
try {
|
|
53
|
+
const r = JSON.parse(t);
|
|
54
|
+
if (r.issueUrl && r.disposition) {
|
|
55
|
+
this._cache.set(r.issueUrl, r.disposition);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
/* skip malformed lines */
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return this._cache;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Disposition for `issueUrl`, or null when no record exists.
|
|
66
|
+
* Null is treated by trust-replay as "unknown" — WITHHELD (not folded as
|
|
67
|
+
* evidence). A filing with no recorded disposition can neither raise nor
|
|
68
|
+
* lower trust. (#1064)
|
|
69
|
+
*/
|
|
70
|
+
getDisposition(issueUrl) {
|
|
71
|
+
return this.cache.get(issueUrl) ?? null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Persist a disposition for `issueUrl`. Later calls supersede earlier ones
|
|
75
|
+
* (both on disk via append, and in the in-memory cache).
|
|
76
|
+
*/
|
|
77
|
+
upsert(record) {
|
|
78
|
+
const line = `${JSON.stringify(record)}\n`;
|
|
79
|
+
appendFileSync(this.logPath, line, "utf-8");
|
|
80
|
+
// Update cache so the same instance sees its own write immediately.
|
|
81
|
+
if (this._cache)
|
|
82
|
+
this._cache.set(record.issueUrl, record.disposition);
|
|
83
|
+
}
|
|
84
|
+
/** All records (deduped, last-writer-wins). For reporting / ingester diffing. */
|
|
85
|
+
readAll() {
|
|
86
|
+
// Re-parse to get full records (cache only stores disposition).
|
|
87
|
+
const seen = new Map();
|
|
88
|
+
if (!existsSync(this.logPath))
|
|
89
|
+
return [];
|
|
90
|
+
const text = readFileSync(this.logPath, "utf-8");
|
|
91
|
+
for (const line of text.split("\n")) {
|
|
92
|
+
const t = line.trim();
|
|
93
|
+
if (!t)
|
|
94
|
+
continue;
|
|
95
|
+
try {
|
|
96
|
+
const r = JSON.parse(t);
|
|
97
|
+
if (r.issueUrl && r.disposition)
|
|
98
|
+
seen.set(r.issueUrl, r);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
/* skip malformed */
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return Array.from(seen.values());
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Map a GitHub issue's state/labels to an OutcomeDisposition.
|
|
109
|
+
* Pure function — used both by the ingester recipe agent prompt and by tests.
|
|
110
|
+
*
|
|
111
|
+
* Junk signals (any one → junk):
|
|
112
|
+
* - state_reason: "not_planned"
|
|
113
|
+
* - labels containing: "invalid", "duplicate", "wontfix", "won't fix",
|
|
114
|
+
* "not a bug", "by design", "spam"
|
|
115
|
+
*
|
|
116
|
+
* Confirmed signals (issue closed with a positive signal):
|
|
117
|
+
* - state: "closed" + state_reason: "completed" (GitHub's default close)
|
|
118
|
+
* - labels containing: "patchwork:valid", "confirmed", "verified"
|
|
119
|
+
*
|
|
120
|
+
* Unknown: still open, or closed with no clear signal.
|
|
121
|
+
*/
|
|
122
|
+
export function classifyIssueDisposition(issue) {
|
|
123
|
+
const labelNames = (issue.labels ?? [])
|
|
124
|
+
.map((l) => (typeof l === "string" ? l : (l.name ?? "")))
|
|
125
|
+
.map((s) => s.toLowerCase());
|
|
126
|
+
const JUNK_LABELS = [
|
|
127
|
+
"invalid",
|
|
128
|
+
"duplicate",
|
|
129
|
+
"wontfix",
|
|
130
|
+
"won't fix",
|
|
131
|
+
"not a bug",
|
|
132
|
+
"by design",
|
|
133
|
+
"spam",
|
|
134
|
+
];
|
|
135
|
+
const CONFIRMED_LABELS = ["patchwork:valid", "confirmed", "verified"];
|
|
136
|
+
if (JUNK_LABELS.some((j) => labelNames.some((l) => l.includes(j))))
|
|
137
|
+
return "junk";
|
|
138
|
+
if (issue.state_reason === "not_planned")
|
|
139
|
+
return "junk";
|
|
140
|
+
if (CONFIRMED_LABELS.some((c) => labelNames.some((l) => l.includes(c))))
|
|
141
|
+
return "confirmed";
|
|
142
|
+
if (issue.state === "closed" && issue.state_reason === "completed")
|
|
143
|
+
return "confirmed";
|
|
144
|
+
return "unknown";
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=outcomeStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcomeStore.js","sourceRoot":"","sources":["../../src/workers/outcomeStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAoB7B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAiB;IACpD,OAAO,CACL,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAC7E,CAAC;AACJ,CAAC;AAaD;;;;;;;;;;;;;;GAcG;AACH,MAAM,O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ACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;SACxD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAE/B,MAAM,WAAW,GAAG;QAClB,SAAS;QACT,WAAW;QACX,SAAS;QACT,WAAW;QACX,WAAW;QACX,WAAW;QACX,MAAM;KACP,CAAC;IACF,MAAM,gBAAgB,GAAG,CAAC,iBAAiB,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;IAEtE,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,OAAO,MAAM,CAAC;IAChB,IAAI,KAAK,CAAC,YAAY,KAAK,aAAa;QAAE,OAAO,MAAM,CAAC;IAExD,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,OAAO,WAAW,CAAC;IACrB,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,YAAY,KAAK,WAAW;QAChE,OAAO,WAAW,CAAC;IAErB,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { OutcomeRecord, OutcomeStore } from "./outcomeStore.js";
|
|
2
|
+
/**
|
|
3
|
+
* `patchwork outcomes confirm|reject|list` — the operator's positive-act
|
|
4
|
+
* confirmation path for worker-filed issues.
|
|
5
|
+
*
|
|
6
|
+
* WHY THIS EXISTS. The trust ramp only folds a durable non-reversible filing as
|
|
7
|
+
* earned trust once its outcome disposition is `confirmed`; an `unknown` (still
|
|
8
|
+
* open, nobody acted) filing is WITHHELD, never counted (the trust-by-neglect
|
|
9
|
+
* fix). So a worker's `issue` dial cannot move on its own — something external
|
|
10
|
+
* must confirm the filing was real. Closing the issue as completed on GitHub
|
|
11
|
+
* does this (the outcome-ingester cron picks it up), but that needs the GitHub
|
|
12
|
+
* connector and a round-trip. This verb is the direct, local alternative:
|
|
13
|
+
* an operator records the disposition straight into ~/.patchwork/outcome-log.jsonl.
|
|
14
|
+
*
|
|
15
|
+
* Crucially, this is a HUMAN CLI, not a recipe step — no worker recipe can call
|
|
16
|
+
* it, so a worker cannot self-confirm its own filings. The reward path stays as
|
|
17
|
+
* independent of the worker as the penalty path (junk).
|
|
18
|
+
*/
|
|
19
|
+
export interface OutcomesCliResult {
|
|
20
|
+
stdout?: string;
|
|
21
|
+
stderr?: string;
|
|
22
|
+
exitCode: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Pure command core — takes argv (after `outcomes`) + an OutcomeStore and a
|
|
26
|
+
* wall-clock, returns what to print and the exit code. No process.exit / no
|
|
27
|
+
* Date.now so it is fully unit-testable; the index.ts dispatch supplies I/O.
|
|
28
|
+
*/
|
|
29
|
+
export declare function runOutcomesCli(args: string[], deps: {
|
|
30
|
+
store: OutcomeStore;
|
|
31
|
+
now: number;
|
|
32
|
+
}): OutcomesCliResult;
|
|
33
|
+
/** Human-readable rendering of all recorded outcomes (last-writer-wins). */
|
|
34
|
+
export declare function formatOutcomeList(records: OutcomeRecord[]): string;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const OUTCOMES_USAGE = `Usage:
|
|
2
|
+
patchwork outcomes confirm <issue-url> [--recipe <name>] [--class <actionClass>]
|
|
3
|
+
patchwork outcomes reject <issue-url> [--recipe <name>] [--class <actionClass>]
|
|
4
|
+
patchwork outcomes list [--json]
|
|
5
|
+
patchwork outcomes pending [--json]
|
|
6
|
+
|
|
7
|
+
Manually record an outcome disposition for a worker-filed issue so the trust
|
|
8
|
+
ramp can fold it as evidence. Writes to ~/.patchwork/outcome-log.jsonl. This is
|
|
9
|
+
an operator positive-act — NOT a step any worker recipe can run, so a worker
|
|
10
|
+
cannot self-confirm its own filings.
|
|
11
|
+
|
|
12
|
+
confirm the filing was real / accepted -> "confirmed" (earns trust)
|
|
13
|
+
reject the filing was noise -> "junk" (lowers trust)
|
|
14
|
+
list print all recorded outcomes (--json for raw output)
|
|
15
|
+
pending list filings still awaiting confirmation + the exact confirm command
|
|
16
|
+
|
|
17
|
+
--recipe <name> stamp the filing recipe onto the record (audit context)
|
|
18
|
+
--class <actionClass> stamp the action class onto the record (audit context)
|
|
19
|
+
`;
|
|
20
|
+
/** Value following `--flag` in argv, or undefined. */
|
|
21
|
+
function flagValue(args, name) {
|
|
22
|
+
const i = args.indexOf(name);
|
|
23
|
+
return i >= 0 && i + 1 < args.length ? args[i + 1] : undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Pure command core — takes argv (after `outcomes`) + an OutcomeStore and a
|
|
27
|
+
* wall-clock, returns what to print and the exit code. No process.exit / no
|
|
28
|
+
* Date.now so it is fully unit-testable; the index.ts dispatch supplies I/O.
|
|
29
|
+
*/
|
|
30
|
+
export function runOutcomesCli(args, deps) {
|
|
31
|
+
const sub = args[0];
|
|
32
|
+
if (!sub || args.includes("--help") || args.includes("-h")) {
|
|
33
|
+
// Bare `outcomes` is a usage error (exit 1); an explicit --help is exit 0.
|
|
34
|
+
return { stdout: OUTCOMES_USAGE, exitCode: sub ? 0 : 1 };
|
|
35
|
+
}
|
|
36
|
+
if (sub === "list") {
|
|
37
|
+
const records = deps.store.readAll();
|
|
38
|
+
if (args.includes("--json")) {
|
|
39
|
+
return { stdout: `${JSON.stringify(records, null, 2)}\n`, exitCode: 0 };
|
|
40
|
+
}
|
|
41
|
+
return { stdout: formatOutcomeList(records), exitCode: 0 };
|
|
42
|
+
}
|
|
43
|
+
if (sub === "confirm" || sub === "reject") {
|
|
44
|
+
const issueUrl = args[1];
|
|
45
|
+
if (!issueUrl || issueUrl.startsWith("-")) {
|
|
46
|
+
return {
|
|
47
|
+
stderr: `Error: \`outcomes ${sub}\` requires an <issue-url>.\n\n${OUTCOMES_USAGE}`,
|
|
48
|
+
exitCode: 1,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (!/^https?:\/\//.test(issueUrl)) {
|
|
52
|
+
return {
|
|
53
|
+
stderr: `Error: <issue-url> must be an http(s) URL (got "${issueUrl}"). Pass the issue's GitHub URL exactly as the worker filed it.\n`,
|
|
54
|
+
exitCode: 1,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const disposition = sub === "confirm" ? "confirmed" : "junk";
|
|
58
|
+
const recipeName = flagValue(args, "--recipe");
|
|
59
|
+
const workerClass = flagValue(args, "--class");
|
|
60
|
+
const record = {
|
|
61
|
+
issueUrl,
|
|
62
|
+
disposition,
|
|
63
|
+
checkedAt: deps.now,
|
|
64
|
+
...(recipeName ? { recipeName } : {}),
|
|
65
|
+
...(workerClass ? { workerClass } : {}),
|
|
66
|
+
};
|
|
67
|
+
deps.store.upsert(record);
|
|
68
|
+
return {
|
|
69
|
+
stdout: `Recorded ${disposition} for ${issueUrl}\n` +
|
|
70
|
+
"The trust ramp folds this on its next replay — run `patchwork workers shadow` to see the dial move.\n",
|
|
71
|
+
exitCode: 0,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
stderr: `Error: unknown subcommand "${sub}".\n\n${OUTCOMES_USAGE}`,
|
|
76
|
+
exitCode: 1,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** Human-readable rendering of all recorded outcomes (last-writer-wins). */
|
|
80
|
+
export function formatOutcomeList(records) {
|
|
81
|
+
if (records.length === 0) {
|
|
82
|
+
return "No recorded outcomes yet (~/.patchwork/outcome-log.jsonl is empty or absent).\n";
|
|
83
|
+
}
|
|
84
|
+
const lines = records.map((r) => {
|
|
85
|
+
const when = new Date(r.checkedAt).toISOString();
|
|
86
|
+
const ctx = [r.recipeName, r.workerClass].filter(Boolean).join(" · ");
|
|
87
|
+
return ` ${r.disposition.padEnd(9)} ${r.issueUrl}${ctx ? ` (${ctx})` : ""} @ ${when}`;
|
|
88
|
+
});
|
|
89
|
+
return `${records.length} recorded outcome(s):\n${lines.join("\n")}\n`;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=outcomesCli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcomesCli.js","sourceRoot":"","sources":["../../src/workers/outcomesCli.ts"],"names":[],"mappings":"AA8BA,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;CAkBtB,CAAC;AAEF,sDAAsD;AACtD,SAAS,SAAS,CAAC,IAAc,EAAE,IAAY;IAC7C,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAc,EACd,IAA0C;IAE1C,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3D,2EAA2E;QAC3E,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,CAAC;IAED,IAA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IAAI,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type WorkerShadowReport } from "./shadowObserver.js";
|
|
2
|
+
import type { WorkerManifest } from "./worker.js";
|
|
3
|
+
import type { WorkerLevelStore } from "./workerLevelStore.js";
|
|
4
|
+
/**
|
|
5
|
+
* I/O entry for the shadow logger: read the REAL logs the bridge already
|
|
6
|
+
* writes — `~/.patchwork/runs.jsonl` (RecipeRunLog → the dial's evidence) and
|
|
7
|
+
* `~/.claude/ide/activity-*.jsonl` (the live gate's approval decisions) — and
|
|
8
|
+
* produce the trust-dial + ramp-vs-gate report. Fully read-only; touches
|
|
9
|
+
* nothing. Empty logs are honest, not an error (new workers have no activity).
|
|
10
|
+
*/
|
|
11
|
+
export interface RunWorkerShadowOpts {
|
|
12
|
+
/** Where worker manifests live (default ~/.patchwork/workers). */
|
|
13
|
+
workersDir?: string;
|
|
14
|
+
/** ~/.patchwork (runs.jsonl) override (tests). */
|
|
15
|
+
patchworkDir?: string;
|
|
16
|
+
/** ~/.claude/ide (activity-*.jsonl) override (tests). */
|
|
17
|
+
ideDir?: string;
|
|
18
|
+
/** Wall-clock override (tests) for durable-outcome labelling. Defaults to
|
|
19
|
+
* Date.now() — supplied here (the I/O entry) so the observer stays pure. */
|
|
20
|
+
now?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface WorkerShadowData {
|
|
23
|
+
workers: WorkerShadowReport[];
|
|
24
|
+
runsScanned: number;
|
|
25
|
+
decisionsScanned: number;
|
|
26
|
+
/** The directory worker manifests were loaded from (for empty-state copy). */
|
|
27
|
+
workersDir: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Structured shadow report — a read-only replay of the run + decision logs
|
|
31
|
+
* through the (worker × action-class) ramp. Backs both the CLI and the bridge
|
|
32
|
+
* `GET /workers/shadow` JSON endpoint. Pure aside from the log reads.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getWorkerShadowData(opts?: RunWorkerShadowOpts): WorkerShadowData;
|
|
35
|
+
export interface RecipeWorkerTrust {
|
|
36
|
+
worker: WorkerManifest;
|
|
37
|
+
/** Earned-level store, replayed from the run log — same source as the dial. */
|
|
38
|
+
store: WorkerLevelStore;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Load the worker that owns `recipeName` (recipe === body) plus its earned-level
|
|
42
|
+
* store, replayed from the same run log the dial uses. Returns null when no
|
|
43
|
+
* worker owns the recipe (the common case — non-worker recipes are unaffected).
|
|
44
|
+
*
|
|
45
|
+
* This is the LIVE-gate entry: `workerGate.decideWorkerAction(worker, tool,
|
|
46
|
+
* params, store)` reads the returned store. It replays the run log on each call
|
|
47
|
+
* (recipe executions are infrequent); a future optimisation could cache it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function loadWorkerTrustForRecipe(recipeName: string, opts?: RunWorkerShadowOpts): RecipeWorkerTrust | null;
|
|
50
|
+
export declare function runWorkerShadowReport(opts?: RunWorkerShadowOpts): string;
|
|
51
|
+
/**
|
|
52
|
+
* Backtest each installed worker over its historical run log and print the
|
|
53
|
+
* divergence-calibration report (false-allow / false-gate). Read-only — the
|
|
54
|
+
* cold-start "what would this worker have done across N real actions, and where
|
|
55
|
+
* would it have diverged" artifact. See backtest.ts.
|
|
56
|
+
*/
|
|
57
|
+
export declare function runWorkerBacktest(opts?: RunWorkerShadowOpts): string;
|
|
58
|
+
/** One filing awaiting an operator disposition — the confirm queue's unit. */
|
|
59
|
+
export interface PendingConfirmation {
|
|
60
|
+
/** The captured filing URL — the confirm key. Today only `github.create_issue`
|
|
61
|
+
* captures a URL to the run log, so these are issue URLs; a future PR-filing
|
|
62
|
+
* recipe tool would flow through unchanged. */
|
|
63
|
+
issueUrl: string;
|
|
64
|
+
recipeName: string;
|
|
65
|
+
workerId: string;
|
|
66
|
+
workerName: string;
|
|
67
|
+
/** Epoch ms the filing ran. */
|
|
68
|
+
filedAt: number;
|
|
69
|
+
/** `domain:reversibility:blastTier` — the action class it counts toward. */
|
|
70
|
+
classKey: string;
|
|
71
|
+
/** The filing's human title, captured at filing time (the write tool echoes
|
|
72
|
+
* it back in the step output — e.g. `github.create_issue` returns `title`).
|
|
73
|
+
* Lets the dashboard review queue show "Login test failing on main" instead
|
|
74
|
+
* of a bare URL. Absent for older run-log rows written before capture. */
|
|
75
|
+
title?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The CONFIRM QUEUE — every non-reversible filing (a URL a worker captured) that
|
|
79
|
+
* has NO operator disposition yet (`unknown` / no record). These are exactly the
|
|
80
|
+
* filings whose trust is WITHHELD until a human confirms or rejects them — the
|
|
81
|
+
* queue `patchwork outcomes confirm|reject` exists to drain, and the moat KPI
|
|
82
|
+
* (evidence latency) is the age of this queue. Read-only. Deduped by URL
|
|
83
|
+
* (most-recent filing wins), newest first. Confirmed/junk filings are excluded
|
|
84
|
+
* (already actioned); reversible actions are excluded (they never need
|
|
85
|
+
* confirmation — they earn trust on their own). In practice today only issue
|
|
86
|
+
* filings (`github.create_issue`) carry a captured URL.
|
|
87
|
+
*/
|
|
88
|
+
export declare function computePendingConfirmations(opts?: RunWorkerShadowOpts): PendingConfirmation[];
|
|
89
|
+
/** Human-readable confirm queue for `patchwork outcomes pending`. */
|
|
90
|
+
export declare function formatPendingConfirmations(pending: PendingConfirmation[], now?: number): string;
|