@wickdninja/sweny-providers 0.1.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/LICENSE +21 -0
- package/README.md +259 -0
- package/dist/access/allow-all.d.ts +3 -0
- package/dist/access/allow-all.d.ts.map +1 -0
- package/dist/access/allow-all.js +19 -0
- package/dist/access/allow-all.js.map +1 -0
- package/dist/access/index.d.ts +5 -0
- package/dist/access/index.d.ts.map +1 -0
- package/dist/access/index.js +4 -0
- package/dist/access/index.js.map +1 -0
- package/dist/access/role-based.d.ts +8 -0
- package/dist/access/role-based.d.ts.map +1 -0
- package/dist/access/role-based.js +42 -0
- package/dist/access/role-based.js.map +1 -0
- package/dist/access/types.d.ts +41 -0
- package/dist/access/types.d.ts.map +1 -0
- package/dist/access/types.js +20 -0
- package/dist/access/types.js.map +1 -0
- package/dist/agent-tool/factory.d.ts +4 -0
- package/dist/agent-tool/factory.d.ts.map +1 -0
- package/dist/agent-tool/factory.js +4 -0
- package/dist/agent-tool/factory.js.map +1 -0
- package/dist/agent-tool/index.d.ts +3 -0
- package/dist/agent-tool/index.d.ts.map +1 -0
- package/dist/agent-tool/index.js +2 -0
- package/dist/agent-tool/index.js.map +1 -0
- package/dist/agent-tool/types.d.ts +15 -0
- package/dist/agent-tool/types.d.ts.map +1 -0
- package/dist/agent-tool/types.js +2 -0
- package/dist/agent-tool/types.js.map +1 -0
- package/dist/auth/api-key.d.ts +6 -0
- package/dist/auth/api-key.d.ts.map +1 -0
- package/dist/auth/api-key.js +36 -0
- package/dist/auth/api-key.js.map +1 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/no-auth.d.ts +3 -0
- package/dist/auth/no-auth.d.ts.map +1 -0
- package/dist/auth/no-auth.js +21 -0
- package/dist/auth/no-auth.js.map +1 -0
- package/dist/auth/types.d.ts +58 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +2 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/coding-agent/claude-code.d.ts +8 -0
- package/dist/coding-agent/claude-code.d.ts.map +1 -0
- package/dist/coding-agent/claude-code.js +37 -0
- package/dist/coding-agent/claude-code.js.map +1 -0
- package/dist/coding-agent/index.d.ts +4 -0
- package/dist/coding-agent/index.d.ts.map +1 -0
- package/dist/coding-agent/index.js +2 -0
- package/dist/coding-agent/index.js.map +1 -0
- package/dist/coding-agent/types.d.ts +10 -0
- package/dist/coding-agent/types.d.ts.map +1 -0
- package/dist/coding-agent/types.js +2 -0
- package/dist/coding-agent/types.js.map +1 -0
- package/dist/credential-vault/aws-secrets-manager.d.ts +19 -0
- package/dist/credential-vault/aws-secrets-manager.d.ts.map +1 -0
- package/dist/credential-vault/aws-secrets-manager.js +96 -0
- package/dist/credential-vault/aws-secrets-manager.js.map +1 -0
- package/dist/credential-vault/env-vault.d.ts +15 -0
- package/dist/credential-vault/env-vault.d.ts.map +1 -0
- package/dist/credential-vault/env-vault.js +25 -0
- package/dist/credential-vault/env-vault.js.map +1 -0
- package/dist/credential-vault/index.d.ts +6 -0
- package/dist/credential-vault/index.d.ts.map +1 -0
- package/dist/credential-vault/index.js +3 -0
- package/dist/credential-vault/index.js.map +1 -0
- package/dist/credential-vault/types.d.ts +30 -0
- package/dist/credential-vault/types.d.ts.map +1 -0
- package/dist/credential-vault/types.js +2 -0
- package/dist/credential-vault/types.js.map +1 -0
- package/dist/errors.d.ts +18 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +35 -0
- package/dist/errors.js.map +1 -0
- package/dist/incident/index.d.ts +4 -0
- package/dist/incident/index.d.ts.map +1 -0
- package/dist/incident/index.js +3 -0
- package/dist/incident/index.js.map +1 -0
- package/dist/incident/opsgenie.d.ts +19 -0
- package/dist/incident/opsgenie.d.ts.map +1 -0
- package/dist/incident/opsgenie.js +102 -0
- package/dist/incident/opsgenie.js.map +1 -0
- package/dist/incident/pagerduty.d.ts +19 -0
- package/dist/incident/pagerduty.d.ts.map +1 -0
- package/dist/incident/pagerduty.js +112 -0
- package/dist/incident/pagerduty.js.map +1 -0
- package/dist/incident/types.d.ts +67 -0
- package/dist/incident/types.d.ts.map +1 -0
- package/dist/incident/types.js +2 -0
- package/dist/incident/types.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/issue-tracking/github-issues.d.ts +22 -0
- package/dist/issue-tracking/github-issues.d.ts.map +1 -0
- package/dist/issue-tracking/github-issues.js +134 -0
- package/dist/issue-tracking/github-issues.js.map +1 -0
- package/dist/issue-tracking/index.d.ts +6 -0
- package/dist/issue-tracking/index.d.ts.map +1 -0
- package/dist/issue-tracking/index.js +5 -0
- package/dist/issue-tracking/index.js.map +1 -0
- package/dist/issue-tracking/jira.d.ts +22 -0
- package/dist/issue-tracking/jira.d.ts.map +1 -0
- package/dist/issue-tracking/jira.js +224 -0
- package/dist/issue-tracking/jira.js.map +1 -0
- package/dist/issue-tracking/linear.d.ts +16 -0
- package/dist/issue-tracking/linear.d.ts.map +1 -0
- package/dist/issue-tracking/linear.js +309 -0
- package/dist/issue-tracking/linear.js.map +1 -0
- package/dist/issue-tracking/types.d.ts +163 -0
- package/dist/issue-tracking/types.d.ts.map +1 -0
- package/dist/issue-tracking/types.js +28 -0
- package/dist/issue-tracking/types.js.map +1 -0
- package/dist/logger.d.ts +8 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +7 -0
- package/dist/logger.js.map +1 -0
- package/dist/messaging/index.d.ts +6 -0
- package/dist/messaging/index.d.ts.map +1 -0
- package/dist/messaging/index.js +3 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/messaging/slack.d.ts +8 -0
- package/dist/messaging/slack.d.ts.map +1 -0
- package/dist/messaging/slack.js +35 -0
- package/dist/messaging/slack.js.map +1 -0
- package/dist/messaging/teams.d.ts +22 -0
- package/dist/messaging/teams.d.ts.map +1 -0
- package/dist/messaging/teams.js +124 -0
- package/dist/messaging/teams.js.map +1 -0
- package/dist/messaging/types.d.ts +30 -0
- package/dist/messaging/types.d.ts.map +1 -0
- package/dist/messaging/types.js +2 -0
- package/dist/messaging/types.js.map +1 -0
- package/dist/notification/discord-webhook.d.ts +16 -0
- package/dist/notification/discord-webhook.d.ts.map +1 -0
- package/dist/notification/discord-webhook.js +33 -0
- package/dist/notification/discord-webhook.js.map +1 -0
- package/dist/notification/email.d.ts +22 -0
- package/dist/notification/email.d.ts.map +1 -0
- package/dist/notification/email.js +54 -0
- package/dist/notification/email.js.map +1 -0
- package/dist/notification/github-summary.d.ts +13 -0
- package/dist/notification/github-summary.d.ts.map +1 -0
- package/dist/notification/github-summary.js +25 -0
- package/dist/notification/github-summary.js.map +1 -0
- package/dist/notification/index.d.ts +8 -0
- package/dist/notification/index.d.ts.map +1 -0
- package/dist/notification/index.js +7 -0
- package/dist/notification/index.js.map +1 -0
- package/dist/notification/slack-webhook.d.ts +16 -0
- package/dist/notification/slack-webhook.d.ts.map +1 -0
- package/dist/notification/slack-webhook.js +31 -0
- package/dist/notification/slack-webhook.js.map +1 -0
- package/dist/notification/teams-webhook.d.ts +16 -0
- package/dist/notification/teams-webhook.d.ts.map +1 -0
- package/dist/notification/teams-webhook.js +60 -0
- package/dist/notification/teams-webhook.js.map +1 -0
- package/dist/notification/types.d.ts +18 -0
- package/dist/notification/types.d.ts.map +1 -0
- package/dist/notification/types.js +2 -0
- package/dist/notification/types.js.map +1 -0
- package/dist/notification/webhook.d.ts +28 -0
- package/dist/notification/webhook.d.ts.map +1 -0
- package/dist/notification/webhook.js +59 -0
- package/dist/notification/webhook.js.map +1 -0
- package/dist/observability/cloudwatch.d.ts +19 -0
- package/dist/observability/cloudwatch.d.ts.map +1 -0
- package/dist/observability/cloudwatch.js +181 -0
- package/dist/observability/cloudwatch.js.map +1 -0
- package/dist/observability/datadog.d.ts +22 -0
- package/dist/observability/datadog.d.ts.map +1 -0
- package/dist/observability/datadog.js +137 -0
- package/dist/observability/datadog.js.map +1 -0
- package/dist/observability/elastic.d.ts +42 -0
- package/dist/observability/elastic.d.ts.map +1 -0
- package/dist/observability/elastic.js +239 -0
- package/dist/observability/elastic.js.map +1 -0
- package/dist/observability/index.d.ts +9 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +8 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/loki.d.ts +22 -0
- package/dist/observability/loki.d.ts.map +1 -0
- package/dist/observability/loki.js +203 -0
- package/dist/observability/loki.js.map +1 -0
- package/dist/observability/newrelic.d.ts +22 -0
- package/dist/observability/newrelic.d.ts.map +1 -0
- package/dist/observability/newrelic.js +145 -0
- package/dist/observability/newrelic.js.map +1 -0
- package/dist/observability/sentry.d.ts +25 -0
- package/dist/observability/sentry.d.ts.map +1 -0
- package/dist/observability/sentry.js +149 -0
- package/dist/observability/sentry.js.map +1 -0
- package/dist/observability/splunk.d.ts +22 -0
- package/dist/observability/splunk.d.ts.map +1 -0
- package/dist/observability/splunk.js +176 -0
- package/dist/observability/splunk.js.map +1 -0
- package/dist/observability/types.d.ts +54 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/observability/types.js +2 -0
- package/dist/observability/types.js.map +1 -0
- package/dist/source-control/github.d.ts +11 -0
- package/dist/source-control/github.d.ts.map +1 -0
- package/dist/source-control/github.js +161 -0
- package/dist/source-control/github.js.map +1 -0
- package/dist/source-control/gitlab.d.ts +25 -0
- package/dist/source-control/gitlab.d.ts.map +1 -0
- package/dist/source-control/gitlab.js +223 -0
- package/dist/source-control/gitlab.js.map +1 -0
- package/dist/source-control/index.d.ts +6 -0
- package/dist/source-control/index.d.ts.map +1 -0
- package/dist/source-control/index.js +3 -0
- package/dist/source-control/index.js.map +1 -0
- package/dist/source-control/types.d.ts +115 -0
- package/dist/source-control/types.d.ts.map +1 -0
- package/dist/source-control/types.js +2 -0
- package/dist/source-control/types.js.map +1 -0
- package/dist/storage/csi.d.ts +36 -0
- package/dist/storage/csi.d.ts.map +1 -0
- package/dist/storage/csi.js +39 -0
- package/dist/storage/csi.js.map +1 -0
- package/dist/storage/fs.d.ts +5 -0
- package/dist/storage/fs.d.ts.map +1 -0
- package/dist/storage/fs.js +11 -0
- package/dist/storage/fs.js.map +1 -0
- package/dist/storage/index.d.ts +13 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +14 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/memory/fs.d.ts +15 -0
- package/dist/storage/memory/fs.d.ts.map +1 -0
- package/dist/storage/memory/fs.js +65 -0
- package/dist/storage/memory/fs.js.map +1 -0
- package/dist/storage/memory/s3.d.ts +17 -0
- package/dist/storage/memory/s3.d.ts.map +1 -0
- package/dist/storage/memory/s3.js +77 -0
- package/dist/storage/memory/s3.js.map +1 -0
- package/dist/storage/s3.d.ts +7 -0
- package/dist/storage/s3.d.ts.map +1 -0
- package/dist/storage/s3.js +12 -0
- package/dist/storage/s3.js.map +1 -0
- package/dist/storage/session/fs.d.ts +16 -0
- package/dist/storage/session/fs.d.ts.map +1 -0
- package/dist/storage/session/fs.js +81 -0
- package/dist/storage/session/fs.js.map +1 -0
- package/dist/storage/session/s3.d.ts +18 -0
- package/dist/storage/session/s3.d.ts.map +1 -0
- package/dist/storage/session/s3.js +121 -0
- package/dist/storage/session/s3.js.map +1 -0
- package/dist/storage/types.d.ts +206 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +10 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/storage/workspace/fs.d.ts +18 -0
- package/dist/storage/workspace/fs.d.ts.map +1 -0
- package/dist/storage/workspace/fs.js +153 -0
- package/dist/storage/workspace/fs.js.map +1 -0
- package/dist/storage/workspace/s3.d.ts +20 -0
- package/dist/storage/workspace/s3.d.ts.map +1 -0
- package/dist/storage/workspace/s3.js +180 -0
- package/dist/storage/workspace/s3.js.map +1 -0
- package/package.json +134 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** Represents an authenticated user's identity. */
|
|
2
|
+
export interface UserIdentity {
|
|
3
|
+
/** Unique user identifier. */
|
|
4
|
+
userId: string;
|
|
5
|
+
/** Tenant identifier for multi-tenant deployments. */
|
|
6
|
+
tenantId?: string;
|
|
7
|
+
/** Human-readable display name. */
|
|
8
|
+
displayName: string;
|
|
9
|
+
/** User's email address. */
|
|
10
|
+
email?: string;
|
|
11
|
+
/** Roles assigned to the user (e.g., "admin", "viewer"). */
|
|
12
|
+
roles: string[];
|
|
13
|
+
/** Additional provider-specific metadata. */
|
|
14
|
+
metadata: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
/** Describes a single field in a login form. */
|
|
17
|
+
export interface LoginField {
|
|
18
|
+
/** Field key used in the credentials record. */
|
|
19
|
+
key: string;
|
|
20
|
+
/** Human-readable label shown in the UI. */
|
|
21
|
+
label: string;
|
|
22
|
+
/** HTML input type for the field. */
|
|
23
|
+
type: "text" | "email" | "password";
|
|
24
|
+
/** Placeholder text for the input field. */
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Provider interface for authentication and session management. */
|
|
28
|
+
export interface AuthProvider {
|
|
29
|
+
/** Human-readable name of the auth provider (e.g., "Google", "GitHub"). */
|
|
30
|
+
readonly displayName: string;
|
|
31
|
+
/** Login form field definitions; omit if the provider uses external OAuth. */
|
|
32
|
+
readonly loginFields?: LoginField[];
|
|
33
|
+
/**
|
|
34
|
+
* Authenticate a user by their ID (e.g., from a session token).
|
|
35
|
+
* @param userId - User identifier to authenticate.
|
|
36
|
+
* @returns The user's identity, or null if authentication fails.
|
|
37
|
+
*/
|
|
38
|
+
authenticate(userId: string): Promise<UserIdentity | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Log in a user with explicit credentials.
|
|
41
|
+
* @param userId - User identifier.
|
|
42
|
+
* @param credentials - Key-value credential pairs matching loginFields.
|
|
43
|
+
* @returns The authenticated user's identity.
|
|
44
|
+
*/
|
|
45
|
+
login?(userId: string, credentials: Record<string, string>): Promise<UserIdentity>;
|
|
46
|
+
/**
|
|
47
|
+
* Check whether a user has a valid active session.
|
|
48
|
+
* @param userId - User identifier.
|
|
49
|
+
* @returns True if the session is valid.
|
|
50
|
+
*/
|
|
51
|
+
hasValidSession(userId: string): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Clear / invalidate a user's session.
|
|
54
|
+
* @param userId - User identifier.
|
|
55
|
+
*/
|
|
56
|
+
clearSession(userId: string): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,MAAM,WAAW,YAAY;IAC3B,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,gDAAgD;AAChD,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;IACpC,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAEpC;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAE3D;;;;;OAKG;IACH,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAEnF;;;;OAIG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAElD;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CodingAgent } from "./types.js";
|
|
2
|
+
import type { Logger } from "../logger.js";
|
|
3
|
+
export interface ClaudeCodeConfig {
|
|
4
|
+
cliFlags?: string[];
|
|
5
|
+
logger?: Logger;
|
|
6
|
+
}
|
|
7
|
+
export declare function claudeCode(config?: ClaudeCodeConfig): CodingAgent;
|
|
8
|
+
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/coding-agent/claude-code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAyB,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,WAAW,CA0CjE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { consoleLogger } from "../logger.js";
|
|
2
|
+
export function claudeCode(config) {
|
|
3
|
+
const log = config?.logger ?? consoleLogger;
|
|
4
|
+
const extraFlags = config?.cliFlags ?? [];
|
|
5
|
+
// Lazy-load @actions/exec — optional peer dep, only available in GitHub Actions
|
|
6
|
+
async function exec(cmd, args, opts) {
|
|
7
|
+
const actionsExec = await import("@actions/exec");
|
|
8
|
+
return actionsExec.exec(cmd, args, {
|
|
9
|
+
env: opts?.env,
|
|
10
|
+
ignoreReturnCode: opts?.ignoreReturnCode,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
async install() {
|
|
15
|
+
log.info("Installing Claude Code CLI...");
|
|
16
|
+
await exec("npm", ["install", "-g", "@anthropic-ai/claude-code"]);
|
|
17
|
+
log.info("Claude Code CLI installed");
|
|
18
|
+
},
|
|
19
|
+
async run(opts) {
|
|
20
|
+
const args = [
|
|
21
|
+
"-p",
|
|
22
|
+
opts.prompt,
|
|
23
|
+
"--allowedTools",
|
|
24
|
+
"*",
|
|
25
|
+
"--dangerously-skip-permissions",
|
|
26
|
+
"--max-turns",
|
|
27
|
+
String(opts.maxTurns),
|
|
28
|
+
...extraFlags,
|
|
29
|
+
];
|
|
30
|
+
return exec("claude", args, {
|
|
31
|
+
env: { ...process.env, ...opts.env },
|
|
32
|
+
ignoreReturnCode: true,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=claude-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/coding-agent/claude-code.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAO7C,MAAM,UAAU,UAAU,CAAC,MAAyB;IAClD,MAAM,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qBAAqB,EAAE,MAAM,YAAY,CAAC;AACrE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/coding-agent/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CodingAgentRunOptions {
|
|
2
|
+
prompt: string;
|
|
3
|
+
maxTurns: number;
|
|
4
|
+
env?: Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
export interface CodingAgent {
|
|
7
|
+
install(): Promise<void>;
|
|
8
|
+
run(opts: CodingAgentRunOptions): Promise<number>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/coding-agent/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,GAAG,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/coding-agent/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Logger } from "../logger.js";
|
|
3
|
+
import type { CredentialVaultProvider } from "./types.js";
|
|
4
|
+
export declare const awsSecretsManagerConfigSchema: z.ZodObject<{
|
|
5
|
+
region: z.ZodDefault<z.ZodString>;
|
|
6
|
+
prefix: z.ZodDefault<z.ZodString>;
|
|
7
|
+
logger: z.ZodOptional<z.ZodType<Logger, z.ZodTypeDef, Logger>>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
region: string;
|
|
10
|
+
prefix: string;
|
|
11
|
+
logger?: Logger | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
logger?: Logger | undefined;
|
|
14
|
+
region?: string | undefined;
|
|
15
|
+
prefix?: string | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type AwsSecretsManagerConfig = z.infer<typeof awsSecretsManagerConfigSchema>;
|
|
18
|
+
export declare function awsSecretsManager(config?: AwsSecretsManagerConfig): CredentialVaultProvider;
|
|
19
|
+
//# sourceMappingURL=aws-secrets-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-secrets-manager.d.ts","sourceRoot":"","sources":["../../src/credential-vault/aws-secrets-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,6BAA6B;;;;;;;;;;;;EAIxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,uBAAuB,GAAG,uBAAuB,CAG3F"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { consoleLogger } from "../logger.js";
|
|
3
|
+
export const awsSecretsManagerConfigSchema = z.object({
|
|
4
|
+
region: z.string().default("us-east-1"),
|
|
5
|
+
prefix: z.string().default("sweny"),
|
|
6
|
+
logger: z.custom().optional(),
|
|
7
|
+
});
|
|
8
|
+
export function awsSecretsManager(config) {
|
|
9
|
+
const parsed = awsSecretsManagerConfigSchema.parse(config ?? {});
|
|
10
|
+
return new AwsSecretsManagerProvider(parsed);
|
|
11
|
+
}
|
|
12
|
+
class AwsSecretsManagerProvider {
|
|
13
|
+
region;
|
|
14
|
+
prefix;
|
|
15
|
+
log;
|
|
16
|
+
client = null;
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.region = config.region ?? "us-east-1";
|
|
19
|
+
this.prefix = config.prefix ?? "sweny";
|
|
20
|
+
this.log = config.logger ?? consoleLogger;
|
|
21
|
+
}
|
|
22
|
+
async getClient() {
|
|
23
|
+
if (!this.client) {
|
|
24
|
+
const { SecretsManagerClient } = await import("@aws-sdk/client-secrets-manager");
|
|
25
|
+
this.client = new SecretsManagerClient({ region: this.region });
|
|
26
|
+
}
|
|
27
|
+
return this.client;
|
|
28
|
+
}
|
|
29
|
+
secretName(tenantId, key) {
|
|
30
|
+
return `${this.prefix}/${tenantId}/${key}`;
|
|
31
|
+
}
|
|
32
|
+
async getSecret(tenantId, key) {
|
|
33
|
+
const client = await this.getClient();
|
|
34
|
+
const { GetSecretValueCommand } = await import("@aws-sdk/client-secrets-manager");
|
|
35
|
+
try {
|
|
36
|
+
const result = await client.send(new GetSecretValueCommand({ SecretId: this.secretName(tenantId, key) }));
|
|
37
|
+
this.log.info(`Retrieved secret ${this.secretName(tenantId, key)}`);
|
|
38
|
+
return result.SecretString ?? null;
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
if (err instanceof Error && err.name === "ResourceNotFoundException") {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
throw err;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async setSecret(tenantId, key, value) {
|
|
48
|
+
const client = await this.getClient();
|
|
49
|
+
const { CreateSecretCommand, PutSecretValueCommand } = await import("@aws-sdk/client-secrets-manager");
|
|
50
|
+
const name = this.secretName(tenantId, key);
|
|
51
|
+
try {
|
|
52
|
+
await client.send(new CreateSecretCommand({ Name: name, SecretString: value }));
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
if (err instanceof Error && err.name === "ResourceExistsException") {
|
|
56
|
+
await client.send(new PutSecretValueCommand({ SecretId: name, SecretString: value }));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
throw err;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
this.log.info(`Set secret ${name}`);
|
|
63
|
+
}
|
|
64
|
+
async deleteSecret(tenantId, key) {
|
|
65
|
+
const client = await this.getClient();
|
|
66
|
+
const { DeleteSecretCommand } = await import("@aws-sdk/client-secrets-manager");
|
|
67
|
+
const name = this.secretName(tenantId, key);
|
|
68
|
+
await client.send(new DeleteSecretCommand({
|
|
69
|
+
SecretId: name,
|
|
70
|
+
ForceDeleteWithoutRecovery: true,
|
|
71
|
+
}));
|
|
72
|
+
this.log.info(`Deleted secret ${name}`);
|
|
73
|
+
}
|
|
74
|
+
async listKeys(tenantId) {
|
|
75
|
+
const client = await this.getClient();
|
|
76
|
+
const { ListSecretsCommand } = await import("@aws-sdk/client-secrets-manager");
|
|
77
|
+
const namePrefix = `${this.prefix}/${tenantId}/`;
|
|
78
|
+
const keys = [];
|
|
79
|
+
let nextToken;
|
|
80
|
+
do {
|
|
81
|
+
const result = await client.send(new ListSecretsCommand({
|
|
82
|
+
Filters: [{ Key: "name", Values: [namePrefix] }],
|
|
83
|
+
NextToken: nextToken,
|
|
84
|
+
}));
|
|
85
|
+
for (const secret of result.SecretList ?? []) {
|
|
86
|
+
if (secret.Name?.startsWith(namePrefix)) {
|
|
87
|
+
keys.push(secret.Name.slice(namePrefix.length));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
nextToken = result.NextToken;
|
|
91
|
+
} while (nextToken);
|
|
92
|
+
this.log.info(`Listed ${keys.length} keys for tenant ${tenantId}`);
|
|
93
|
+
return keys;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=aws-secrets-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-secrets-manager.js","sourceRoot":"","sources":["../../src/credential-vault/aws-secrets-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAU,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAIH,MAAM,UAAU,iBAAiB,CAAC,MAAgC;IAChE,MAAM,MAAM,GAAG,6BAA6B,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IACjE,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,yBAAyB;IACZ,MAAM,CAAS;IACf,MAAM,CAAS;IACf,GAAG,CAAS;IACrB,MAAM,GAA0E,IAAI,CAAC;IAE7F,YAAY,MAA+B;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,WAAW,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC;QACvC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,aAAa,CAAC;IAC5C,CAAC;IAEO,KAAK,CAAC,SAAS;QACrB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM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M,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,iCAAiC,CAAC,CAAC;QAE/E,MAAM,UAAU,GAAG,GAAG,IAAI,CAAC,MAAM,IAAI,QAAQ,GAAG,CAAC;QACjD,MAAM,IAAI,GAAa,EAAE,CAAC;QAC1B,IAAI,SAA6B,CAAC;QAElC,GAAG,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAC9B,IAAI,kBAAkB,CAAC;gBACrB,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;gBAChD,SAAS,EAAE,SAAS;aACrB,CAAC,CACH,CAAC;YAEF,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;gBAC7C,IAAI,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;oBACxC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;gBAClD,CAAC;YACH,CAAC;YAED,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAC/B,CAAC,QAAQ,SAAS,EAAE;QAEpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,oBAAoB,QAAQ,EAAE,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CredentialVaultProvider } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Reads secrets from environment variables.
|
|
4
|
+
*
|
|
5
|
+
* Key lookup: `{PREFIX}_{TENANT_ID}_{KEY}` (uppercased, hyphens → underscores).
|
|
6
|
+
* Falls back to `{PREFIX}_{KEY}` if the tenant-scoped var is not set.
|
|
7
|
+
*
|
|
8
|
+
* This is useful for local development and the open-source GitHub Action
|
|
9
|
+
* where secrets come from env vars rather than a database.
|
|
10
|
+
*/
|
|
11
|
+
export interface EnvVaultConfig {
|
|
12
|
+
prefix?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function envVault(config?: EnvVaultConfig): CredentialVaultProvider;
|
|
15
|
+
//# sourceMappingURL=env-vault.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-vault.d.ts","sourceRoot":"","sources":["../../src/credential-vault/env-vault.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,uBAAuB,CA6BzE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function envVault(config) {
|
|
2
|
+
const prefix = config?.prefix ?? "SWENY";
|
|
3
|
+
function envKey(tenantId, key) {
|
|
4
|
+
const normalized = `${prefix}_${tenantId}_${key}`.toUpperCase().replace(/-/g, "_");
|
|
5
|
+
return normalized;
|
|
6
|
+
}
|
|
7
|
+
function fallbackKey(key) {
|
|
8
|
+
return `${prefix}_${key}`.toUpperCase().replace(/-/g, "_");
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
async getSecret(tenantId, key) {
|
|
12
|
+
return process.env[envKey(tenantId, key)] ?? process.env[fallbackKey(key)] ?? null;
|
|
13
|
+
},
|
|
14
|
+
async setSecret(_tenantId, _key, _value) {
|
|
15
|
+
throw new Error("envVault is read-only. Use a database-backed vault for writes.");
|
|
16
|
+
},
|
|
17
|
+
async deleteSecret(_tenantId, _key) {
|
|
18
|
+
throw new Error("envVault is read-only. Use a database-backed vault for deletes.");
|
|
19
|
+
},
|
|
20
|
+
async listKeys(_tenantId) {
|
|
21
|
+
throw new Error("envVault does not support listing keys. Use a database-backed vault.");
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=env-vault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-vault.js","sourceRoot":"","sources":["../../src/credential-vault/env-vault.ts"],"names":[],"mappings":"AAeA,MAAM,UAAU,QAAQ,CAAC,MAAuB;IAC9C,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,IAAI,OAAO,CAAC;IAEzC,SAAS,MAAM,CAAC,QAAgB,EAAE,GAAW;QAC3C,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,QAAQ,IAAI,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACnF,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,SAAS,WAAW,CAAC,GAAW;QAC9B,OAAO,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO;QACL,KAAK,CAAC,SAAS,CAAC,QAAgB,EAAE,GAAW;YAC3C,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;QACrF,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,SAAiB,EAAE,IAAY,EAAE,MAAc;YAC7D,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACpF,CAAC;QAED,KAAK,CAAC,YAAY,CAAC,SAAiB,EAAE,IAAY;YAChD,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;QACrF,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,SAAiB;YAC9B,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;QAC1F,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { CredentialVaultProvider } from "./types.js";
|
|
2
|
+
export type { EnvVaultConfig } from "./env-vault.js";
|
|
3
|
+
export { envVault } from "./env-vault.js";
|
|
4
|
+
export type { AwsSecretsManagerConfig } from "./aws-secrets-manager.js";
|
|
5
|
+
export { awsSecretsManager, awsSecretsManagerConfigSchema } from "./aws-secrets-manager.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/credential-vault/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC1D,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/credential-vault/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Provider interface for securely storing and retrieving tenant secrets. */
|
|
2
|
+
export interface CredentialVaultProvider {
|
|
3
|
+
/**
|
|
4
|
+
* Retrieve a secret value.
|
|
5
|
+
* @param tenantId - Tenant identifier.
|
|
6
|
+
* @param key - Secret key name.
|
|
7
|
+
* @returns The secret value, or null if not found.
|
|
8
|
+
*/
|
|
9
|
+
getSecret(tenantId: string, key: string): Promise<string | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Store or update a secret value.
|
|
12
|
+
* @param tenantId - Tenant identifier.
|
|
13
|
+
* @param key - Secret key name.
|
|
14
|
+
* @param value - Secret value to store.
|
|
15
|
+
*/
|
|
16
|
+
setSecret(tenantId: string, key: string, value: string): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Delete a secret.
|
|
19
|
+
* @param tenantId - Tenant identifier.
|
|
20
|
+
* @param key - Secret key name.
|
|
21
|
+
*/
|
|
22
|
+
deleteSecret(tenantId: string, key: string): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* List all secret key names for a tenant.
|
|
25
|
+
* @param tenantId - Tenant identifier.
|
|
26
|
+
* @returns Array of secret key names.
|
|
27
|
+
*/
|
|
28
|
+
listKeys(tenantId: string): Promise<string[]>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/credential-vault/types.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEjE;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvE;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/credential-vault/types.ts"],"names":[],"mappings":""}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class ProviderError extends Error {
|
|
2
|
+
readonly provider: string;
|
|
3
|
+
readonly cause?: unknown | undefined;
|
|
4
|
+
constructor(message: string, provider: string, cause?: unknown | undefined);
|
|
5
|
+
}
|
|
6
|
+
export declare class ProviderAuthError extends ProviderError {
|
|
7
|
+
constructor(provider: string, message?: string, cause?: unknown);
|
|
8
|
+
}
|
|
9
|
+
export declare class ProviderApiError extends ProviderError {
|
|
10
|
+
readonly statusCode: number;
|
|
11
|
+
readonly statusText: string;
|
|
12
|
+
readonly responseBody?: string | undefined;
|
|
13
|
+
constructor(provider: string, statusCode: number, statusText: string, responseBody?: string | undefined);
|
|
14
|
+
}
|
|
15
|
+
export declare class ProviderConfigError extends ProviderError {
|
|
16
|
+
constructor(provider: string, message: string);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;aAGpB,QAAQ,EAAE,MAAM;aAChB,KAAK,CAAC,EAAE,OAAO;gBAF/B,OAAO,EAAE,MAAM,EACC,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,OAAO,YAAA;CAKlC;AAED,qBAAa,iBAAkB,SAAQ,aAAa;gBACtC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAIhE;AAED,qBAAa,gBAAiB,SAAQ,aAAa;aAG/B,UAAU,EAAE,MAAM;aAClB,UAAU,EAAE,MAAM;aAClB,YAAY,CAAC,EAAE,MAAM;gBAHrC,QAAQ,EAAE,MAAM,EACA,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,YAAA;CAKxC;AAED,qBAAa,mBAAoB,SAAQ,aAAa;gBACxC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI9C"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export class ProviderError extends Error {
|
|
2
|
+
provider;
|
|
3
|
+
cause;
|
|
4
|
+
constructor(message, provider, cause) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.provider = provider;
|
|
7
|
+
this.cause = cause;
|
|
8
|
+
this.name = "ProviderError";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export class ProviderAuthError extends ProviderError {
|
|
12
|
+
constructor(provider, message, cause) {
|
|
13
|
+
super(message ?? `Authentication failed for ${provider}`, provider, cause);
|
|
14
|
+
this.name = "ProviderAuthError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class ProviderApiError extends ProviderError {
|
|
18
|
+
statusCode;
|
|
19
|
+
statusText;
|
|
20
|
+
responseBody;
|
|
21
|
+
constructor(provider, statusCode, statusText, responseBody) {
|
|
22
|
+
super(`${provider} API error: ${statusCode} ${statusText}`, provider);
|
|
23
|
+
this.statusCode = statusCode;
|
|
24
|
+
this.statusText = statusText;
|
|
25
|
+
this.responseBody = responseBody;
|
|
26
|
+
this.name = "ProviderApiError";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class ProviderConfigError extends ProviderError {
|
|
30
|
+
constructor(provider, message) {
|
|
31
|
+
super(`Invalid ${provider} configuration: ${message}`, provider);
|
|
32
|
+
this.name = "ProviderConfigError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAGpB;IACA;IAHlB,YACE,OAAe,EACC,QAAgB,EAChB,KAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,aAAQ,GAAR,QAAQ,CAAQ;QAChB,UAAK,GAAL,KAAK,CAAU;QAG/B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAClD,YAAY,QAAgB,EAAE,OAAgB,EAAE,KAAe;QAC7D,KAAK,CAAC,OAAO,IAAI,6BAA6B,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC3E,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,aAAa;IAG/B;IACA;IACA;IAJlB,YACE,QAAgB,EACA,UAAkB,EAClB,UAAkB,EAClB,YAAqB;QAErC,KAAK,CAAC,GAAG,QAAQ,eAAe,UAAU,IAAI,UAAU,EAAE,EAAE,QAAQ,CAAC,CAAC;QAJtD,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAQ;QAClB,iBAAY,GAAZ,YAAY,CAAS;QAGrC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IACpD,YAAY,QAAgB,EAAE,OAAe;QAC3C,KAAK,CAAC,WAAW,QAAQ,mBAAmB,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;QACjE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { IncidentProvider, Incident, IncidentCreateOptions, OnCallEntry } from "./types.js";
|
|
2
|
+
export { pagerduty, pagerdutyConfigSchema, type PagerDutyConfig } from "./pagerduty.js";
|
|
3
|
+
export { opsgenie, opsgenieConfigSchema, type OpsGenieConfig } from "./opsgenie.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/incident/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEjG,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAExF,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/incident/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAwB,MAAM,gBAAgB,CAAC;AAExF,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAuB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Logger } from "../logger.js";
|
|
3
|
+
import type { IncidentProvider } from "./types.js";
|
|
4
|
+
export declare const opsgenieConfigSchema: z.ZodObject<{
|
|
5
|
+
apiKey: z.ZodString;
|
|
6
|
+
region: z.ZodDefault<z.ZodEnum<["us", "eu"]>>;
|
|
7
|
+
logger: z.ZodOptional<z.ZodType<Logger, z.ZodTypeDef, Logger>>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
region: "us" | "eu";
|
|
11
|
+
logger?: Logger | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
apiKey: string;
|
|
14
|
+
logger?: Logger | undefined;
|
|
15
|
+
region?: "us" | "eu" | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type OpsGenieConfig = z.infer<typeof opsgenieConfigSchema>;
|
|
18
|
+
export declare function opsgenie(config: OpsGenieConfig): IncidentProvider;
|
|
19
|
+
//# sourceMappingURL=opsgenie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opsgenie.d.ts","sourceRoot":"","sources":["../../src/incident/opsgenie.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,gBAAgB,EAAgD,MAAM,YAAY,CAAC;AAEjG,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAGjE"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { consoleLogger } from "../logger.js";
|
|
3
|
+
export const opsgenieConfigSchema = z.object({
|
|
4
|
+
apiKey: z.string().min(1, "OpsGenie API key is required"),
|
|
5
|
+
region: z.enum(["us", "eu"]).default("us"),
|
|
6
|
+
logger: z.custom().optional(),
|
|
7
|
+
});
|
|
8
|
+
export function opsgenie(config) {
|
|
9
|
+
const parsed = opsgenieConfigSchema.parse(config);
|
|
10
|
+
return new OpsGenieProvider(parsed);
|
|
11
|
+
}
|
|
12
|
+
class OpsGenieProvider {
|
|
13
|
+
apiKey;
|
|
14
|
+
baseUrl;
|
|
15
|
+
log;
|
|
16
|
+
constructor(config) {
|
|
17
|
+
this.apiKey = config.apiKey;
|
|
18
|
+
this.baseUrl = config.region === "eu" ? "https://api.eu.opsgenie.com" : "https://api.opsgenie.com";
|
|
19
|
+
this.log = config.logger ?? consoleLogger;
|
|
20
|
+
}
|
|
21
|
+
async apiRequest(path, opts) {
|
|
22
|
+
const url = `${this.baseUrl}${path}`;
|
|
23
|
+
const response = await fetch(url, {
|
|
24
|
+
method: opts?.method ?? "GET",
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `GenieKey ${this.apiKey}`,
|
|
27
|
+
"Content-Type": "application/json",
|
|
28
|
+
},
|
|
29
|
+
body: opts?.body ? JSON.stringify(opts.body) : undefined,
|
|
30
|
+
});
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
throw new Error(`OpsGenie API error: ${response.status} ${response.statusText}`);
|
|
33
|
+
}
|
|
34
|
+
return (await response.json());
|
|
35
|
+
}
|
|
36
|
+
async verifyAccess() {
|
|
37
|
+
this.log.info("Verifying OpsGenie access...");
|
|
38
|
+
await this.apiRequest("/v2/account");
|
|
39
|
+
this.log.info("OpsGenie API access verified");
|
|
40
|
+
}
|
|
41
|
+
async createIncident(opts) {
|
|
42
|
+
this.log.info(`Creating OpsGenie alert: ${opts.title}`);
|
|
43
|
+
const priority = opts.urgency === "low" ? "P3" : "P1";
|
|
44
|
+
const result = await this.apiRequest("/v2/alerts", {
|
|
45
|
+
method: "POST",
|
|
46
|
+
body: {
|
|
47
|
+
message: opts.title,
|
|
48
|
+
...(opts.description ? { description: opts.description } : {}),
|
|
49
|
+
priority,
|
|
50
|
+
...(opts.serviceId ? { tags: [opts.serviceId] } : {}),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
this.log.info(`OpsGenie alert created (id: ${result.data.alertId})`);
|
|
54
|
+
return {
|
|
55
|
+
id: result.data.alertId,
|
|
56
|
+
title: opts.title,
|
|
57
|
+
status: "triggered",
|
|
58
|
+
urgency: opts.urgency ?? "high",
|
|
59
|
+
url: `${this.baseUrl}/alert/detail/${result.data.alertId}`,
|
|
60
|
+
...(opts.serviceId ? { service: opts.serviceId } : {}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async acknowledgeIncident(id) {
|
|
64
|
+
this.log.info(`Acknowledging OpsGenie alert ${id}`);
|
|
65
|
+
await this.apiRequest(`/v2/alerts/${id}/acknowledge`, {
|
|
66
|
+
method: "POST",
|
|
67
|
+
body: {},
|
|
68
|
+
});
|
|
69
|
+
this.log.info(`OpsGenie alert ${id} acknowledged`);
|
|
70
|
+
}
|
|
71
|
+
async resolveIncident(id, resolution) {
|
|
72
|
+
this.log.info(`Resolving OpsGenie alert ${id}`);
|
|
73
|
+
await this.apiRequest(`/v2/alerts/${id}/close`, {
|
|
74
|
+
method: "POST",
|
|
75
|
+
body: {
|
|
76
|
+
...(resolution ? { note: resolution } : {}),
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
this.log.info(`OpsGenie alert ${id} resolved`);
|
|
80
|
+
}
|
|
81
|
+
async getOnCall(scheduleId) {
|
|
82
|
+
this.log.info("Fetching OpsGenie on-call schedule");
|
|
83
|
+
let resolvedScheduleId = scheduleId;
|
|
84
|
+
if (!resolvedScheduleId) {
|
|
85
|
+
const schedulesResult = await this.apiRequest("/v2/schedules");
|
|
86
|
+
if (schedulesResult.data.length === 0) {
|
|
87
|
+
this.log.warn("No OpsGenie schedules found");
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
resolvedScheduleId = schedulesResult.data[0].id;
|
|
91
|
+
this.log.info(`Using first schedule: ${schedulesResult.data[0].name} (${resolvedScheduleId})`);
|
|
92
|
+
}
|
|
93
|
+
const result = await this.apiRequest(`/v2/schedules/${resolvedScheduleId}/on-calls`);
|
|
94
|
+
const entries = result.data.onCallParticipants.map((participant) => ({
|
|
95
|
+
userId: participant.id,
|
|
96
|
+
name: participant.name,
|
|
97
|
+
}));
|
|
98
|
+
this.log.info(`Found ${entries.length} on-call entries`);
|
|
99
|
+
return entries;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=opsgenie.js.map
|