devworkspace 0.5.1 → 0.5.2
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/CHANGELOG.md +30 -2
- package/README.md +57 -509
- package/dist/agents/claude/adapter.js +0 -1
- package/dist/agents/claude/content.js +0 -1
- package/dist/agents/codex/adapter.js +0 -1
- package/dist/agents/copilot/adapter.js +0 -1
- package/dist/agents/cursor/adapter.js +0 -1
- package/dist/agents/index.js +0 -1
- package/dist/agents/shared.js +0 -1
- package/dist/agents/types.js +0 -1
- package/dist/cli/args.d.ts +16 -0
- package/dist/cli/args.js +5 -1
- package/dist/cli/help.js +59 -17
- package/dist/cli/main.js +0 -1
- package/dist/cli/prompt.d.ts +15 -0
- package/dist/cli/prompt.js +113 -0
- package/dist/cli/render.d.ts +10 -0
- package/dist/cli/render.js +174 -4
- package/dist/cli/run.d.ts +3 -0
- package/dist/cli/run.js +366 -17
- package/dist/config/feature-gate.d.ts +15 -0
- package/dist/config/feature-gate.js +77 -0
- package/dist/config/feature-registry.d.ts +49 -0
- package/dist/config/feature-registry.js +451 -0
- package/dist/config/schemas.js +0 -1
- package/dist/config/settings.d.ts +54 -0
- package/dist/config/settings.js +293 -0
- package/dist/config/validate.js +0 -1
- package/dist/core/artifacts.js +0 -1
- package/dist/core/contracts.js +0 -1
- package/dist/core/migrations.js +0 -1
- package/dist/core/version.js +0 -1
- package/dist/core/versioned.js +0 -1
- package/dist/core/workspace.d.ts +1 -0
- package/dist/core/workspace.js +1 -1
- package/dist/decisions/decision.js +0 -1
- package/dist/discovery/cache.js +0 -1
- package/dist/discovery/commands.js +0 -1
- package/dist/discovery/detect.js +0 -1
- package/dist/discovery/docs.js +0 -1
- package/dist/discovery/entrypoints.js +0 -1
- package/dist/discovery/ignore.js +0 -1
- package/dist/discovery/scan.js +0 -1
- package/dist/discovery/types.js +0 -1
- package/dist/dx/dashboard.js +2 -1
- package/dist/dx/guidance.js +0 -1
- package/dist/dx/guided-setup.d.ts +102 -0
- package/dist/dx/guided-setup.js +508 -0
- package/dist/dx/index.js +0 -1
- package/dist/dx/onboarding.js +0 -1
- package/dist/dx/types.js +0 -1
- package/dist/errors/index.js +0 -1
- package/dist/features/schema.js +0 -1
- package/dist/features/types.js +0 -1
- package/dist/features/validate.js +0 -1
- package/dist/git/git.js +0 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.js +10 -2
- package/dist/integrations/adapters/agent-skills.js +0 -1
- package/dist/integrations/adapters/claudePlugin.js +0 -1
- package/dist/integrations/adapters/graphify.js +0 -1
- package/dist/integrations/adapters/omniroute.js +0 -1
- package/dist/integrations/adapters/pluginSkill.js +0 -1
- package/dist/integrations/adapters/ponytail.js +0 -1
- package/dist/integrations/exec.js +0 -1
- package/dist/integrations/index.js +0 -1
- package/dist/integrations/manager.d.ts +2 -1
- package/dist/integrations/manager.js +22 -3
- package/dist/integrations/notices.js +0 -1
- package/dist/integrations/persistentPath.js +0 -1
- package/dist/integrations/protect.js +0 -1
- package/dist/integrations/state.js +0 -1
- package/dist/integrations/types.d.ts +1 -1
- package/dist/integrations/types.js +1 -1
- package/dist/intelligence/agents/profiles.js +0 -1
- package/dist/intelligence/agents/registry.js +0 -1
- package/dist/intelligence/agents/types.js +0 -1
- package/dist/intelligence/observability/tracer.js +0 -1
- package/dist/intelligence/observability/types.js +0 -1
- package/dist/intelligence/orchestration/engine.d.ts +13 -4
- package/dist/intelligence/orchestration/engine.js +332 -54
- package/dist/intelligence/orchestration/lock-manager.js +0 -1
- package/dist/intelligence/orchestration/store.js +0 -1
- package/dist/intelligence/orchestration/types.d.ts +28 -1
- package/dist/intelligence/orchestration/types.js +0 -1
- package/dist/intelligence/routing/matcher.js +0 -1
- package/dist/intelligence/routing/router.js +0 -1
- package/dist/intelligence/routing/types.js +0 -1
- package/dist/intelligence/runtime/adk/adapter.js +1 -2
- package/dist/intelligence/runtime/adk/detector.js +0 -1
- package/dist/intelligence/runtime/auth-provider.d.ts +63 -0
- package/dist/intelligence/runtime/auth-provider.js +201 -0
- package/dist/intelligence/runtime/boundary.d.ts +118 -6
- package/dist/intelligence/runtime/boundary.js +720 -38
- package/dist/intelligence/runtime/changes.d.ts +59 -0
- package/dist/intelligence/runtime/changes.js +362 -0
- package/dist/intelligence/runtime/external.d.ts +1 -0
- package/dist/intelligence/runtime/external.js +9 -6
- package/dist/intelligence/runtime/native.js +0 -1
- package/dist/intelligence/runtime/types.d.ts +64 -2
- package/dist/intelligence/runtime/types.js +0 -1
- package/dist/intelligence/security/audit.js +8 -2
- package/dist/intelligence/security/policy.js +0 -1
- package/dist/intelligence/security/types.d.ts +8 -0
- package/dist/intelligence/security/types.js +0 -1
- package/dist/intelligence/skills/builtins.js +0 -1
- package/dist/intelligence/skills/loader.js +0 -1
- package/dist/intelligence/skills/registry.js +0 -1
- package/dist/intelligence/skills/types.js +0 -1
- package/dist/intelligence/verification/engine.d.ts +10 -2
- package/dist/intelligence/verification/engine.js +53 -9
- package/dist/intelligence/verification/reviewer.d.ts +18 -2
- package/dist/intelligence/verification/reviewer.js +356 -4
- package/dist/intelligence/verification/types.d.ts +60 -0
- package/dist/intelligence/verification/types.js +0 -1
- package/dist/knowledge/facts.js +0 -1
- package/dist/mcp/protocol.js +0 -1
- package/dist/mcp/server.js +38 -2
- package/dist/mcp/setup.js +5 -2
- package/dist/mcp/tools.js +0 -1
- package/dist/mcp/types.js +0 -1
- package/dist/mcp/verify.js +0 -1
- package/dist/portability/bundle.js +0 -1
- package/dist/prompts/onboarding.js +0 -1
- package/dist/prompts/refresh.js +0 -1
- package/dist/prompts/requirements.js +0 -1
- package/dist/security/files.js +0 -1
- package/dist/security/redact.js +0 -1
- package/dist/services/agent.js +2 -1
- package/dist/services/analysis.js +0 -1
- package/dist/services/common.js +0 -1
- package/dist/services/doctor.js +13 -2
- package/dist/services/drift.js +0 -1
- package/dist/services/features.js +5 -1
- package/dist/services/graph.js +4 -1
- package/dist/services/init.js +0 -1
- package/dist/services/integrations.d.ts +2 -1
- package/dist/services/integrations.js +29 -6
- package/dist/services/intelligence.d.ts +2 -2
- package/dist/services/intelligence.js +38 -36
- package/dist/services/knowledge.js +0 -1
- package/dist/services/migrate.js +0 -1
- package/dist/services/modules.d.ts +85 -0
- package/dist/services/modules.js +313 -0
- package/dist/services/portability.js +0 -1
- package/dist/services/records.js +5 -1
- package/dist/services/refresh.js +0 -1
- package/dist/services/reset.js +0 -1
- package/dist/services/settings.d.ts +36 -0
- package/dist/services/settings.js +102 -0
- package/dist/services/setup.d.ts +4 -5
- package/dist/services/setup.js +40 -28
- package/dist/services/standards.js +10 -1
- package/dist/services/status.js +0 -1
- package/dist/services/taskContext.js +0 -1
- package/dist/services/tasks.js +9 -1
- package/dist/services/verify.js +7 -2
- package/dist/sessions/session.js +0 -1
- package/dist/standards/acquisition/ingest.js +0 -1
- package/dist/standards/applicability/engine.js +0 -1
- package/dist/standards/builtin/code-quality.js +0 -1
- package/dist/standards/builtin/database-safety.js +0 -1
- package/dist/standards/builtin/index.js +0 -1
- package/dist/standards/builtin/security-baseline.js +0 -1
- package/dist/standards/builtin/testing-contracts.js +0 -1
- package/dist/standards/builtin/undo-kit.js +0 -1
- package/dist/standards/config/config.js +0 -1
- package/dist/standards/distribution/cache.js +0 -1
- package/dist/standards/distribution/index.js +0 -1
- package/dist/standards/distribution/keys.js +0 -1
- package/dist/standards/distribution/package.js +0 -1
- package/dist/standards/distribution/server.js +0 -1
- package/dist/standards/distribution/sync.js +0 -1
- package/dist/standards/distribution/types.js +0 -1
- package/dist/standards/engine/compliance.js +0 -1
- package/dist/standards/engine/engine.js +0 -1
- package/dist/standards/engine/reporter.js +0 -1
- package/dist/standards/index.js +0 -1
- package/dist/standards/registry/registry.js +0 -1
- package/dist/standards/schema/types.js +0 -1
- package/dist/standards/schema/validate.js +0 -1
- package/dist/standards/templates/index.js +0 -1
- package/dist/standards/validators/database.js +0 -1
- package/dist/standards/validators/quality.js +0 -1
- package/dist/standards/validators/registry.js +0 -1
- package/dist/standards/validators/security.js +0 -1
- package/dist/standards/validators/testing.js +0 -1
- package/dist/standards/validators/types.js +0 -1
- package/dist/standards/validators/undo-kit.js +0 -1
- package/dist/tasks/routing.js +0 -1
- package/dist/tasks/task.js +0 -1
- package/dist/utils/cleanup.js +0 -1
- package/dist/utils/fs.js +0 -1
- package/dist/utils/lock.js +92 -49
- package/dist/utils/logger.js +0 -1
- package/dist/utils/paths.js +0 -1
- package/dist/utils/proc.d.ts +8 -0
- package/dist/utils/proc.js +54 -46
- package/dist/verification/safety.js +0 -1
- package/dist/verification/scope.js +0 -1
- package/docs/architecture/global-standards-architecture.md +287 -0
- package/docs/archive/global-standards/GLOBAL_STANDARDS_AUDIT.md +99 -0
- package/docs/archive/global-standards/GLOBAL_STANDARDS_FINAL_STATUS.md +138 -0
- package/docs/archive/global-standards/GLOBAL_STANDARDS_IMPLEMENTATION_PLAN.md +100 -0
- package/docs/archive/global-standards/GLOBAL_STANDARDS_INDEPENDENT_AUDIT.md +219 -0
- package/docs/archive/global-standards/GLOBAL_STANDARDS_SECURITY_REPORT.md +184 -0
- package/docs/configuration.md +67 -0
- package/docs/contributing.md +15 -4
- package/docs/development/EXECUTION_STATE.md +50 -0
- package/docs/features.md +80 -0
- package/docs/getting-started.md +69 -111
- package/docs/guides/global-standards-migration.md +100 -0
- package/docs/integrations.md +7 -0
- package/docs/security/THIRD_PARTY_LICENSES.md +41 -0
- package/docs/testing/FINAL_CORRECTION_AND_CLEANUP_REPORT.md +92 -0
- package/docs/testing/global-standards-real-project-tests.md +218 -0
- package/docs/testing/global-standards-test-report.md +89 -0
- package/docs/testing/global-standards-verification-matrix.md +174 -0
- package/docs/troubleshooting.md +3 -0
- package/package.json +1 -1
- package/dist/agents/claude/adapter.js.map +0 -1
- package/dist/agents/claude/content.js.map +0 -1
- package/dist/agents/codex/adapter.js.map +0 -1
- package/dist/agents/copilot/adapter.js.map +0 -1
- package/dist/agents/cursor/adapter.js.map +0 -1
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/shared.js.map +0 -1
- package/dist/agents/types.js.map +0 -1
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/main.js.map +0 -1
- package/dist/cli/render.js.map +0 -1
- package/dist/cli/run.js.map +0 -1
- package/dist/config/schemas.js.map +0 -1
- package/dist/config/validate.js.map +0 -1
- package/dist/core/artifacts.js.map +0 -1
- package/dist/core/contracts.js.map +0 -1
- package/dist/core/migrations.js.map +0 -1
- package/dist/core/version.js.map +0 -1
- package/dist/core/versioned.js.map +0 -1
- package/dist/core/workspace.js.map +0 -1
- package/dist/decisions/decision.js.map +0 -1
- package/dist/discovery/cache.js.map +0 -1
- package/dist/discovery/commands.js.map +0 -1
- package/dist/discovery/detect.js.map +0 -1
- package/dist/discovery/docs.js.map +0 -1
- package/dist/discovery/entrypoints.js.map +0 -1
- package/dist/discovery/ignore.js.map +0 -1
- package/dist/discovery/scan.js.map +0 -1
- package/dist/discovery/types.js.map +0 -1
- package/dist/dx/dashboard.js.map +0 -1
- package/dist/dx/guidance.js.map +0 -1
- package/dist/dx/index.js.map +0 -1
- package/dist/dx/onboarding.js.map +0 -1
- package/dist/dx/types.js.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/features/schema.js.map +0 -1
- package/dist/features/types.js.map +0 -1
- package/dist/features/validate.js.map +0 -1
- package/dist/git/git.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integrations/adapters/agent-skills.js.map +0 -1
- package/dist/integrations/adapters/claudePlugin.js.map +0 -1
- package/dist/integrations/adapters/graphify.js.map +0 -1
- package/dist/integrations/adapters/omniroute.js.map +0 -1
- package/dist/integrations/adapters/pluginSkill.js.map +0 -1
- package/dist/integrations/adapters/ponytail.js.map +0 -1
- package/dist/integrations/exec.js.map +0 -1
- package/dist/integrations/index.js.map +0 -1
- package/dist/integrations/manager.js.map +0 -1
- package/dist/integrations/notices.js.map +0 -1
- package/dist/integrations/persistentPath.js.map +0 -1
- package/dist/integrations/protect.js.map +0 -1
- package/dist/integrations/state.js.map +0 -1
- package/dist/integrations/types.js.map +0 -1
- package/dist/intelligence/agents/profiles.js.map +0 -1
- package/dist/intelligence/agents/registry.js.map +0 -1
- package/dist/intelligence/agents/types.js.map +0 -1
- package/dist/intelligence/observability/tracer.js.map +0 -1
- package/dist/intelligence/observability/types.js.map +0 -1
- package/dist/intelligence/orchestration/engine.js.map +0 -1
- package/dist/intelligence/orchestration/lock-manager.js.map +0 -1
- package/dist/intelligence/orchestration/store.js.map +0 -1
- package/dist/intelligence/orchestration/types.js.map +0 -1
- package/dist/intelligence/routing/matcher.js.map +0 -1
- package/dist/intelligence/routing/router.js.map +0 -1
- package/dist/intelligence/routing/types.js.map +0 -1
- package/dist/intelligence/runtime/adk/adapter.js.map +0 -1
- package/dist/intelligence/runtime/adk/detector.js.map +0 -1
- package/dist/intelligence/runtime/boundary.js.map +0 -1
- package/dist/intelligence/runtime/external.js.map +0 -1
- package/dist/intelligence/runtime/native.js.map +0 -1
- package/dist/intelligence/runtime/types.js.map +0 -1
- package/dist/intelligence/security/audit.js.map +0 -1
- package/dist/intelligence/security/policy.js.map +0 -1
- package/dist/intelligence/security/types.js.map +0 -1
- package/dist/intelligence/skills/builtins.js.map +0 -1
- package/dist/intelligence/skills/loader.js.map +0 -1
- package/dist/intelligence/skills/registry.js.map +0 -1
- package/dist/intelligence/skills/types.js.map +0 -1
- package/dist/intelligence/verification/engine.js.map +0 -1
- package/dist/intelligence/verification/reviewer.js.map +0 -1
- package/dist/intelligence/verification/types.js.map +0 -1
- package/dist/knowledge/facts.js.map +0 -1
- package/dist/mcp/protocol.js.map +0 -1
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/setup.js.map +0 -1
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/types.js.map +0 -1
- package/dist/mcp/verify.js.map +0 -1
- package/dist/portability/bundle.js.map +0 -1
- package/dist/prompts/onboarding.js.map +0 -1
- package/dist/prompts/refresh.js.map +0 -1
- package/dist/prompts/requirements.js.map +0 -1
- package/dist/security/files.js.map +0 -1
- package/dist/security/redact.js.map +0 -1
- package/dist/services/agent.js.map +0 -1
- package/dist/services/analysis.js.map +0 -1
- package/dist/services/common.js.map +0 -1
- package/dist/services/doctor.js.map +0 -1
- package/dist/services/drift.js.map +0 -1
- package/dist/services/features.js.map +0 -1
- package/dist/services/graph.js.map +0 -1
- package/dist/services/init.js.map +0 -1
- package/dist/services/integrations.js.map +0 -1
- package/dist/services/intelligence.js.map +0 -1
- package/dist/services/knowledge.js.map +0 -1
- package/dist/services/migrate.js.map +0 -1
- package/dist/services/portability.js.map +0 -1
- package/dist/services/records.js.map +0 -1
- package/dist/services/refresh.js.map +0 -1
- package/dist/services/reset.js.map +0 -1
- package/dist/services/setup.js.map +0 -1
- package/dist/services/standards.js.map +0 -1
- package/dist/services/status.js.map +0 -1
- package/dist/services/taskContext.js.map +0 -1
- package/dist/services/tasks.js.map +0 -1
- package/dist/services/verify.js.map +0 -1
- package/dist/sessions/session.js.map +0 -1
- package/dist/standards/acquisition/ingest.js.map +0 -1
- package/dist/standards/applicability/engine.js.map +0 -1
- package/dist/standards/builtin/code-quality.js.map +0 -1
- package/dist/standards/builtin/database-safety.js.map +0 -1
- package/dist/standards/builtin/index.js.map +0 -1
- package/dist/standards/builtin/security-baseline.js.map +0 -1
- package/dist/standards/builtin/testing-contracts.js.map +0 -1
- package/dist/standards/builtin/undo-kit.js.map +0 -1
- package/dist/standards/config/config.js.map +0 -1
- package/dist/standards/distribution/cache.js.map +0 -1
- package/dist/standards/distribution/index.js.map +0 -1
- package/dist/standards/distribution/keys.js.map +0 -1
- package/dist/standards/distribution/package.js.map +0 -1
- package/dist/standards/distribution/server.js.map +0 -1
- package/dist/standards/distribution/sync.js.map +0 -1
- package/dist/standards/distribution/types.js.map +0 -1
- package/dist/standards/engine/compliance.js.map +0 -1
- package/dist/standards/engine/engine.js.map +0 -1
- package/dist/standards/engine/reporter.js.map +0 -1
- package/dist/standards/index.js.map +0 -1
- package/dist/standards/registry/registry.js.map +0 -1
- package/dist/standards/schema/types.js.map +0 -1
- package/dist/standards/schema/validate.js.map +0 -1
- package/dist/standards/templates/index.js.map +0 -1
- package/dist/standards/validators/database.js.map +0 -1
- package/dist/standards/validators/quality.js.map +0 -1
- package/dist/standards/validators/registry.js.map +0 -1
- package/dist/standards/validators/security.js.map +0 -1
- package/dist/standards/validators/testing.js.map +0 -1
- package/dist/standards/validators/types.js.map +0 -1
- package/dist/standards/validators/undo-kit.js.map +0 -1
- package/dist/tasks/routing.js.map +0 -1
- package/dist/tasks/task.js.map +0 -1
- package/dist/utils/cleanup.js.map +0 -1
- package/dist/utils/fs.js.map +0 -1
- package/dist/utils/lock.js.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/proc.js.map +0 -1
- package/dist/verification/safety.js.map +0 -1
- package/dist/verification/scope.js.map +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ApprovalAuthProvider, ApprovalGrantProof, ApproverAuthMethod, ApproverCredentials, AuthenticatedApproverSession } from './types.js';
|
|
2
|
+
export type CredentialVerifier = (credentials: ApproverCredentials) => Promise<boolean> | boolean;
|
|
3
|
+
export interface BaseAuthProviderOptions {
|
|
4
|
+
id?: string;
|
|
5
|
+
keyId?: string;
|
|
6
|
+
authMethod?: ApproverAuthMethod;
|
|
7
|
+
issuer?: string;
|
|
8
|
+
principals?: Record<string, string>;
|
|
9
|
+
verifyCredentials?: CredentialVerifier;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Trusted symmetric HMAC-SHA256 authentication and grant signing provider.
|
|
13
|
+
* Requires a secret key of at least 32 bytes and validates credentials against explicit registered principals or verifier callbacks.
|
|
14
|
+
*/
|
|
15
|
+
export declare class HmacApprovalAuthProvider implements ApprovalAuthProvider {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly authMethod: ApproverAuthMethod;
|
|
18
|
+
readonly keyId: string;
|
|
19
|
+
readonly algorithm: "hmac-sha256";
|
|
20
|
+
private readonly issuer;
|
|
21
|
+
private readonly secretKey;
|
|
22
|
+
private readonly principals?;
|
|
23
|
+
private readonly verifyCredentials?;
|
|
24
|
+
constructor(options: BaseAuthProviderOptions & {
|
|
25
|
+
secretKey: string | Buffer;
|
|
26
|
+
});
|
|
27
|
+
authenticate(credentials?: ApproverCredentials): Promise<AuthenticatedApproverSession>;
|
|
28
|
+
signGrant(canonicalPayload: string): Promise<ApprovalGrantProof>;
|
|
29
|
+
verifyGrant(canonicalPayload: string, proof: ApprovalGrantProof): Promise<boolean>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Asymmetric Ed25519 digital signature provider for approval grants.
|
|
33
|
+
* Supports signing when configured with a private key, or verification-only operation when given only a public key.
|
|
34
|
+
*/
|
|
35
|
+
export declare class Ed25519ApprovalAuthProvider implements ApprovalAuthProvider {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly authMethod: ApproverAuthMethod;
|
|
38
|
+
readonly keyId: string;
|
|
39
|
+
readonly algorithm: "ed25519";
|
|
40
|
+
private readonly issuer;
|
|
41
|
+
private readonly publicKey;
|
|
42
|
+
private readonly privateKey?;
|
|
43
|
+
private readonly principals?;
|
|
44
|
+
private readonly verifyCredentials?;
|
|
45
|
+
static generateKeyPair(): {
|
|
46
|
+
publicKeyPem: string;
|
|
47
|
+
privateKeyPem: string;
|
|
48
|
+
};
|
|
49
|
+
constructor(options: BaseAuthProviderOptions & {
|
|
50
|
+
publicKeyPem: string;
|
|
51
|
+
privateKeyPem?: string;
|
|
52
|
+
});
|
|
53
|
+
authenticate(credentials?: ApproverCredentials): Promise<AuthenticatedApproverSession>;
|
|
54
|
+
signGrant(canonicalPayload: string): Promise<ApprovalGrantProof>;
|
|
55
|
+
verifyGrant(canonicalPayload: string, proof: ApprovalGrantProof): Promise<boolean>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Construct an environment-backed HMAC approval provider when explicit key and approver credentials are present.
|
|
59
|
+
* Returns null (fail-closed) when required environment configuration is missing or weak.
|
|
60
|
+
*/
|
|
61
|
+
export declare function createEnvApprovalAuthProvider(env?: NodeJS.ProcessEnv): HmacApprovalAuthProvider | null;
|
|
62
|
+
/** Extract caller credentials from explicit environment variables, or null when absent. */
|
|
63
|
+
export declare function getEnvApproverCredentials(env?: NodeJS.ProcessEnv): ApproverCredentials | null;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import { DevWorkspaceError } from '../../errors/index.js';
|
|
3
|
+
function timingSafeEqualUtf8(a, b) {
|
|
4
|
+
const digestA = crypto.createHash('sha256').update(a, 'utf8').digest();
|
|
5
|
+
const digestB = crypto.createHash('sha256').update(b, 'utf8').digest();
|
|
6
|
+
return crypto.timingSafeEqual(digestA, digestB) && a.length === b.length;
|
|
7
|
+
}
|
|
8
|
+
async function authenticatePrincipal(providerId, authMethod, issuer, credentials, principals, verifyCredentials) {
|
|
9
|
+
if (!credentials || !credentials.principalId || !credentials.principalId.trim()) {
|
|
10
|
+
throw new DevWorkspaceError('SECURITY', `Approver authentication failed (${providerId}): missing principalId.`);
|
|
11
|
+
}
|
|
12
|
+
if (!credentials.token || !credentials.token.trim()) {
|
|
13
|
+
throw new DevWorkspaceError('SECURITY', `Approver authentication failed (${providerId}): missing authentication token.`);
|
|
14
|
+
}
|
|
15
|
+
let authenticated = false;
|
|
16
|
+
if (verifyCredentials) {
|
|
17
|
+
authenticated = Boolean(await verifyCredentials(credentials));
|
|
18
|
+
}
|
|
19
|
+
else if (principals) {
|
|
20
|
+
const hasPrincipal = Object.prototype.hasOwnProperty.call(principals, credentials.principalId);
|
|
21
|
+
const expectedToken = hasPrincipal ? principals[credentials.principalId] : undefined;
|
|
22
|
+
if (expectedToken && expectedToken.length > 0) {
|
|
23
|
+
authenticated = timingSafeEqualUtf8(credentials.token, expectedToken);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
throw new DevWorkspaceError('SECURITY', `Auth provider "${providerId}" has no configured principals or credential verifier.`);
|
|
28
|
+
}
|
|
29
|
+
if (!authenticated) {
|
|
30
|
+
throw new DevWorkspaceError('SECURITY', `Approver authentication rejected for principal "${credentials.principalId}" via "${authMethod}".`);
|
|
31
|
+
}
|
|
32
|
+
const sessionId = credentials.sessionId?.trim()
|
|
33
|
+
? credentials.sessionId.trim()
|
|
34
|
+
: `sess-${crypto.randomBytes(12).toString('hex')}`;
|
|
35
|
+
return {
|
|
36
|
+
principalId: credentials.principalId,
|
|
37
|
+
authMethod,
|
|
38
|
+
authenticatedAt: new Date().toISOString(),
|
|
39
|
+
sessionId,
|
|
40
|
+
issuer,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Trusted symmetric HMAC-SHA256 authentication and grant signing provider.
|
|
45
|
+
* Requires a secret key of at least 32 bytes and validates credentials against explicit registered principals or verifier callbacks.
|
|
46
|
+
*/
|
|
47
|
+
export class HmacApprovalAuthProvider {
|
|
48
|
+
id;
|
|
49
|
+
authMethod;
|
|
50
|
+
keyId;
|
|
51
|
+
algorithm = 'hmac-sha256';
|
|
52
|
+
issuer;
|
|
53
|
+
secretKey;
|
|
54
|
+
principals;
|
|
55
|
+
verifyCredentials;
|
|
56
|
+
constructor(options) {
|
|
57
|
+
const keyBuf = typeof options.secretKey === 'string'
|
|
58
|
+
? Buffer.from(options.secretKey, 'utf8')
|
|
59
|
+
: options.secretKey;
|
|
60
|
+
if (keyBuf.length < 32) {
|
|
61
|
+
throw new DevWorkspaceError('SECURITY', 'HMAC approval key must be at least 32 bytes (256 bits).');
|
|
62
|
+
}
|
|
63
|
+
this.id = options.id?.trim() || 'hmac-approval-provider';
|
|
64
|
+
this.keyId = options.keyId?.trim() || 'hmac-k1';
|
|
65
|
+
this.authMethod = options.authMethod ?? 'signed-token';
|
|
66
|
+
this.issuer = options.issuer?.trim() || this.id;
|
|
67
|
+
this.secretKey = Buffer.from(keyBuf);
|
|
68
|
+
this.principals = options.principals ? { ...options.principals } : undefined;
|
|
69
|
+
this.verifyCredentials = options.verifyCredentials;
|
|
70
|
+
}
|
|
71
|
+
async authenticate(credentials) {
|
|
72
|
+
return authenticatePrincipal(this.id, this.authMethod, this.issuer, credentials, this.principals, this.verifyCredentials);
|
|
73
|
+
}
|
|
74
|
+
async signGrant(canonicalPayload) {
|
|
75
|
+
const signature = crypto
|
|
76
|
+
.createHmac('sha256', this.secretKey)
|
|
77
|
+
.update(canonicalPayload, 'utf8')
|
|
78
|
+
.digest('hex');
|
|
79
|
+
return {
|
|
80
|
+
algorithm: 'hmac-sha256',
|
|
81
|
+
keyId: this.keyId,
|
|
82
|
+
providerId: this.id,
|
|
83
|
+
signature,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async verifyGrant(canonicalPayload, proof) {
|
|
87
|
+
if (!proof ||
|
|
88
|
+
proof.algorithm !== 'hmac-sha256' ||
|
|
89
|
+
proof.providerId !== this.id ||
|
|
90
|
+
proof.keyId !== this.keyId ||
|
|
91
|
+
typeof proof.signature !== 'string' ||
|
|
92
|
+
!/^[0-9a-f]{64}$/i.test(proof.signature)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const expected = crypto
|
|
96
|
+
.createHmac('sha256', this.secretKey)
|
|
97
|
+
.update(canonicalPayload, 'utf8')
|
|
98
|
+
.digest();
|
|
99
|
+
const provided = Buffer.from(proof.signature, 'hex');
|
|
100
|
+
return expected.length === provided.length && crypto.timingSafeEqual(expected, provided);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Asymmetric Ed25519 digital signature provider for approval grants.
|
|
105
|
+
* Supports signing when configured with a private key, or verification-only operation when given only a public key.
|
|
106
|
+
*/
|
|
107
|
+
export class Ed25519ApprovalAuthProvider {
|
|
108
|
+
id;
|
|
109
|
+
authMethod;
|
|
110
|
+
keyId;
|
|
111
|
+
algorithm = 'ed25519';
|
|
112
|
+
issuer;
|
|
113
|
+
publicKey;
|
|
114
|
+
privateKey;
|
|
115
|
+
principals;
|
|
116
|
+
verifyCredentials;
|
|
117
|
+
static generateKeyPair() {
|
|
118
|
+
const { publicKey, privateKey } = crypto.generateKeyPairSync('ed25519', {
|
|
119
|
+
publicKeyEncoding: { type: 'spki', format: 'pem' },
|
|
120
|
+
privateKeyEncoding: { type: 'pkcs8', format: 'pem' },
|
|
121
|
+
});
|
|
122
|
+
return { publicKeyPem: publicKey, privateKeyPem: privateKey };
|
|
123
|
+
}
|
|
124
|
+
constructor(options) {
|
|
125
|
+
this.id = options.id?.trim() || 'ed25519-approval-provider';
|
|
126
|
+
this.keyId = options.keyId?.trim() || 'ed25519-k1';
|
|
127
|
+
this.authMethod = options.authMethod ?? 'ci-oidc';
|
|
128
|
+
this.issuer = options.issuer?.trim() || this.id;
|
|
129
|
+
this.publicKey = crypto.createPublicKey(options.publicKeyPem);
|
|
130
|
+
this.privateKey = options.privateKeyPem ? crypto.createPrivateKey(options.privateKeyPem) : undefined;
|
|
131
|
+
this.principals = options.principals ? { ...options.principals } : undefined;
|
|
132
|
+
this.verifyCredentials = options.verifyCredentials;
|
|
133
|
+
}
|
|
134
|
+
async authenticate(credentials) {
|
|
135
|
+
return authenticatePrincipal(this.id, this.authMethod, this.issuer, credentials, this.principals, this.verifyCredentials);
|
|
136
|
+
}
|
|
137
|
+
async signGrant(canonicalPayload) {
|
|
138
|
+
if (!this.privateKey) {
|
|
139
|
+
throw new DevWorkspaceError('SECURITY', `Auth provider "${this.id}" is configured in verification-only mode and cannot sign approval grants.`);
|
|
140
|
+
}
|
|
141
|
+
const signature = crypto
|
|
142
|
+
.sign(null, Buffer.from(canonicalPayload, 'utf8'), this.privateKey)
|
|
143
|
+
.toString('base64');
|
|
144
|
+
return {
|
|
145
|
+
algorithm: 'ed25519',
|
|
146
|
+
keyId: this.keyId,
|
|
147
|
+
providerId: this.id,
|
|
148
|
+
signature,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
async verifyGrant(canonicalPayload, proof) {
|
|
152
|
+
if (!proof ||
|
|
153
|
+
proof.algorithm !== 'ed25519' ||
|
|
154
|
+
proof.providerId !== this.id ||
|
|
155
|
+
proof.keyId !== this.keyId ||
|
|
156
|
+
typeof proof.signature !== 'string' ||
|
|
157
|
+
proof.signature.trim().length === 0) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
const sigBuf = Buffer.from(proof.signature, 'base64');
|
|
162
|
+
if (sigBuf.length === 0)
|
|
163
|
+
return false;
|
|
164
|
+
return crypto.verify(null, Buffer.from(canonicalPayload, 'utf8'), this.publicKey, sigBuf);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Construct an environment-backed HMAC approval provider when explicit key and approver credentials are present.
|
|
173
|
+
* Returns null (fail-closed) when required environment configuration is missing or weak.
|
|
174
|
+
*/
|
|
175
|
+
export function createEnvApprovalAuthProvider(env = process.env) {
|
|
176
|
+
const key = env.DEVWORKSPACE_APPROVAL_KEY?.trim();
|
|
177
|
+
const principalId = env.DEVWORKSPACE_APPROVER_ID?.trim();
|
|
178
|
+
const token = env.DEVWORKSPACE_APPROVAL_TOKEN?.trim();
|
|
179
|
+
if (!key || Buffer.byteLength(key, 'utf8') < 32 || !principalId || !token) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
return new HmacApprovalAuthProvider({
|
|
183
|
+
id: env.DEVWORKSPACE_APPROVAL_PROVIDER_ID?.trim() || 'env-hmac-provider',
|
|
184
|
+
keyId: env.DEVWORKSPACE_APPROVAL_KEY_ID?.trim() || 'env-k1',
|
|
185
|
+
secretKey: key,
|
|
186
|
+
authMethod: 'signed-token',
|
|
187
|
+
principals: { [principalId]: token },
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/** Extract caller credentials from explicit environment variables, or null when absent. */
|
|
191
|
+
export function getEnvApproverCredentials(env = process.env) {
|
|
192
|
+
const principalId = env.DEVWORKSPACE_APPROVER_ID?.trim();
|
|
193
|
+
const token = env.DEVWORKSPACE_APPROVAL_TOKEN?.trim();
|
|
194
|
+
if (!principalId || !token)
|
|
195
|
+
return null;
|
|
196
|
+
return {
|
|
197
|
+
principalId,
|
|
198
|
+
token,
|
|
199
|
+
sessionId: env.DEVWORKSPACE_APPROVER_SESSION_ID?.trim() || undefined,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
@@ -1,6 +1,104 @@
|
|
|
1
|
-
import type { AgentExecutionRequest, AgentExecutionResponse, ExecutionKind, RuntimeExecutionStatus } from './types.js';
|
|
1
|
+
import type { AgentExecutionRequest, AgentExecutionResponse, ApprovalAuthProvider, ApprovalGrant, ApproverCredentials, ApproverIdentity, ExecutionKind, RuntimeExecutionStatus } from './types.js';
|
|
2
|
+
import { SecurityAuditLogger } from '../security/audit.js';
|
|
2
3
|
export declare const MAX_RUNTIME_OUTPUT_CHARS = 50000;
|
|
4
|
+
export declare const DEFAULT_GRANT_TTL_MS: number;
|
|
5
|
+
/**
|
|
6
|
+
* Shared mutual-exclusion lock serializing approval grant revocations with final execution authorization
|
|
7
|
+
* and child-process spawn creation so a completed revocation can never race with process start.
|
|
8
|
+
*/
|
|
9
|
+
export declare function withRevocationAuthLock<T>(workspaceRoot: string | undefined, fn: () => Promise<T>): Promise<T>;
|
|
10
|
+
/** Canonical deterministic JSON representation signed by an ApprovalAuthProvider. */
|
|
11
|
+
export declare function serializeGrantPayload(fields: {
|
|
12
|
+
grantId: string;
|
|
13
|
+
approvedBy: string;
|
|
14
|
+
approvedAt: string;
|
|
15
|
+
expiresAt: string;
|
|
16
|
+
approverIdentity: ApproverIdentity;
|
|
17
|
+
operation: ApprovalGrant['operation'];
|
|
18
|
+
stageId?: string;
|
|
19
|
+
stageScope?: ApprovalGrant['stageScope'];
|
|
20
|
+
executable: string;
|
|
21
|
+
args: string[];
|
|
22
|
+
workspaceRoot: string;
|
|
23
|
+
}): string;
|
|
3
24
|
export declare function createExecutionId(prefix?: string): string;
|
|
25
|
+
export interface CreateApprovalGrantInput {
|
|
26
|
+
authProvider: ApprovalAuthProvider;
|
|
27
|
+
credentials: ApproverCredentials;
|
|
28
|
+
operation: ApprovalGrant['operation'];
|
|
29
|
+
stageId?: string;
|
|
30
|
+
stageScope?: 'stage-bound' | 'stage-independent';
|
|
31
|
+
executable: string;
|
|
32
|
+
args: string[];
|
|
33
|
+
workspaceRoot: string;
|
|
34
|
+
ttlMs?: number;
|
|
35
|
+
expiresAt?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Authenticate the approver via a trusted ApprovalAuthProvider and issue a cryptographically signed grant.
|
|
39
|
+
* Fails closed when authentication or signing capability is unavailable.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createApprovalGrant(input: CreateApprovalGrantInput): Promise<ApprovalGrant>;
|
|
42
|
+
export interface RevocationReadResult {
|
|
43
|
+
trustworthy: boolean;
|
|
44
|
+
revokedIds: Set<string>;
|
|
45
|
+
reason?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Inspect workspace revocation storage fail-closed:
|
|
49
|
+
* - Only missing revocation file (ENOENT) indicates zero revoked grants cleanly.
|
|
50
|
+
* - Permission errors, malformed JSON, non-array structures, or corrupted records return trustworthy: false.
|
|
51
|
+
*/
|
|
52
|
+
export declare function readRevokedGrantState(workspaceRoot: string | undefined): Promise<RevocationReadResult>;
|
|
53
|
+
/** Convenience wrapper that throws fail-closed if revocation storage is unreadable, malformed, or corrupted. */
|
|
54
|
+
export declare function readRevokedGrantIds(workspaceRoot: string | undefined): Promise<Set<string>>;
|
|
55
|
+
export declare function revokeApprovalGrant(grant: ApprovalGrant, revokedBy: string, reason?: string, workspaceRoot?: string): Promise<ApprovalGrant>;
|
|
56
|
+
/**
|
|
57
|
+
* Durably persist a security audit event; fails closed (throws) when persistence fails.
|
|
58
|
+
*/
|
|
59
|
+
export declare function recordApprovalAuditEvent(workspaceRoot: string | undefined, entry: Parameters<SecurityAuditLogger['record']>[0]): Promise<void>;
|
|
60
|
+
export interface GrantValidationResult {
|
|
61
|
+
matched: boolean;
|
|
62
|
+
grant?: ApprovalGrant;
|
|
63
|
+
reason?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface EvaluateApprovalGrantsOptions {
|
|
66
|
+
stageId?: string;
|
|
67
|
+
revokedGrantIds?: Set<string>;
|
|
68
|
+
authProvider?: ApprovalAuthProvider;
|
|
69
|
+
allowStageIndependent?: boolean;
|
|
70
|
+
nowMs?: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Enforce strict stage-scope matching between a grant and a request:
|
|
74
|
+
* - A stage-bound grant MUST NOT authorize a missing or mismatched stageId.
|
|
75
|
+
* - A stage-independent grant MUST NOT authorize unless both grant.stageScope === 'stage-independent'
|
|
76
|
+
* and allowStageIndependent === true are explicitly set by policy.
|
|
77
|
+
*/
|
|
78
|
+
export declare function evaluateStageScope(grant: ApprovalGrant, requestStageId: string | undefined, allowStageIndependent?: boolean): {
|
|
79
|
+
ok: true;
|
|
80
|
+
} | {
|
|
81
|
+
ok: false;
|
|
82
|
+
reason: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Verify grant security invariants (revocation, expiration, authenticated identity with sessionId,
|
|
86
|
+
* and cryptographic proof via the trusted ApprovalAuthProvider).
|
|
87
|
+
*/
|
|
88
|
+
export declare function verifyGrantSecurity(grant: ApprovalGrant, options: {
|
|
89
|
+
authProvider?: ApprovalAuthProvider;
|
|
90
|
+
revokedGrantIds?: Set<string>;
|
|
91
|
+
nowMs?: number;
|
|
92
|
+
}): Promise<{
|
|
93
|
+
ok: true;
|
|
94
|
+
} | {
|
|
95
|
+
ok: false;
|
|
96
|
+
reason: string;
|
|
97
|
+
}>;
|
|
98
|
+
/** Validate a scoped grant against operation, stage, executable, args, workspace, TTL, revocation, identity, and signature. */
|
|
99
|
+
export declare function evaluateApprovalGrants(grants: ApprovalGrant[] | undefined, requiredOps: ApprovalGrant['operation'][], cmdArgs: string[], workspaceRoot: string, options?: EvaluateApprovalGrantsOptions): Promise<GrantValidationResult>;
|
|
100
|
+
/** Verify whether an approval grant authorizes the exact operation, stage, executable, arguments, and workspace. */
|
|
101
|
+
export declare function hasMatchingApprovalGrant(grants: ApprovalGrant[] | undefined, requiredOps: ApprovalGrant['operation'][], cmdArgs: string[], workspaceRoot: string, options?: EvaluateApprovalGrantsOptions): Promise<boolean>;
|
|
4
102
|
export declare function nonExecutedResponse(status: Extract<RuntimeExecutionStatus, 'PREPARED' | 'BLOCKED' | 'NOT_EXECUTED' | 'UNSUPPORTED' | 'FAILED'>, opts: {
|
|
5
103
|
executionKind: ExecutionKind;
|
|
6
104
|
output?: string;
|
|
@@ -19,12 +117,26 @@ export declare function validateExecutionCwd(cwd: string | undefined, workspaceR
|
|
|
19
117
|
ok: false;
|
|
20
118
|
reason: string;
|
|
21
119
|
}>;
|
|
22
|
-
/**
|
|
23
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Enforce concrete command policy immediately before spawn:
|
|
122
|
+
* - Never allows shells, NUL bytes, or absolute-path policy bypasses.
|
|
123
|
+
* - Restricts arbitrary inline eval flags on interpreters unless bound by exact ApprovalGrant.
|
|
124
|
+
* - Requires exact scoped ApprovalGrant for destructive commands or non-allowlisted binaries.
|
|
125
|
+
*/
|
|
126
|
+
export declare function validateConcreteCommand(cmdArgs: string[], workspaceRoot: string, opts?: {
|
|
127
|
+
approvalGrants?: ApprovalGrant[];
|
|
128
|
+
stageId?: string;
|
|
129
|
+
requireGrantForOps?: ApprovalGrant['operation'][];
|
|
130
|
+
revokedGrantIds?: Set<string>;
|
|
131
|
+
revocationState?: RevocationReadResult;
|
|
132
|
+
authProvider?: ApprovalAuthProvider;
|
|
133
|
+
allowStageIndependent?: boolean;
|
|
134
|
+
}): Promise<{
|
|
24
135
|
ok: true;
|
|
136
|
+
matchedGrant?: ApprovalGrant;
|
|
25
137
|
} | {
|
|
26
138
|
ok: false;
|
|
27
139
|
reason: string;
|
|
28
|
-
}
|
|
29
|
-
/** Execute a concrete validated command with minimal env,
|
|
30
|
-
export declare function executeBoundedCommand(request: AgentExecutionRequest, cmdArgs: string[], executionKind: Extract<ExecutionKind, 'command' | 'agent'>, defaultTimeoutMs: number, untrustedOutput?: boolean): Promise<AgentExecutionResponse>;
|
|
140
|
+
}>;
|
|
141
|
+
/** Execute a concrete validated command with minimal env, immediate pre-spawn grant revalidation, audit events, and full snapshot capture. */
|
|
142
|
+
export declare function executeBoundedCommand(request: AgentExecutionRequest, cmdArgs: string[], executionKind: Extract<ExecutionKind, 'command' | 'agent'>, defaultTimeoutMs: number, untrustedOutput?: boolean, requiredGrantOps?: ApprovalGrant['operation'][]): Promise<AgentExecutionResponse>;
|