@wardby/cli 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +53 -4
- package/README.md +52 -13
- package/dist/claude-coding-worker/driver.d.ts +6 -1
- package/dist/claude-coding-worker/driver.js +27 -1
- package/dist/claude-coding-worker/main.js +2 -0
- package/dist/claude-coding-worker/tool-socket.d.ts +9 -0
- package/dist/claude-coding-worker/tool-socket.js +26 -0
- package/dist/cli-help.d.ts +1 -1
- package/dist/cli-help.js +14 -4
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +284 -36
- package/dist/coding/base-commit.d.ts +6 -0
- package/dist/coding/base-commit.js +12 -0
- package/dist/coding/collect-exclude.d.ts +25 -0
- package/dist/coding/collect-exclude.js +76 -0
- package/dist/coding/profile.d.ts +67 -22
- package/dist/coding/profile.js +58 -25
- package/dist/coding/protected-path-wording.d.ts +24 -0
- package/dist/coding/protected-path-wording.js +55 -0
- package/dist/coding/protected-paths.d.ts +31 -0
- package/dist/coding/protected-paths.js +48 -0
- package/dist/coding/protocol.d.ts +91 -4
- package/dist/coding/protocol.js +123 -12
- package/dist/coding/provider.d.ts +6 -1
- package/dist/coding/provider.js +16 -9
- package/dist/coding/registry/adapters.d.ts +2 -0
- package/dist/coding/registry/adapters.js +9 -0
- package/dist/coding/registry/allowlist.d.ts +9 -0
- package/dist/coding/registry/allowlist.js +28 -0
- package/dist/coding/registry/json-scan.d.ts +55 -0
- package/dist/coding/registry/json-scan.js +191 -0
- package/dist/coding/registry/lockfiles.d.ts +6 -0
- package/dist/coding/registry/lockfiles.js +89 -0
- package/dist/coding/registry/npm-lockfile.d.ts +9 -0
- package/dist/coding/registry/npm-lockfile.js +73 -0
- package/dist/coding/registry/npm-plan.d.ts +29 -0
- package/dist/coding/registry/npm-plan.js +289 -0
- package/dist/coding/registry/npm.d.ts +7 -0
- package/dist/coding/registry/npm.js +252 -0
- package/dist/coding/registry/pypi.d.ts +4 -0
- package/dist/coding/registry/pypi.js +210 -0
- package/dist/coding/registry/report.d.ts +37 -0
- package/dist/coding/registry/report.js +31 -0
- package/dist/coding/registry/token.d.ts +4 -0
- package/dist/coding/registry/token.js +7 -0
- package/dist/coding/registry/types.d.ts +286 -0
- package/dist/coding/registry/types.js +19 -0
- package/dist/coding/registry/worker-config.d.ts +14 -0
- package/dist/coding/registry/worker-config.js +31 -0
- package/dist/coding/services/builtins.d.ts +22 -0
- package/dist/coding/services/builtins.js +85 -0
- package/dist/coding/services/catalog.d.ts +443 -0
- package/dist/coding/services/catalog.js +159 -0
- package/dist/coding/services/declaration.d.ts +11 -0
- package/dist/coding/services/declaration.js +114 -0
- package/dist/coding/services/note.d.ts +8 -0
- package/dist/coding/services/note.js +15 -0
- package/dist/coding/services/resolve.d.ts +25 -0
- package/dist/coding/services/resolve.js +50 -0
- package/dist/coding/services/wording.d.ts +25 -0
- package/dist/coding/services/wording.js +70 -0
- package/dist/coding-proxy/main.js +24 -4
- package/dist/coding-worker/artifact.d.ts +6 -0
- package/dist/coding-worker/debug-trace.d.ts +37 -0
- package/dist/coding-worker/debug-trace.js +117 -0
- package/dist/coding-worker/driver.d.ts +13 -1
- package/dist/coding-worker/driver.js +102 -13
- package/dist/coding-worker/errors.js +8 -0
- package/dist/coding-worker/main.js +10 -2
- package/dist/coding-worker/sdk.d.ts +2 -2
- package/dist/coding-worker/sdk.js +7 -2
- package/dist/coding-worker/types.d.ts +3 -0
- package/dist/config/providers.d.ts +66 -0
- package/dist/config/providers.js +137 -0
- package/dist/core/attribution.d.ts +101 -0
- package/dist/core/attribution.js +208 -0
- package/dist/core/budget-groups.d.ts +120 -10
- package/dist/core/budget-groups.js +133 -24
- package/dist/core/budget-wording.d.ts +22 -0
- package/dist/core/budget-wording.js +55 -0
- package/dist/core/coding-queue.d.ts +3 -0
- package/dist/core/coding-queue.js +6 -2
- package/dist/core/coding-service-status.d.ts +11 -0
- package/dist/core/coding-service-status.js +17 -0
- package/dist/core/cost-report.d.ts +88 -0
- package/dist/core/cost-report.js +248 -0
- package/dist/core/datastores.js +18 -2
- package/dist/core/db.d.ts +5 -1
- package/dist/core/db.js +8 -2
- package/dist/core/dispatch.d.ts +74 -7
- package/dist/core/dispatch.js +382 -47
- package/dist/core/engine-native.js +44 -14
- package/dist/core/glob.d.ts +10 -0
- package/dist/core/glob.js +33 -0
- package/dist/core/grants.d.ts +86 -0
- package/dist/core/grants.js +126 -0
- package/dist/core/host-events.d.ts +72 -0
- package/dist/core/host-events.js +597 -0
- package/dist/core/host-identity-links.d.ts +54 -0
- package/dist/core/host-identity-links.js +189 -0
- package/dist/core/host-status.d.ts +78 -0
- package/dist/core/host-status.js +228 -0
- package/dist/core/in-flight-runs.d.ts +8 -0
- package/dist/core/in-flight-runs.js +56 -0
- package/dist/core/issue-bridge.d.ts +60 -0
- package/dist/core/issue-bridge.js +189 -0
- package/dist/core/issue-dedupe.d.ts +70 -0
- package/dist/core/issue-dedupe.js +255 -0
- package/dist/core/issue-events.d.ts +42 -0
- package/dist/core/issue-events.js +155 -0
- package/dist/core/issue-status.d.ts +29 -0
- package/dist/core/issue-status.js +241 -0
- package/dist/core/issue-tracker-tools.d.ts +64 -0
- package/dist/core/issue-tracker-tools.js +850 -0
- package/dist/core/model-usage.d.ts +10 -0
- package/dist/core/model-usage.js +24 -0
- package/dist/core/provider-wording.d.ts +12 -0
- package/dist/core/provider-wording.js +44 -0
- package/dist/core/reconciler.d.ts +42 -2
- package/dist/core/reconciler.js +97 -2
- package/dist/core/repo-access.d.ts +99 -0
- package/dist/core/repo-access.js +136 -0
- package/dist/core/review-host-checks.d.ts +11 -0
- package/dist/core/review-host-checks.js +41 -0
- package/dist/core/review-host-tools.d.ts +47 -0
- package/dist/core/review-host-tools.js +354 -0
- package/dist/core/run-heartbeat.d.ts +27 -0
- package/dist/core/run-heartbeat.js +54 -0
- package/dist/core/run-pricing.d.ts +61 -0
- package/dist/core/run-pricing.js +56 -0
- package/dist/core/runner.d.ts +33 -8
- package/dist/core/runner.js +410 -62
- package/dist/core/scheduler.d.ts +4 -1
- package/dist/core/scheduler.js +3 -2
- package/dist/core/secrets.d.ts +11 -2
- package/dist/core/secrets.js +25 -6
- package/dist/core/self-defects.d.ts +80 -0
- package/dist/core/self-defects.js +180 -0
- package/dist/core/subagent-memory-tools.d.ts +1 -1
- package/dist/core/subagent-memory-tools.js +16 -3
- package/dist/core/tool-admin.d.ts +81 -0
- package/dist/core/tool-admin.js +129 -0
- package/dist/core/tool-names.d.ts +42 -0
- package/dist/core/tool-names.js +67 -0
- package/dist/core/untrusted-content.d.ts +32 -0
- package/dist/core/untrusted-content.js +72 -0
- package/dist/core/webhooks.d.ts +17 -2
- package/dist/core/webhooks.js +42 -3
- package/dist/generated/prisma/browser.d.ts +166 -0
- package/dist/generated/prisma/client.d.ts +166 -0
- package/dist/generated/prisma/commonInputTypes.d.ts +152 -52
- package/dist/generated/prisma/enums.d.ts +13 -0
- package/dist/generated/prisma/enums.js +12 -1
- package/dist/generated/prisma/internal/class.d.ts +242 -0
- package/dist/generated/prisma/internal/class.js +4 -4
- package/dist/generated/prisma/internal/prismaNamespace.d.ts +2571 -577
- package/dist/generated/prisma/internal/prismaNamespace.js +312 -6
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +328 -0
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +312 -6
- package/dist/generated/prisma/models/Agent.d.ts +682 -1
- package/dist/generated/prisma/models/AgentIssueProject.d.ts +1838 -0
- package/dist/generated/prisma/models/AgentIssueProject.js +1 -0
- package/dist/generated/prisma/models/AgentRepository.d.ts +1425 -0
- package/dist/generated/prisma/models/AgentRepository.js +1 -0
- package/dist/generated/prisma/models/AgentTool.d.ts +95 -1
- package/dist/generated/prisma/models/AuthUser.d.ts +56 -1
- package/dist/generated/prisma/models/CodingAgentProfile.d.ts +258 -7
- package/dist/generated/prisma/models/CodingProxySession.d.ts +195 -2
- package/dist/generated/prisma/models/CodingRun.d.ts +1405 -95
- package/dist/generated/prisma/models/CodingRunServiceStatus.d.ts +1404 -0
- package/dist/generated/prisma/models/CodingRunServiceStatus.js +1 -0
- package/dist/generated/prisma/models/CodingService.d.ts +1348 -0
- package/dist/generated/prisma/models/CodingService.js +1 -0
- package/dist/generated/prisma/models/HostEventDelivery.d.ts +946 -0
- package/dist/generated/prisma/models/HostEventDelivery.js +1 -0
- package/dist/generated/prisma/models/HostIdentity.d.ts +1232 -0
- package/dist/generated/prisma/models/HostIdentity.js +1 -0
- package/dist/generated/prisma/models/HostIdentityLinkRequest.d.ts +1473 -0
- package/dist/generated/prisma/models/HostIdentityLinkRequest.js +1 -0
- package/dist/generated/prisma/models/IssueFingerprint.d.ts +1183 -0
- package/dist/generated/prisma/models/IssueFingerprint.js +1 -0
- package/dist/generated/prisma/models/IssuePullRequest.d.ts +1255 -0
- package/dist/generated/prisma/models/IssuePullRequest.js +1 -0
- package/dist/generated/prisma/models/ModelCatalogEntry.d.ts +1322 -0
- package/dist/generated/prisma/models/ModelCatalogEntry.js +1 -0
- package/dist/generated/prisma/models/Principal.d.ts +455 -0
- package/dist/generated/prisma/models/RegistryAllowance.d.ts +1148 -0
- package/dist/generated/prisma/models/RegistryAllowance.js +1 -0
- package/dist/generated/prisma/models/RegistryApprovedVersion.d.ts +1219 -0
- package/dist/generated/prisma/models/RegistryApprovedVersion.js +1 -0
- package/dist/generated/prisma/models/RegistryFetch.d.ts +1428 -0
- package/dist/generated/prisma/models/RegistryFetch.js +1 -0
- package/dist/generated/prisma/models/RegistryPlanRefusal.d.ts +1294 -0
- package/dist/generated/prisma/models/RegistryPlanRefusal.js +1 -0
- package/dist/generated/prisma/models/RegistryVersionFact.d.ts +1085 -0
- package/dist/generated/prisma/models/RegistryVersionFact.js +1 -0
- package/dist/generated/prisma/models/ResourceGrant.d.ts +1437 -0
- package/dist/generated/prisma/models/ResourceGrant.js +1 -0
- package/dist/generated/prisma/models/Run.d.ts +1402 -82
- package/dist/generated/prisma/models/RunAttribution.d.ts +1259 -0
- package/dist/generated/prisma/models/RunAttribution.js +1 -0
- package/dist/generated/prisma/models/RunHostCheck.d.ts +1239 -0
- package/dist/generated/prisma/models/RunHostCheck.js +1 -0
- package/dist/generated/prisma/models/RunHostStatus.d.ts +1315 -0
- package/dist/generated/prisma/models/RunHostStatus.js +1 -0
- package/dist/generated/prisma/models/RunIssueStatus.d.ts +1199 -0
- package/dist/generated/prisma/models/RunIssueStatus.js +1 -0
- package/dist/generated/prisma/models/RunModelUsage.d.ts +1316 -0
- package/dist/generated/prisma/models/RunModelUsage.js +1 -0
- package/dist/generated/prisma/models/Tool.d.ts +15 -3
- package/dist/generated/prisma/models/WorkItem.d.ts +1408 -0
- package/dist/generated/prisma/models/WorkItem.js +1 -0
- package/dist/generated/prisma/models.d.ts +22 -0
- package/dist/help/build.d.ts +1 -0
- package/dist/help/build.js +9 -0
- package/dist/help/catalog.d.ts +24 -0
- package/dist/help/catalog.js +160 -0
- package/dist/help/cli.d.ts +2 -0
- package/dist/help/cli.js +65 -0
- package/dist/help/runtime.d.ts +3 -0
- package/dist/help/runtime.js +44 -0
- package/dist/help/search.d.ts +9 -0
- package/dist/help/search.js +104 -0
- package/dist/help-index.json +999 -0
- package/dist/import/cli-args.js +3 -2
- package/dist/import/create.d.ts +5 -0
- package/dist/import/create.js +67 -13
- package/dist/import/index.js +19 -9
- package/dist/import/neutral-schema.d.ts +18 -18
- package/dist/knowledge/check.d.ts +13 -0
- package/dist/knowledge/check.js +69 -0
- package/dist/knowledge/cli.d.ts +14 -0
- package/dist/knowledge/cli.js +67 -0
- package/dist/knowledge/concept.d.ts +54 -0
- package/dist/knowledge/concept.js +78 -0
- package/dist/knowledge/note.d.ts +11 -0
- package/dist/knowledge/note.js +39 -0
- package/dist/knowledge/relevance.d.ts +11 -0
- package/dist/knowledge/relevance.js +14 -0
- package/dist/knowledge/span-hash.d.ts +3 -0
- package/dist/knowledge/span-hash.js +16 -0
- package/dist/mcp/auth/access.d.ts +72 -0
- package/dist/mcp/auth/access.js +58 -0
- package/dist/mcp/auth/grants-cli.d.ts +149 -0
- package/dist/mcp/auth/grants-cli.js +518 -0
- package/dist/mcp/auth/host-account-cli.d.ts +2 -0
- package/dist/mcp/auth/host-account-cli.js +47 -0
- package/dist/mcp/auth/ownership.d.ts +25 -51
- package/dist/mcp/auth/ownership.js +19 -14
- package/dist/mcp/auth/repo-authorization.d.ts +22 -0
- package/dist/mcp/auth/repo-authorization.js +51 -0
- package/dist/mcp/auth/resource-server.d.ts +33 -2
- package/dist/mcp/auth/resource-server.js +99 -3
- package/dist/mcp/auth/self-hosted/browser.js +2 -2
- package/dist/mcp/auth/self-hosted/cli.js +47 -13
- package/dist/mcp/auth/self-hosted/credentials.d.ts +23 -5
- package/dist/mcp/auth/self-hosted/credentials.js +62 -4
- package/dist/mcp/auth/self-hosted/session.d.ts +7 -6
- package/dist/mcp/context.d.ts +30 -1
- package/dist/mcp/errors.d.ts +25 -6
- package/dist/mcp/errors.js +98 -0
- package/dist/mcp/host-events/deliveries.d.ts +9 -0
- package/dist/mcp/host-events/deliveries.js +17 -0
- package/dist/mcp/host-events/github-ingress.d.ts +38 -0
- package/dist/mcp/host-events/github-ingress.js +83 -0
- package/dist/mcp/host-events/github-user-callback.d.ts +18 -0
- package/dist/mcp/host-events/github-user-callback.js +50 -0
- package/dist/mcp/host-events/jira-ingress.d.ts +29 -0
- package/dist/mcp/host-events/jira-ingress.js +92 -0
- package/dist/mcp/index.d.ts +10 -1
- package/dist/mcp/index.js +187 -19
- package/dist/mcp/server.js +32 -11
- package/dist/mcp/tools/agents.js +519 -50
- package/dist/mcp/tools/budget-groups.js +3 -3
- package/dist/mcp/tools/cost-report.d.ts +8 -0
- package/dist/mcp/tools/cost-report.js +60 -0
- package/dist/mcp/tools/datastore.js +22 -15
- package/dist/mcp/tools/grants.d.ts +2 -0
- package/dist/mcp/tools/grants.js +239 -0
- package/dist/mcp/tools/help.d.ts +5 -0
- package/dist/mcp/tools/help.js +67 -0
- package/dist/mcp/tools/host-accounts.d.ts +2 -0
- package/dist/mcp/tools/host-accounts.js +114 -0
- package/dist/mcp/tools/issue-projects.d.ts +2 -0
- package/dist/mcp/tools/issue-projects.js +238 -0
- package/dist/mcp/tools/memory.d.ts +7 -1
- package/dist/mcp/tools/memory.js +5 -5
- package/dist/mcp/tools/model-catalog.d.ts +22 -0
- package/dist/mcp/tools/model-catalog.js +423 -0
- package/dist/mcp/tools/repositories.d.ts +2 -0
- package/dist/mcp/tools/repositories.js +182 -0
- package/dist/mcp/tools/runs.d.ts +6 -0
- package/dist/mcp/tools/runs.js +60 -6
- package/dist/mcp/tools/scheduling.js +3 -6
- package/dist/mcp/tools/secrets.js +18 -6
- package/dist/mcp/tools/services.d.ts +2 -0
- package/dist/mcp/tools/services.js +222 -0
- package/dist/mcp/tools/subagents.js +52 -16
- package/dist/mcp/tools/tools.d.ts +41 -0
- package/dist/mcp/tools/tools.js +201 -40
- package/dist/mcp/tools/trigger.js +65 -7
- package/dist/mcp/tools/webhooks.js +15 -4
- package/dist/mcp/transport/streamable-http.d.ts +15 -0
- package/dist/mcp/transport/streamable-http.js +55 -3
- package/dist/mcp/webhooks/ingress.d.ts +2 -1
- package/dist/mcp/webhooks/ingress.js +9 -2
- package/dist/providers/auth/delegating.d.ts +19 -0
- package/dist/providers/auth/delegating.js +71 -0
- package/dist/providers/auth/index.d.ts +2 -0
- package/dist/providers/auth/index.js +11 -0
- package/dist/providers/auth/self-hosted.d.ts +10 -2
- package/dist/providers/auth/self-hosted.js +55 -6
- package/dist/providers/auth/types.d.ts +6 -0
- package/dist/providers/coding-proxy/memory-ledger.d.ts +4 -1
- package/dist/providers/coding-proxy/memory-ledger.js +31 -3
- package/dist/providers/coding-proxy/metering.d.ts +6 -1
- package/dist/providers/coding-proxy/metering.js +41 -4
- package/dist/providers/coding-proxy/prisma-ledger.d.ts +17 -0
- package/dist/providers/coding-proxy/prisma-ledger.js +106 -8
- package/dist/providers/coding-proxy/proxy.d.ts +25 -2
- package/dist/providers/coding-proxy/proxy.js +561 -38
- package/dist/providers/coding-proxy/registry/audit.d.ts +131 -0
- package/dist/providers/coding-proxy/registry/audit.js +380 -0
- package/dist/providers/coding-proxy/registry/bounded-fetch.d.ts +16 -0
- package/dist/providers/coding-proxy/registry/bounded-fetch.js +77 -0
- package/dist/providers/coding-proxy/registry/plan.d.ts +58 -0
- package/dist/providers/coding-proxy/registry/plan.js +304 -0
- package/dist/providers/coding-proxy/registry/prisma-store.d.ts +34 -0
- package/dist/providers/coding-proxy/registry/prisma-store.js +151 -0
- package/dist/providers/coding-proxy/registry/service.d.ts +213 -0
- package/dist/providers/coding-proxy/registry/service.js +1137 -0
- package/dist/providers/coding-proxy/registry/store.d.ts +127 -0
- package/dist/providers/coding-proxy/registry/store.js +70 -0
- package/dist/providers/coding-proxy/runtime.d.ts +17 -0
- package/dist/providers/coding-proxy/runtime.js +63 -0
- package/dist/providers/coding-proxy/secure-fetch.js +0 -1
- package/dist/providers/coding-proxy/server.d.ts +11 -0
- package/dist/providers/coding-proxy/server.js +163 -0
- package/dist/providers/coding-proxy/types.d.ts +33 -1
- package/dist/providers/coding-proxy/types.js +12 -1
- package/dist/providers/engine/types.d.ts +29 -0
- package/dist/providers/executor/build.d.ts +2 -2
- package/dist/providers/executor/composition.d.ts +3 -0
- package/dist/providers/executor/composition.js +28 -1
- package/dist/providers/executor/container.d.ts +134 -4
- package/dist/providers/executor/container.js +394 -37
- package/dist/providers/executor/dbos.d.ts +4 -3
- package/dist/providers/executor/dbos.js +7 -5
- package/dist/providers/executor/in-process.d.ts +2 -3
- package/dist/providers/executor/routing.d.ts +13 -0
- package/dist/providers/executor/routing.js +18 -0
- package/dist/providers/executor/types.d.ts +34 -0
- package/dist/providers/issue-tracker/adf.d.ts +31 -0
- package/dist/providers/issue-tracker/adf.js +181 -0
- package/dist/providers/issue-tracker/index.d.ts +5 -0
- package/dist/providers/issue-tracker/index.js +12 -0
- package/dist/providers/issue-tracker/jira-client.d.ts +41 -0
- package/dist/providers/issue-tracker/jira-client.js +151 -0
- package/dist/providers/issue-tracker/jira-events.d.ts +3 -0
- package/dist/providers/issue-tracker/jira-events.js +98 -0
- package/dist/providers/issue-tracker/jira.d.ts +116 -0
- package/dist/providers/issue-tracker/jira.js +502 -0
- package/dist/providers/issue-tracker/types.d.ts +269 -0
- package/dist/providers/issue-tracker/types.js +16 -0
- package/dist/providers/jobs/claude-tool-setup.d.ts +23 -0
- package/dist/providers/jobs/claude-tool-setup.js +50 -0
- package/dist/providers/jobs/collect-prune.d.ts +7 -0
- package/dist/providers/jobs/collect-prune.js +27 -0
- package/dist/providers/jobs/docker-isolation.d.ts +48 -3
- package/dist/providers/jobs/docker-isolation.js +213 -22
- package/dist/providers/jobs/docker-services.d.ts +35 -0
- package/dist/providers/jobs/docker-services.js +191 -0
- package/dist/providers/jobs/docker.d.ts +53 -2
- package/dist/providers/jobs/docker.js +307 -32
- package/dist/providers/jobs/fake-kubernetes-api.d.ts +1 -0
- package/dist/providers/jobs/fake-kubernetes-api.js +12 -3
- package/dist/providers/jobs/kubernetes-isolation.d.ts +17 -2
- package/dist/providers/jobs/kubernetes-isolation.js +238 -57
- package/dist/providers/jobs/kubernetes-platform.d.ts +10 -4
- package/dist/providers/jobs/kubernetes-platform.js +11 -5
- package/dist/providers/jobs/kubernetes-preflight.js +3 -0
- package/dist/providers/jobs/kubernetes.d.ts +24 -2
- package/dist/providers/jobs/kubernetes.js +153 -22
- package/dist/providers/jobs/service-state.d.ts +22 -0
- package/dist/providers/jobs/service-state.js +17 -0
- package/dist/providers/jobs/types.d.ts +18 -0
- package/dist/providers/llm/anthropic.d.ts +3 -3
- package/dist/providers/llm/anthropic.js +3 -5
- package/dist/providers/llm/bedrock.d.ts +3 -3
- package/dist/providers/llm/bedrock.js +3 -8
- package/dist/providers/llm/catalog-lookup.d.ts +10 -0
- package/dist/providers/llm/catalog-lookup.js +15 -0
- package/dist/providers/llm/catalog-shipped.d.ts +18 -0
- package/dist/providers/llm/catalog-shipped.js +197 -0
- package/dist/providers/llm/catalog-store.d.ts +58 -0
- package/dist/providers/llm/catalog-store.js +138 -0
- package/dist/providers/llm/catalog-types.d.ts +66 -0
- package/dist/providers/llm/catalog-types.js +64 -0
- package/dist/providers/llm/catalog.d.ts +61 -0
- package/dist/providers/llm/catalog.js +147 -0
- package/dist/providers/llm/claude-messages.d.ts +5 -1
- package/dist/providers/llm/claude-messages.js +1 -0
- package/dist/providers/llm/claude-provider.d.ts +10 -12
- package/dist/providers/llm/claude-provider.js +15 -6
- package/dist/providers/llm/index.d.ts +9 -6
- package/dist/providers/llm/index.js +8 -5
- package/dist/providers/llm/openai.d.ts +14 -5
- package/dist/providers/llm/openai.js +24 -14
- package/dist/providers/llm/pricing-core.d.ts +5 -3
- package/dist/providers/llm/registration.js +8 -12
- package/dist/providers/llm/routing.d.ts +21 -11
- package/dist/providers/llm/routing.js +47 -13
- package/dist/providers/llm/types.d.ts +12 -0
- package/dist/providers/llm/types.js +8 -1
- package/dist/providers/review-host/diff-lines.d.ts +16 -0
- package/dist/providers/review-host/diff-lines.js +59 -0
- package/dist/providers/review-host/github-events.d.ts +6 -0
- package/dist/providers/review-host/github-events.js +226 -0
- package/dist/providers/review-host/github-user-auth.d.ts +38 -0
- package/dist/providers/review-host/github-user-auth.js +128 -0
- package/dist/providers/review-host/github.d.ts +57 -0
- package/dist/providers/review-host/github.js +568 -0
- package/dist/providers/review-host/index.d.ts +12 -0
- package/dist/providers/review-host/index.js +30 -0
- package/dist/providers/review-host/review-format.d.ts +19 -0
- package/dist/providers/review-host/review-format.js +59 -0
- package/dist/providers/review-host/types.d.ts +309 -0
- package/dist/providers/review-host/types.js +24 -0
- package/dist/providers/vcs/git.d.ts +16 -6
- package/dist/providers/vcs/git.js +78 -34
- package/dist/providers/vcs/github.d.ts +94 -3
- package/dist/providers/vcs/github.js +223 -17
- package/dist/providers/vcs/types.d.ts +48 -4
- package/dist/quickstart/index.d.ts +2 -0
- package/dist/quickstart/index.js +36 -8
- package/dist/sandbox/fetch-policy.d.ts +20 -2
- package/dist/sandbox/fetch-policy.js +64 -3
- package/dist/sandbox/host-functions.d.ts +9 -1
- package/dist/sandbox/host-functions.js +12 -5
- package/dist/serve.js +8 -2
- package/dist/viewer/api-schema.d.ts +2757 -0
- package/dist/viewer/api-schema.js +165 -0
- package/dist/viewer/build-schemas.d.ts +2 -0
- package/dist/viewer/build-schemas.js +18 -0
- package/dist/viewer/event-bus.d.ts +38 -0
- package/dist/viewer/event-bus.js +232 -0
- package/dist/viewer/graph.d.ts +40 -0
- package/dist/viewer/graph.js +243 -0
- package/dist/viewer/http.d.ts +30 -0
- package/dist/viewer/http.js +133 -0
- package/dist/viewer/run-detail.d.ts +4 -0
- package/dist/viewer/run-detail.js +61 -0
- package/dist/wardby-bin.js +11 -0
- package/docs/README.md +40 -0
- package/docs/agent-recipes.md +383 -0
- package/docs/architecture-runtime.md +90 -0
- package/docs/assets/brand/wardby-icon-512.png +0 -0
- package/docs/assets/brand/wardby-icon.svg +16 -0
- package/docs/assets/brand/wardby-mascot-profile-512.png +0 -0
- package/docs/assets/brand/wardby-mascot.png +0 -0
- package/docs/assets/brand/wardby-mascot.svg +5 -0
- package/docs/assets/wardby-workflow.svg +106 -0
- package/docs/code-review-agents.md +508 -0
- package/docs/coding-agent-setup.md +175 -0
- package/docs/coding-packages.md +455 -0
- package/docs/coding-services.md +300 -0
- package/docs/coding-worker-byo-images.md +98 -0
- package/docs/coding-worker-isolation.md +1068 -0
- package/docs/getting-started-gke.md +632 -0
- package/docs/getting-started-identity-provider.md +319 -0
- package/docs/getting-started.md +147 -0
- package/docs/jira-agents.md +649 -0
- package/docs/knowledge.md +387 -0
- package/docs/models.md +221 -0
- package/docs/observability.md +53 -0
- package/docs/release-verification.md +66 -0
- package/docs/security-deployment.md +667 -0
- package/docs/viewer-api.md +142 -0
- package/help/admin-viewer.md +39 -0
- package/help/agent-recipes.md +173 -0
- package/help/architecture-agent.md +189 -0
- package/help/builder-agent.md +80 -0
- package/help/code-review-agents.md +37 -0
- package/help/coding-packages.md +31 -0
- package/help/coding-services.md +71 -0
- package/help/cost-attribution.md +67 -0
- package/help/creating-agents.md +90 -0
- package/help/deploy-gke.md +45 -0
- package/help/deployment-targets.md +39 -0
- package/help/errors/budget-group-exhausted.md +25 -0
- package/help/errors/docker-isolation-unsupported.md +26 -0
- package/help/errors/model-unavailable.md +63 -0
- package/help/errors/protected-path.md +45 -0
- package/help/errors/repo-access.md +27 -0
- package/help/errors/service-declaration-invalid.md +27 -0
- package/help/errors/service-declaration-unavailable.md +25 -0
- package/help/errors/service-launcher-unsupported.md +30 -0
- package/help/errors/service-not-allowed.md +27 -0
- package/help/errors/service-unknown.md +23 -0
- package/help/errors/service-unready.md +49 -0
- package/help/getting-started.md +32 -0
- package/help/github.md +48 -0
- package/help/identity-and-access.md +44 -0
- package/help/jira.md +135 -0
- package/help/knowledge.md +47 -0
- package/help/mcp.md +30 -0
- package/help/models.md +90 -0
- package/help/native-capabilities.md +30 -0
- package/help/observability.md +41 -0
- package/help/operating-agents.md +36 -0
- package/help/security.md +27 -0
- package/help/troubleshooting/budgets.md +32 -0
- package/help/troubleshooting/coding-workers.md +47 -0
- package/help/troubleshooting/repository-access.md +27 -0
- package/package.json +14 -3
- package/prisma/migrations/20260925010000_coding_collect_exclude/migration.sql +8 -0
- package/prisma/migrations/20260925015000_allowed_egress_default/migration.sql +8 -0
- package/prisma/migrations/20260925020000_coding_package_registry/migration.sql +55 -0
- package/prisma/migrations/20260925030000_tool_name_per_owner/migration.sql +11 -0
- package/prisma/migrations/20260926010000_run_trigger_host_event/migration.sql +7 -0
- package/prisma/migrations/20260926020000_code_review_hosts/migration.sql +53 -0
- package/prisma/migrations/20260926030000_auth_user_roles/migration.sql +9 -0
- package/prisma/migrations/20260926040000_agent_effort/migration.sql +6 -0
- package/prisma/migrations/20260926050000_registry_lockfile_plan/migration.sql +32 -0
- package/prisma/migrations/20260926050000_repo_access_authorization/migration.sql +82 -0
- package/prisma/migrations/20260926060000_registry_plan_refusal/migration.sql +19 -0
- package/prisma/migrations/20260926100000_registry_plan_refusal_published_at/migration.sql +5 -0
- package/prisma/migrations/20260926190000_run_host_status/migration.sql +18 -0
- package/prisma/migrations/20260926210000_run_host_status_at_dispatch/migration.sql +5 -0
- package/prisma/migrations/20260927010000_resource_grants/migration.sql +72 -0
- package/prisma/migrations/20260927020000_proxy_session_budget_exhausted/migration.sql +3 -0
- package/prisma/migrations/20260927030000_coding_debug_trace/migration.sql +4 -0
- package/prisma/migrations/20260927040000_proxy_session_upstream_failure/migration.sql +3 -0
- package/prisma/migrations/20260927050000_coding_run_services/migration.sql +74 -0
- package/prisma/migrations/20260928000000_coding_run_tool_image/migration.sql +5 -0
- package/prisma/migrations/20260930000000_jira_issue_projects/migration.sql +34 -0
- package/prisma/migrations/20261001000000_jira_phase2_allowlists/migration.sql +3 -0
- package/prisma/migrations/20261001010000_jira_link_types_allowlist/migration.sql +2 -0
- package/prisma/migrations/20261002000000_jira_coding_bridge/migration.sql +28 -0
- package/prisma/migrations/20261002010000_jira_issue_creation/migration.sql +25 -0
- package/prisma/migrations/20261003000000_issue_cost_attribution/migration.sql +56 -0
- package/prisma/migrations/20261003010000_coding_run_service_status/migration.sql +23 -0
- package/prisma/migrations/20261003020000_viewer_notify/migration.sql +54 -0
- package/prisma/migrations/20261003030000_viewer_notify_fixes/migration.sql +47 -0
- package/prisma/migrations/20261003040000_viewer_indexes/migration.sql +12 -0
- package/prisma/migrations/20261004000000_model_catalog/migration.sql +26 -0
- package/prisma/schema.prisma +663 -21
- package/dist/mcp/tools/models.d.ts +0 -8
- package/dist/mcp/tools/models.js +0 -15
- package/dist/providers/llm/pricing-anthropic.d.ts +0 -4
- package/dist/providers/llm/pricing-anthropic.js +0 -30
- package/dist/providers/llm/pricing-bedrock-claude.d.ts +0 -12
- package/dist/providers/llm/pricing-bedrock-claude.js +0 -37
- package/dist/providers/llm/pricing.d.ts +0 -30
- package/dist/providers/llm/pricing.js +0 -74
package/dist/import/cli-args.js
CHANGED
|
@@ -21,9 +21,10 @@ export function parseImportArgs(args) {
|
|
|
21
21
|
throw new Error("Missing bundle directory positional argument");
|
|
22
22
|
}
|
|
23
23
|
const dir = positionals[0];
|
|
24
|
-
// Parse owner/public
|
|
24
|
+
// Parse owner/public: --public may be combined with --owner (the owner of
|
|
25
|
+
// the imported agents, which --public then shares with everyone).
|
|
25
26
|
const isPublic = values.public ?? false;
|
|
26
|
-
const owner =
|
|
27
|
+
const owner = values.owner ?? null;
|
|
27
28
|
// Validate on-conflict
|
|
28
29
|
const onConflict = (values["on-conflict"] ?? "fail");
|
|
29
30
|
if (!VALID_CONFLICT_POLICIES.includes(onConflict)) {
|
package/dist/import/create.d.ts
CHANGED
|
@@ -11,7 +11,12 @@ import type { SecretCipher } from "../providers/secrets/types.js";
|
|
|
11
11
|
export interface CreateOptions {
|
|
12
12
|
db: PrismaClient;
|
|
13
13
|
cipher: SecretCipher;
|
|
14
|
+
/** Owner of the imported tools, secrets, datastores, webhooks and budget groups; null in --public mode. */
|
|
14
15
|
ownerId: string | null;
|
|
16
|
+
/** Owner of the imported agents (defaults to ownerId): never null for a real import. */
|
|
17
|
+
agentOwnerId?: string | null;
|
|
18
|
+
/** --public: share each imported agent with everyone at execute. */
|
|
19
|
+
publicAgents?: boolean;
|
|
15
20
|
defaultBudget: string;
|
|
16
21
|
secretMode: "references" | "envelope";
|
|
17
22
|
transferPrivateKey?: KeyObject;
|
package/dist/import/create.js
CHANGED
|
@@ -8,12 +8,15 @@ import { createSecret, attachSecret } from "../core/secrets.js";
|
|
|
8
8
|
import { createDatastore, attachDatastore } from "../core/datastores.js";
|
|
9
9
|
import { createWebhook } from "../core/webhooks.js";
|
|
10
10
|
import { deriveJsonSchema } from "../sandbox/zod-params.js";
|
|
11
|
+
import { findSameNamedAttachedTool, reservedToolNameReason } from "../core/tool-names.js";
|
|
11
12
|
import { ToolCapabilitiesPatchSchema, FETCH_WILDCARD } from "../sandbox/tool-capabilities.js";
|
|
12
13
|
import { PostgresDatastore } from "../providers/datastore/postgres.js";
|
|
13
14
|
import { decryptTransferEnvelope } from "../providers/secrets/transfer-envelope.js";
|
|
14
15
|
import { mapBudget } from "./budgets.js";
|
|
16
|
+
import { EVERYONE_KEY, everyoneGrantData } from "../core/grants.js";
|
|
15
17
|
export async function createFromBundle(bundle, recon, opts) {
|
|
16
18
|
const { db, cipher, ownerId, secretMode, transferPrivateKey, allowOpenFetch } = opts;
|
|
19
|
+
const agentOwnerId = opts.agentOwnerId === undefined ? ownerId : opts.agentOwnerId;
|
|
17
20
|
const warnings = [];
|
|
18
21
|
const webhookSecrets = [];
|
|
19
22
|
const pendingSecretReentry = [];
|
|
@@ -37,28 +40,41 @@ export async function createFromBundle(bundle, recon, opts) {
|
|
|
37
40
|
for (const t of bundle.readTools()) {
|
|
38
41
|
if (toolRejected(t.name) || toolSkipped(t.name))
|
|
39
42
|
continue;
|
|
43
|
+
// A built-in dispatched before user tools would shadow it, so the tool
|
|
44
|
+
// could be created but never called (see core/tool-names.ts).
|
|
45
|
+
const reserved = reservedToolNameReason(eff(t.name));
|
|
46
|
+
if (reserved) {
|
|
47
|
+
warnings.push(`tool ${t.name}: skipped — ${reserved}`);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
40
50
|
const schema = await deriveJsonSchema(t.paramsZod);
|
|
41
51
|
if (!schema.ok) {
|
|
42
52
|
warnings.push(`tool ${t.name}: failed to derive JSON schema, skipping`);
|
|
43
53
|
continue;
|
|
44
54
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
// Names are unique per owner: reuse the target owner's own same-named
|
|
56
|
+
// tool (what upsert-by-name used to do), never another owner's. A
|
|
57
|
+
// compound unique with a nullable column can't key an upsert, hence
|
|
58
|
+
// findFirst + create.
|
|
59
|
+
const tool = (await db.tool.findFirst({ where: { ownerId, name: eff(t.name) } })) ??
|
|
60
|
+
(await db.tool.create({
|
|
61
|
+
data: {
|
|
62
|
+
name: eff(t.name),
|
|
63
|
+
description: t.description,
|
|
64
|
+
paramsZod: t.paramsZod,
|
|
65
|
+
code: t.code,
|
|
66
|
+
jsonSchema: schema.value,
|
|
67
|
+
ownerId,
|
|
68
|
+
},
|
|
69
|
+
}));
|
|
57
70
|
toolIdMap.set(t.name, tool.id);
|
|
58
71
|
toolsCreated++;
|
|
59
72
|
}
|
|
60
73
|
// Step 2: Agents
|
|
61
74
|
const agentIdMap = new Map();
|
|
75
|
+
// Agents this import owns (created now, or already the import owner's):
|
|
76
|
+
// only their attachments are stamped with the owner's consent below.
|
|
77
|
+
const ownedAgentIds = new Set();
|
|
62
78
|
for (const a of bundle.readAgents()) {
|
|
63
79
|
if (agentSkipped(a.name))
|
|
64
80
|
continue;
|
|
@@ -74,11 +90,27 @@ export async function createFromBundle(bundle, recon, opts) {
|
|
|
74
90
|
timezone: a.timezone,
|
|
75
91
|
maxTurns: a.maxTurns,
|
|
76
92
|
scheduleEnabled,
|
|
77
|
-
ownerId,
|
|
93
|
+
ownerId: agentOwnerId,
|
|
78
94
|
},
|
|
79
95
|
update: {},
|
|
80
96
|
});
|
|
81
97
|
agentIdMap.set(a.name, agent.id);
|
|
98
|
+
if (agentOwnerId !== null && agent.ownerId === agentOwnerId) {
|
|
99
|
+
ownedAgentIds.add(agent.id);
|
|
100
|
+
if (opts.publicAgents) {
|
|
101
|
+
await db.resourceGrant.upsert({
|
|
102
|
+
where: {
|
|
103
|
+
resourceType_resourceId_granteeKey: {
|
|
104
|
+
resourceType: "agent",
|
|
105
|
+
resourceId: agent.id,
|
|
106
|
+
granteeKey: EVERYONE_KEY,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
create: everyoneGrantData("agent", agent.id, "execute", "import"),
|
|
110
|
+
update: {},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
82
114
|
agentsCreated++;
|
|
83
115
|
}
|
|
84
116
|
// Step 3: Attach tools
|
|
@@ -105,7 +137,26 @@ export async function createFromBundle(bundle, recon, opts) {
|
|
|
105
137
|
warnings.push(`agent-tool ${at.agentName}/${at.toolName}: invalid capabilities, skipping attachment`);
|
|
106
138
|
continue;
|
|
107
139
|
}
|
|
140
|
+
// Same guard as MCP attach_tool: an existing agent reused by name may
|
|
141
|
+
// already hold a different tool under this name (say a public one), and
|
|
142
|
+
// the runtime dispatches by name. Unlike attach_tool this check-then-
|
|
143
|
+
// upsert is not one Serializable transaction: the importer is an
|
|
144
|
+
// operator-only path, so a concurrent attach racing it is not defended
|
|
145
|
+
// against here (the runner's load-time duplicate check still is).
|
|
146
|
+
const clash = await findSameNamedAttachedTool(db, agentId, { id: toolId, name: eff(at.toolName) });
|
|
147
|
+
if (clash) {
|
|
148
|
+
warnings.push(`agent-tool ${at.agentName}/${at.toolName}: skipped — the agent already has a different tool with the same name (${clash.id})`);
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
108
151
|
const caps = capsPatch.data;
|
|
152
|
+
// The importing operator is trusted with the database, so on an agent
|
|
153
|
+
// this import owns it grants the bundle's capabilities in the owner's
|
|
154
|
+
// name (the runner honours them only with that stamp). An existing
|
|
155
|
+
// agent owned by someone else keeps an unstamped, inert attachment.
|
|
156
|
+
const consent = ownedAgentIds.has(agentId) ? agentOwnerId : null;
|
|
157
|
+
if (consent === null) {
|
|
158
|
+
warnings.push(`agent-tool ${at.agentName}/${at.toolName}: attached without capabilities in force — the agent belongs to another owner, who must re-grant them with attach_tool`);
|
|
159
|
+
}
|
|
109
160
|
await db.agentTool.upsert({
|
|
110
161
|
where: { agentId_toolId: { agentId, toolId } },
|
|
111
162
|
create: {
|
|
@@ -115,12 +166,15 @@ export async function createFromBundle(bundle, recon, opts) {
|
|
|
115
166
|
allowedDatastorePrefixes: caps.allowedDatastorePrefixes ?? [],
|
|
116
167
|
allowedHosts: caps.allowedHosts ?? [],
|
|
117
168
|
allowedSharedDatastorePrefixes: caps.allowedSharedDatastorePrefixes ?? {},
|
|
169
|
+
attachedById: agentOwnerId,
|
|
170
|
+
capabilitiesGrantedById: consent,
|
|
118
171
|
},
|
|
119
172
|
update: {
|
|
120
173
|
allowedSecrets: caps.allowedSecrets ?? [],
|
|
121
174
|
allowedDatastorePrefixes: caps.allowedDatastorePrefixes ?? [],
|
|
122
175
|
allowedHosts: caps.allowedHosts ?? [],
|
|
123
176
|
allowedSharedDatastorePrefixes: caps.allowedSharedDatastorePrefixes ?? {},
|
|
177
|
+
capabilitiesGrantedById: consent,
|
|
124
178
|
},
|
|
125
179
|
});
|
|
126
180
|
}
|
package/dist/import/index.js
CHANGED
|
@@ -10,19 +10,19 @@ import { supportedGlobalsFromPrelude } from "./tool-scan.js";
|
|
|
10
10
|
import { SANDBOX_PRELUDE } from "../sandbox/prelude.js";
|
|
11
11
|
import { resolveLlmRegistrations } from "../providers/llm/registration.js";
|
|
12
12
|
import { RoutingLlmProvider } from "../providers/llm/routing.js";
|
|
13
|
-
import { loadProviderConfig } from "../config/providers.js";
|
|
13
|
+
import { loadMcpConfig, loadProviderConfig } from "../config/providers.js";
|
|
14
14
|
import { buildSecretCipher } from "../providers/secrets/index.js";
|
|
15
15
|
import { resolvePrincipal } from "../mcp/auth/principal.js";
|
|
16
16
|
import { loadTransferPrivateKey, transferKeyIdOf } from "../providers/secrets/transfer-envelope.js";
|
|
17
17
|
import { readFileSync } from "node:fs";
|
|
18
18
|
export async function runImport(opts) {
|
|
19
19
|
const env = opts.env ?? process.env;
|
|
20
|
-
// Guard: owner
|
|
20
|
+
// Guard: --owner or --public (or both). --public no longer means
|
|
21
|
+
// owner-less: the imported agents are owned by --owner, or by the
|
|
22
|
+
// importing operator (LOCAL_PRINCIPAL), and shared with everyone at
|
|
23
|
+
// execute (resource-sharing grants spec §3.8).
|
|
21
24
|
if (opts.owner === null && !opts.isPublic) {
|
|
22
|
-
throw new Error("Must specify
|
|
23
|
-
}
|
|
24
|
-
if (opts.owner !== null && opts.isPublic) {
|
|
25
|
-
throw new Error("Cannot specify both --owner and --public");
|
|
25
|
+
throw new Error("Must specify --owner, --public, or both");
|
|
26
26
|
}
|
|
27
27
|
// Open bundle
|
|
28
28
|
const bundle = openBundle(opts.dir);
|
|
@@ -36,10 +36,13 @@ export async function runImport(opts) {
|
|
|
36
36
|
// Load existing names from db
|
|
37
37
|
const existingAgents = await opts.db.agent.findMany({ select: { name: true } });
|
|
38
38
|
const existingAgentNames = new Set(existingAgents.map((a) => a.name));
|
|
39
|
-
|
|
40
|
-
const existingToolNames = new Set(existingTools.map((t) => t.name));
|
|
41
|
-
// For owner-scoped entities (secrets, budgets), load only if we have an owner
|
|
39
|
+
// For owner-scoped entities (tools, secrets, budgets), load only if we have an owner
|
|
42
40
|
const ownerId = opts.owner !== null && !opts.isPublic ? (await resolvePrincipal(opts.owner, opts.db)).id : null;
|
|
41
|
+
// Tool names are unique per owner (null = the public namespace), so only
|
|
42
|
+
// the target owner's tools can collide; another owner's same-named tool
|
|
43
|
+
// is no conflict.
|
|
44
|
+
const existingTools = await opts.db.tool.findMany({ where: { ownerId }, select: { name: true } });
|
|
45
|
+
const existingToolNames = new Set(existingTools.map((t) => t.name));
|
|
43
46
|
// Tier-1 capabilities: "budgets" and "shared-datastores" are implemented
|
|
44
47
|
const capabilitiesSupported = new Set(["budgets", "shared-datastores"]);
|
|
45
48
|
// Run preflight reconciliation
|
|
@@ -84,11 +87,18 @@ export async function runImport(opts) {
|
|
|
84
87
|
// Build secret cipher
|
|
85
88
|
const providerConfig = loadProviderConfig(env);
|
|
86
89
|
const cipher = buildSecretCipher(providerConfig, env);
|
|
90
|
+
// The imported agents' owner: --owner, or in --public mode the importing
|
|
91
|
+
// operator. Resolved only for a real import (never on --dry-run).
|
|
92
|
+
const agentOwnerId = opts.isPublic
|
|
93
|
+
? (await resolvePrincipal(opts.owner ?? loadMcpConfig(env).localPrincipal, opts.db)).id
|
|
94
|
+
: ownerId;
|
|
87
95
|
// Run create
|
|
88
96
|
const result = await createFromBundle(bundle, recon, {
|
|
89
97
|
db: opts.db,
|
|
90
98
|
cipher,
|
|
91
99
|
ownerId,
|
|
100
|
+
agentOwnerId,
|
|
101
|
+
publicAgents: opts.isPublic,
|
|
92
102
|
defaultBudget: opts.defaultBudget ?? "10.00",
|
|
93
103
|
secretMode: effectiveSecretMode,
|
|
94
104
|
transferPrivateKey,
|
|
@@ -8,15 +8,15 @@ export declare const CiphertextSchema: z.ZodObject<{
|
|
|
8
8
|
tag: z.ZodString;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
10
|
tag: string;
|
|
11
|
-
v: number;
|
|
12
11
|
alg: string;
|
|
12
|
+
v: number;
|
|
13
13
|
epk: string;
|
|
14
14
|
nonce: string;
|
|
15
15
|
ct: string;
|
|
16
16
|
}, {
|
|
17
17
|
tag: string;
|
|
18
|
-
v: number;
|
|
19
18
|
alg: string;
|
|
19
|
+
v: number;
|
|
20
20
|
epk: string;
|
|
21
21
|
nonce: string;
|
|
22
22
|
ct: string;
|
|
@@ -46,13 +46,13 @@ export declare const ManifestSchema: z.ZodObject<{
|
|
|
46
46
|
capabilities: z.ZodArray<z.ZodString, "many">;
|
|
47
47
|
counts: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
48
48
|
}, "strip", z.ZodTypeAny, {
|
|
49
|
-
capabilities: string[];
|
|
50
|
-
bundleVersion: number;
|
|
51
49
|
source: {
|
|
52
50
|
product: string;
|
|
53
51
|
exporterVersion: string;
|
|
54
52
|
exportedAt: string;
|
|
55
53
|
};
|
|
54
|
+
capabilities: string[];
|
|
55
|
+
bundleVersion: number;
|
|
56
56
|
secretMode: "references" | "envelope";
|
|
57
57
|
transferKeyId: string | null;
|
|
58
58
|
contentWindowDays: number | null;
|
|
@@ -62,13 +62,13 @@ export declare const ManifestSchema: z.ZodObject<{
|
|
|
62
62
|
runAuditSince: string | null;
|
|
63
63
|
counts: Record<string, number>;
|
|
64
64
|
}, {
|
|
65
|
-
capabilities: string[];
|
|
66
|
-
bundleVersion: number;
|
|
67
65
|
source: {
|
|
68
66
|
product: string;
|
|
69
67
|
exporterVersion: string;
|
|
70
68
|
exportedAt: string;
|
|
71
69
|
};
|
|
70
|
+
capabilities: string[];
|
|
71
|
+
bundleVersion: number;
|
|
72
72
|
secretMode: "references" | "envelope";
|
|
73
73
|
counts: Record<string, number>;
|
|
74
74
|
transferKeyId?: string | null | undefined;
|
|
@@ -110,14 +110,14 @@ export declare const NeutralAgentSchema: z.ZodObject<{
|
|
|
110
110
|
name: string;
|
|
111
111
|
model: string;
|
|
112
112
|
budgetUsd: string;
|
|
113
|
-
|
|
113
|
+
provider: "openai" | "bedrock";
|
|
114
114
|
kind: "native";
|
|
115
|
+
systemPrompt: string;
|
|
115
116
|
schedule: string | null;
|
|
116
117
|
timezone: string;
|
|
117
118
|
scheduleEnabled: boolean;
|
|
118
119
|
maxTurns: number;
|
|
119
120
|
memoryEnabled: boolean;
|
|
120
|
-
provider: "openai" | "bedrock";
|
|
121
121
|
region: string | null;
|
|
122
122
|
ownerEmail: string | null;
|
|
123
123
|
unmodeled: {
|
|
@@ -129,10 +129,10 @@ export declare const NeutralAgentSchema: z.ZodObject<{
|
|
|
129
129
|
name: string;
|
|
130
130
|
model: string;
|
|
131
131
|
budgetUsd: string;
|
|
132
|
+
provider: "openai" | "bedrock";
|
|
132
133
|
systemPrompt: string;
|
|
133
134
|
scheduleEnabled: boolean;
|
|
134
135
|
maxTurns: number;
|
|
135
|
-
provider: "openai" | "bedrock";
|
|
136
136
|
kind?: "native" | undefined;
|
|
137
137
|
schedule?: string | null | undefined;
|
|
138
138
|
timezone?: string | undefined;
|
|
@@ -208,15 +208,15 @@ export declare const NeutralSecretSchema: z.ZodObject<{
|
|
|
208
208
|
tag: z.ZodString;
|
|
209
209
|
}, "strip", z.ZodTypeAny, {
|
|
210
210
|
tag: string;
|
|
211
|
-
v: number;
|
|
212
211
|
alg: string;
|
|
212
|
+
v: number;
|
|
213
213
|
epk: string;
|
|
214
214
|
nonce: string;
|
|
215
215
|
ct: string;
|
|
216
216
|
}, {
|
|
217
217
|
tag: string;
|
|
218
|
-
v: number;
|
|
219
218
|
alg: string;
|
|
219
|
+
v: number;
|
|
220
220
|
epk: string;
|
|
221
221
|
nonce: string;
|
|
222
222
|
ct: string;
|
|
@@ -227,23 +227,23 @@ export declare const NeutralSecretSchema: z.ZodObject<{
|
|
|
227
227
|
ownerEmail: string | null;
|
|
228
228
|
ciphertext?: {
|
|
229
229
|
tag: string;
|
|
230
|
-
v: number;
|
|
231
230
|
alg: string;
|
|
231
|
+
v: number;
|
|
232
232
|
epk: string;
|
|
233
233
|
nonce: string;
|
|
234
234
|
ct: string;
|
|
235
235
|
} | undefined;
|
|
236
236
|
}, {
|
|
237
237
|
name: string;
|
|
238
|
+
description?: string | null | undefined;
|
|
238
239
|
ciphertext?: {
|
|
239
240
|
tag: string;
|
|
240
|
-
v: number;
|
|
241
241
|
alg: string;
|
|
242
|
+
v: number;
|
|
242
243
|
epk: string;
|
|
243
244
|
nonce: string;
|
|
244
245
|
ct: string;
|
|
245
246
|
} | undefined;
|
|
246
|
-
description?: string | null | undefined;
|
|
247
247
|
ownerEmail?: string | null | undefined;
|
|
248
248
|
}>;
|
|
249
249
|
export type NeutralSecret = z.infer<typeof NeutralSecretSchema>;
|
|
@@ -331,11 +331,11 @@ export declare const NeutralWebhookSchema: z.ZodObject<{
|
|
|
331
331
|
agentName: z.ZodString;
|
|
332
332
|
enabled: z.ZodBoolean;
|
|
333
333
|
}, "strip", z.ZodTypeAny, {
|
|
334
|
-
agentName: string;
|
|
335
334
|
enabled: boolean;
|
|
336
|
-
}, {
|
|
337
335
|
agentName: string;
|
|
336
|
+
}, {
|
|
338
337
|
enabled: boolean;
|
|
338
|
+
agentName: string;
|
|
339
339
|
}>;
|
|
340
340
|
export type NeutralWebhook = z.infer<typeof NeutralWebhookSchema>;
|
|
341
341
|
export declare const NeutralBudgetSchema: z.ZodObject<{
|
|
@@ -349,8 +349,8 @@ export declare const NeutralBudgetSchema: z.ZodObject<{
|
|
|
349
349
|
attachedAgentNames: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
350
350
|
}, "strip", z.ZodTypeAny, {
|
|
351
351
|
name: string;
|
|
352
|
-
period: "daily" | "weekly" | "monthly";
|
|
353
352
|
enabled: boolean;
|
|
353
|
+
period: "daily" | "weekly" | "monthly";
|
|
354
354
|
ownerEmail: string | null;
|
|
355
355
|
attachedAgentNames: string[];
|
|
356
356
|
alertThreshold: string;
|
|
@@ -358,8 +358,8 @@ export declare const NeutralBudgetSchema: z.ZodObject<{
|
|
|
358
358
|
alertEmails: string[];
|
|
359
359
|
}, {
|
|
360
360
|
name: string;
|
|
361
|
-
period: "daily" | "weekly" | "monthly";
|
|
362
361
|
enabled: boolean;
|
|
362
|
+
period: "daily" | "weekly" | "monthly";
|
|
363
363
|
alertThreshold: string;
|
|
364
364
|
blockThreshold: string;
|
|
365
365
|
ownerEmail?: string | null | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type CheckSeverity = "error" | "warning";
|
|
2
|
+
export type CheckCode = "concept_invalid" | "concept_secret" | "index_missing" | "index_link_broken" | "concept_not_indexed" | "citation_unverifiable" | "citation_stale";
|
|
3
|
+
export interface CheckIssue {
|
|
4
|
+
severity: CheckSeverity;
|
|
5
|
+
code: CheckCode;
|
|
6
|
+
file: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BundleFiles {
|
|
10
|
+
files: Map<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export type RepoFileReader = (repoRelativePath: string) => string | null;
|
|
13
|
+
export declare function checkBundle(bundle: BundleFiles, readRepoFile: RepoFileReader): CheckIssue[];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { redactTokenShapedValues } from "../coding/protocol.js";
|
|
2
|
+
import { parseConcept, RESERVED_BUNDLE_FILES } from "./concept.js";
|
|
3
|
+
import { spanHash } from "./span-hash.js";
|
|
4
|
+
const LINK = /\]\(([^)#\s]+\.md)(?:#[^)\s]*)?\)/g;
|
|
5
|
+
const URL_SCHEME = /^[a-z][a-z0-9+.-]*:/i;
|
|
6
|
+
const baseName = (path) => path.split("/").pop() ?? path;
|
|
7
|
+
function dirOf(path) {
|
|
8
|
+
const cut = path.lastIndexOf("/");
|
|
9
|
+
return cut < 0 ? "" : path.slice(0, cut + 1);
|
|
10
|
+
}
|
|
11
|
+
function normalize(path) {
|
|
12
|
+
const parts = [];
|
|
13
|
+
for (const part of path.split("/")) {
|
|
14
|
+
if (part === "..")
|
|
15
|
+
parts.pop();
|
|
16
|
+
else if (part !== "." && part !== "")
|
|
17
|
+
parts.push(part);
|
|
18
|
+
}
|
|
19
|
+
return parts.join("/");
|
|
20
|
+
}
|
|
21
|
+
export function checkBundle(bundle, readRepoFile) {
|
|
22
|
+
const issues = [];
|
|
23
|
+
const add = (severity, code, file, message) => issues.push({ severity, code, file, message });
|
|
24
|
+
if (!bundle.files.has("index.md"))
|
|
25
|
+
add("error", "index_missing", "index.md", "the bundle has no root index.md");
|
|
26
|
+
const linked = new Set();
|
|
27
|
+
for (const [path, text] of bundle.files) {
|
|
28
|
+
if (redactTokenShapedValues(text) !== text)
|
|
29
|
+
add("error", "concept_secret", path, "contains a secret-shaped value");
|
|
30
|
+
if (baseName(path) !== "index.md")
|
|
31
|
+
continue;
|
|
32
|
+
for (const match of text.matchAll(LINK)) {
|
|
33
|
+
if (URL_SCHEME.test(match[1]))
|
|
34
|
+
continue;
|
|
35
|
+
const target = normalize(match[1].startsWith("/") ? match[1].slice(1) : dirOf(path) + match[1]);
|
|
36
|
+
linked.add(target);
|
|
37
|
+
if (!bundle.files.has(target))
|
|
38
|
+
add("error", "index_link_broken", path, `links to missing ${target}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const fileCache = new Map();
|
|
42
|
+
const read = (p) => {
|
|
43
|
+
if (!fileCache.has(p))
|
|
44
|
+
fileCache.set(p, readRepoFile(p));
|
|
45
|
+
return fileCache.get(p) ?? null;
|
|
46
|
+
};
|
|
47
|
+
for (const [path, text] of bundle.files) {
|
|
48
|
+
const base = path.split("/").pop() ?? path;
|
|
49
|
+
if (!path.endsWith(".md") || RESERVED_BUNDLE_FILES.has(base))
|
|
50
|
+
continue;
|
|
51
|
+
const parsed = parseConcept(path, text);
|
|
52
|
+
if (!parsed.ok) {
|
|
53
|
+
add("error", "concept_invalid", path, parsed.error);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (!linked.has(path))
|
|
57
|
+
add("warning", "concept_not_indexed", path, "not linked from an index.md");
|
|
58
|
+
for (const citation of parsed.concept.citations) {
|
|
59
|
+
const where = `${citation.path}${citation.lines ? `#L${citation.lines[0]}-L${citation.lines[1]}` : ""}`;
|
|
60
|
+
const source = read(citation.path);
|
|
61
|
+
const actual = source === null ? null : spanHash(source, citation.lines);
|
|
62
|
+
if (actual === null)
|
|
63
|
+
add("warning", "citation_unverifiable", path, `${where} is missing or out of range`);
|
|
64
|
+
else if (actual !== citation.spanHash)
|
|
65
|
+
add("warning", "citation_stale", path, `${where} changed since it was cited`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return issues;
|
|
69
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function parseKnowledgeArgs(args: string[]): {
|
|
2
|
+
dir: string;
|
|
3
|
+
root: string;
|
|
4
|
+
strict: boolean;
|
|
5
|
+
json: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Every `.md` file under `dir`, keyed by bundle-relative POSIX path. Entry
|
|
9
|
+
* types come from the directory listing itself (no separate stat, so nothing
|
|
10
|
+
* can change between the check and the read), and symbolic links are skipped:
|
|
11
|
+
* a bundle is plain files, and following links could loop or leave the bundle.
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadBundle(dir: string): Map<string, string>;
|
|
14
|
+
export declare function knowledgeCommand(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { parseArgs } from "node:util";
|
|
4
|
+
import { checkBundle } from "./check.js";
|
|
5
|
+
import { DEFAULT_KNOWLEDGE_BUNDLE_PATH } from "./concept.js";
|
|
6
|
+
const USAGE = "usage: wardby knowledge check [dir] [--root <repo root>] [--strict] [--json]";
|
|
7
|
+
export function parseKnowledgeArgs(args) {
|
|
8
|
+
const [sub, ...rest] = args;
|
|
9
|
+
if (sub !== "check")
|
|
10
|
+
throw new Error(USAGE);
|
|
11
|
+
const { values, positionals } = parseArgs({
|
|
12
|
+
args: rest,
|
|
13
|
+
allowPositionals: true,
|
|
14
|
+
options: { root: { type: "string" }, strict: { type: "boolean" }, json: { type: "boolean" } },
|
|
15
|
+
});
|
|
16
|
+
if (positionals.length > 1)
|
|
17
|
+
throw new Error(USAGE);
|
|
18
|
+
return {
|
|
19
|
+
dir: positionals[0] ?? DEFAULT_KNOWLEDGE_BUNDLE_PATH,
|
|
20
|
+
root: values.root ?? ".",
|
|
21
|
+
strict: values.strict ?? false,
|
|
22
|
+
json: values.json ?? false,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Every `.md` file under `dir`, keyed by bundle-relative POSIX path. Entry
|
|
27
|
+
* types come from the directory listing itself (no separate stat, so nothing
|
|
28
|
+
* can change between the check and the read), and symbolic links are skipped:
|
|
29
|
+
* a bundle is plain files, and following links could loop or leave the bundle.
|
|
30
|
+
*/
|
|
31
|
+
export function loadBundle(dir) {
|
|
32
|
+
const files = new Map();
|
|
33
|
+
const walk = (current) => {
|
|
34
|
+
for (const entry of readdirSync(current, { withFileTypes: true })) {
|
|
35
|
+
const full = join(current, entry.name);
|
|
36
|
+
if (entry.isDirectory())
|
|
37
|
+
walk(full);
|
|
38
|
+
else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
39
|
+
files.set(relative(dir, full).split(sep).join("/"), readFileSync(full, "utf8"));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
walk(dir);
|
|
44
|
+
return files;
|
|
45
|
+
}
|
|
46
|
+
export async function knowledgeCommand(args) {
|
|
47
|
+
const options = parseKnowledgeArgs(args);
|
|
48
|
+
const root = resolve(options.root);
|
|
49
|
+
const files = loadBundle(resolve(root, options.dir));
|
|
50
|
+
const issues = checkBundle({ files }, (path) => {
|
|
51
|
+
try {
|
|
52
|
+
return readFileSync(join(root, path), "utf8");
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
if (options.json)
|
|
59
|
+
process.stdout.write(`${JSON.stringify({ issues }, null, 2)}\n`);
|
|
60
|
+
else {
|
|
61
|
+
for (const issue of issues)
|
|
62
|
+
process.stdout.write(`${issue.severity} ${issue.code} ${options.dir}/${issue.file}: ${issue.message}\n`);
|
|
63
|
+
process.stdout.write(`${files.size} files checked, ${issues.filter((i) => i.severity === "error").length} errors, ${issues.filter((i) => i.severity === "warning").length} warnings\n`);
|
|
64
|
+
}
|
|
65
|
+
if (issues.some((i) => i.severity === "error" || (options.strict && i.severity === "warning")))
|
|
66
|
+
process.exitCode = 1;
|
|
67
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const DEFAULT_KNOWLEDGE_BUNDLE_PATH = "docs/knowledge";
|
|
3
|
+
export declare const RESERVED_BUNDLE_FILES: Set<string>;
|
|
4
|
+
declare const CitationSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
repo: z.ZodString;
|
|
7
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
8
|
+
lines: z.ZodOptional<z.ZodEffects<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, [number, number], [number, number]>>;
|
|
9
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
10
|
+
sha: z.ZodString;
|
|
11
|
+
spanHash: z.ZodString;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
path: string;
|
|
14
|
+
repo: string;
|
|
15
|
+
sha: string;
|
|
16
|
+
spanHash: string;
|
|
17
|
+
symbol?: string | undefined;
|
|
18
|
+
id?: string | undefined;
|
|
19
|
+
lines?: [number, number] | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
path: string;
|
|
22
|
+
repo: string;
|
|
23
|
+
sha: string;
|
|
24
|
+
spanHash: string;
|
|
25
|
+
symbol?: string | undefined;
|
|
26
|
+
id?: string | undefined;
|
|
27
|
+
lines?: [number, number] | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export type KnowledgeCitation = z.infer<typeof CitationSchema>;
|
|
30
|
+
export interface ParsedConcept {
|
|
31
|
+
path: string;
|
|
32
|
+
type: string;
|
|
33
|
+
title?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
status: "draft" | "stable" | "deprecated";
|
|
36
|
+
roles: string[];
|
|
37
|
+
affects: string[];
|
|
38
|
+
citations: KnowledgeCitation[];
|
|
39
|
+
body: string;
|
|
40
|
+
frontMatter: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export type ParseResult = {
|
|
43
|
+
ok: true;
|
|
44
|
+
concept: ParsedConcept;
|
|
45
|
+
} | {
|
|
46
|
+
ok: false;
|
|
47
|
+
error: string;
|
|
48
|
+
};
|
|
49
|
+
export declare function splitFrontMatter(text: string): {
|
|
50
|
+
yaml: string;
|
|
51
|
+
body: string;
|
|
52
|
+
} | null;
|
|
53
|
+
export declare function parseConcept(path: string, text: string): ParseResult;
|
|
54
|
+
export {};
|