@rafads/plugin-onepassword 1.5.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -0
- package/dist/OnePasswordSettings-YYVXN2JL.js +401 -0
- package/dist/OnePasswordSettings-YYVXN2JL.js.map +1 -0
- package/dist/api/group.d.ts +36 -0
- package/dist/api/handlers.d.ts +20 -0
- package/dist/api/index.d.ts +50 -0
- package/dist/chunk-JNJOYLVW.js +401 -0
- package/dist/chunk-JNJOYLVW.js.map +1 -0
- package/dist/chunk-OYHEG6OK.js +76 -0
- package/dist/chunk-OYHEG6OK.js.map +1 -0
- package/dist/client.js +20 -0
- package/dist/client.js.map +1 -0
- package/dist/core.js +39 -0
- package/dist/core.js.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/onepassword-sdk-BT5LZEVG.js +7 -0
- package/dist/onepassword-sdk-BT5LZEVG.js.map +1 -0
- package/dist/promise.d.ts +4 -0
- package/dist/react/OnePasswordSettings.d.ts +1 -0
- package/dist/react/atoms.d.ts +43 -0
- package/dist/react/client.d.ts +32 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/plugin-client.d.ts +2 -0
- package/dist/react/secret-provider-plugin.d.ts +2 -0
- package/dist/sdk/errors.d.ts +8 -0
- package/dist/sdk/index.d.ts +4 -0
- package/dist/sdk/onepassword-sdk.d.ts +3 -0
- package/dist/sdk/plugin.d.ts +49 -0
- package/dist/sdk/plugin.test.d.ts +1 -0
- package/dist/sdk/service.d.ts +35 -0
- package/dist/sdk/service.test.d.ts +1 -0
- package/dist/sdk/types.d.ts +88 -0
- package/package.json +77 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type OnePasswordPluginOptions } from "../sdk/plugin";
|
|
2
|
+
import { OnePasswordExtensionService } from "./handlers";
|
|
3
|
+
export { OnePasswordGroup } from "./group";
|
|
4
|
+
export { OnePasswordHandlers, OnePasswordExtensionService } from "./handlers";
|
|
5
|
+
export declare const onepasswordHttpPlugin: import("@rafads/sdk/core").ConfiguredPlugin<"onepassword", {
|
|
6
|
+
configure: (config: import("../promise").OnePasswordConfig) => import("effect/Effect").Effect<void, import("@rafads/sdk/core").StorageError, never>;
|
|
7
|
+
getConfig: () => import("effect/Effect").Effect<import("../sdk").RedactedOnePasswordConfig | null, import("@rafads/sdk/core").StorageError | import("../promise").OnePasswordError>;
|
|
8
|
+
removeConfig: () => import("effect/Effect").Effect<void, import("@rafads/sdk/core").StorageError, never>;
|
|
9
|
+
status: () => import("effect/Effect").Effect<{
|
|
10
|
+
readonly connected: boolean;
|
|
11
|
+
readonly error?: string | undefined;
|
|
12
|
+
readonly vaultName?: string | undefined;
|
|
13
|
+
}, import("@rafads/sdk/core").StorageError | import("../promise").OnePasswordError, never>;
|
|
14
|
+
listVaults: (auth: import("../promise").OnePasswordAuth) => import("effect/Effect").Effect<{
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
}[], import("../promise").OnePasswordError, never>;
|
|
18
|
+
resolve: (uri: string) => import("effect/Effect").Effect<string, import("@rafads/sdk/core").StorageError | import("../promise").OnePasswordError, never>;
|
|
19
|
+
}, import("../sdk").OnePasswordStore, OnePasswordPluginOptions, typeof OnePasswordExtensionService, import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").ApiGroup<"executor", "onepassword">, never, import("effect/unstable/http/HttpRouter").Request<"Requires", OnePasswordExtensionService>>, import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"onepassword", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getConfig", "GET", "/onepassword/config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
20
|
+
readonly auth: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
21
|
+
readonly kind: import("effect/Schema").Literal<"desktop-app">;
|
|
22
|
+
readonly accountName: import("effect/Schema").String;
|
|
23
|
+
}>, import("effect/Schema").Struct<{
|
|
24
|
+
readonly kind: import("effect/Schema").Literal<"service-account">;
|
|
25
|
+
}>]>;
|
|
26
|
+
readonly vaultId: import("effect/Schema").String;
|
|
27
|
+
readonly name: import("effect/Schema").String;
|
|
28
|
+
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/api").InternalError | typeof import("../promise").OnePasswordError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"configure", "PUT", "/onepassword/config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
29
|
+
readonly auth: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
30
|
+
readonly kind: import("effect/Schema").Literal<"desktop-app">;
|
|
31
|
+
readonly accountName: import("effect/Schema").String;
|
|
32
|
+
}>, import("effect/Schema").Struct<{
|
|
33
|
+
readonly kind: import("effect/Schema").Literal<"service-account">;
|
|
34
|
+
readonly token: import("effect/Schema").String;
|
|
35
|
+
}>]>;
|
|
36
|
+
readonly vaultId: import("effect/Schema").String;
|
|
37
|
+
readonly name: import("effect/Schema").String;
|
|
38
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Void>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/api").InternalError | typeof import("../promise").OnePasswordError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"removeConfig", "DELETE", "/onepassword/config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Void>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/api").InternalError | typeof import("../promise").OnePasswordError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"status", "GET", "/onepassword/status", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
39
|
+
readonly connected: import("effect/Schema").Boolean;
|
|
40
|
+
readonly vaultName: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
41
|
+
readonly error: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
42
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/api").InternalError | typeof import("../promise").OnePasswordError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"listVaults", "GET", "/onepassword/vaults", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
43
|
+
readonly authKind: import("effect/Schema").Literals<readonly ["desktop-app", "service-account"]>;
|
|
44
|
+
readonly account: import("effect/Schema").String;
|
|
45
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
46
|
+
readonly vaults: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
47
|
+
readonly id: import("effect/Schema").String;
|
|
48
|
+
readonly name: import("effect/Schema").String;
|
|
49
|
+
}>>;
|
|
50
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/api").InternalError | typeof import("../promise").OnePasswordError>, never, never>, false>>;
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConnectionStatus,
|
|
3
|
+
OnePasswordAuth,
|
|
4
|
+
OnePasswordConfig,
|
|
5
|
+
OnePasswordError,
|
|
6
|
+
RedactedOnePasswordConfig,
|
|
7
|
+
Vault,
|
|
8
|
+
redactConfig
|
|
9
|
+
} from "./chunk-OYHEG6OK.js";
|
|
10
|
+
|
|
11
|
+
// src/sdk/service.ts
|
|
12
|
+
import { Context, Duration, Effect, Semaphore } from "effect";
|
|
13
|
+
import * as op from "@1password/op-js";
|
|
14
|
+
var OnePasswordServiceTag = class extends Context.Service()("@rafads/plugin-onepassword/OnePasswordService") {
|
|
15
|
+
};
|
|
16
|
+
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
17
|
+
var MAX_ERROR_MESSAGE_LENGTH = 300;
|
|
18
|
+
var SERVICE_ACCOUNT_TOKEN_RE = /ops_[A-Za-z0-9_-]+/g;
|
|
19
|
+
var formatCause = (cause) => {
|
|
20
|
+
const maybeMessage = cause?.message;
|
|
21
|
+
const raw = (
|
|
22
|
+
// oxlint-disable-next-line executor/no-unknown-error-message -- boundary: last-resort stringification of a non-Error throwable
|
|
23
|
+
typeof maybeMessage === "string" && maybeMessage.length > 0 ? maybeMessage : String(cause)
|
|
24
|
+
);
|
|
25
|
+
return raw.replace(SERVICE_ACCOUNT_TOKEN_RE, "[redacted 1Password token]").replace(/\s+/g, " ").trim();
|
|
26
|
+
};
|
|
27
|
+
var messageWithCause = (prefix, cause) => {
|
|
28
|
+
const causeMessage = formatCause(cause);
|
|
29
|
+
const message = causeMessage ? `${prefix}: ${causeMessage}` : prefix;
|
|
30
|
+
return message.length > MAX_ERROR_MESSAGE_LENGTH ? `${message.slice(0, MAX_ERROR_MESSAGE_LENGTH - 3)}...` : message;
|
|
31
|
+
};
|
|
32
|
+
var hasOnePasswordSdkShape = (value) => {
|
|
33
|
+
const sdk = value;
|
|
34
|
+
return typeof sdk?.createClient === "function" && typeof sdk.DesktopAuth === "function";
|
|
35
|
+
};
|
|
36
|
+
var invalidOnePasswordSdkError = () => new OnePasswordError({
|
|
37
|
+
operation: "sdk module load",
|
|
38
|
+
message: [
|
|
39
|
+
"Failed to load 1Password SDK: the packaged SDK module did not expose createClient and DesktopAuth.",
|
|
40
|
+
"Install the 1Password CLI (`op`) in /opt/homebrew/bin or /usr/local/bin and retry, or update Executor."
|
|
41
|
+
].join(" ")
|
|
42
|
+
});
|
|
43
|
+
var loadOnePasswordSdk = () => Effect.tryPromise({
|
|
44
|
+
try: () => import("./onepassword-sdk-BT5LZEVG.js").then((module) => module.onePasswordSdk),
|
|
45
|
+
catch: (cause) => new OnePasswordError({
|
|
46
|
+
operation: "sdk module load",
|
|
47
|
+
message: messageWithCause("Failed to load 1Password SDK", cause)
|
|
48
|
+
})
|
|
49
|
+
}).pipe(
|
|
50
|
+
Effect.flatMap(
|
|
51
|
+
(sdk) => hasOnePasswordSdkShape(sdk) ? Effect.succeed(sdk) : Effect.fail(invalidOnePasswordSdkError())
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
var makeTimeoutMessage = (operation, timeoutMs) => [
|
|
55
|
+
`${operation}: timed out after ${Math.floor(timeoutMs / 1e3)}s.`,
|
|
56
|
+
"Troubleshooting:",
|
|
57
|
+
"1. Make sure the 1Password desktop app is open and unlocked",
|
|
58
|
+
"2. Check for an approval prompt in the 1Password app \u2014 it may be behind other windows",
|
|
59
|
+
"3. Ensure 'Developer > Connect with 1Password CLI' is enabled in 1Password Settings",
|
|
60
|
+
"4. Make sure no other app or terminal is waiting for 1Password approval (only one prompt at a time)",
|
|
61
|
+
"5. Try quitting 1Password completely and reopening it, then retry"
|
|
62
|
+
].join("\n");
|
|
63
|
+
var timeoutWithOnePasswordError = (operation, timeoutMs) => Effect.timeoutOrElse({
|
|
64
|
+
duration: Duration.millis(timeoutMs),
|
|
65
|
+
orElse: () => Effect.fail(
|
|
66
|
+
new OnePasswordError({
|
|
67
|
+
operation,
|
|
68
|
+
message: makeTimeoutMessage(operation, timeoutMs)
|
|
69
|
+
})
|
|
70
|
+
)
|
|
71
|
+
});
|
|
72
|
+
var makeNativeSdkService = (auth, timeoutMs = DEFAULT_TIMEOUT_MS) => Effect.gen(function* () {
|
|
73
|
+
const sdk = yield* loadOnePasswordSdk().pipe(
|
|
74
|
+
timeoutWithOnePasswordError("sdk module load", timeoutMs)
|
|
75
|
+
);
|
|
76
|
+
const client = yield* Effect.tryPromise({
|
|
77
|
+
try: () => sdk.createClient({
|
|
78
|
+
auth: auth.kind === "desktop-app" ? new sdk.DesktopAuth(auth.accountName) : auth.token,
|
|
79
|
+
integrationName: "Executor",
|
|
80
|
+
integrationVersion: "0.0.0"
|
|
81
|
+
}),
|
|
82
|
+
catch: (cause) => new OnePasswordError({
|
|
83
|
+
operation: "client setup",
|
|
84
|
+
message: messageWithCause("Failed to set up 1Password client", cause)
|
|
85
|
+
})
|
|
86
|
+
}).pipe(timeoutWithOnePasswordError("client setup", timeoutMs));
|
|
87
|
+
const wrap = (fn, operation) => Effect.tryPromise({
|
|
88
|
+
try: fn,
|
|
89
|
+
catch: (cause) => new OnePasswordError({
|
|
90
|
+
operation,
|
|
91
|
+
message: messageWithCause(`1Password SDK ${operation} failed`, cause)
|
|
92
|
+
})
|
|
93
|
+
}).pipe(
|
|
94
|
+
timeoutWithOnePasswordError(operation, timeoutMs),
|
|
95
|
+
Effect.withSpan(`onepassword.sdk.${operation}`)
|
|
96
|
+
);
|
|
97
|
+
return OnePasswordServiceTag.of({
|
|
98
|
+
resolveSecret: (uri) => wrap(() => client.secrets.resolve(uri), "secret resolution"),
|
|
99
|
+
listVaults: () => wrap(() => client.vaults.list({ decryptDetails: true }), "vault listing").pipe(
|
|
100
|
+
Effect.map((vaults) => vaults.map((v) => ({ id: v.id, title: v.title })))
|
|
101
|
+
),
|
|
102
|
+
listItems: (vaultId) => wrap(() => client.items.list(vaultId), "item listing").pipe(
|
|
103
|
+
Effect.map((items) => items.map((i) => ({ id: i.id, title: i.title })))
|
|
104
|
+
)
|
|
105
|
+
});
|
|
106
|
+
}).pipe(Effect.withSpan("onepassword.sdk.make_service"));
|
|
107
|
+
var cliAuthLock = Semaphore.makeUnsafe(1);
|
|
108
|
+
var makeCliService = (auth) => Effect.sync(() => {
|
|
109
|
+
const wrapSync = (fn, operation) => cliAuthLock.withPermits(1)(
|
|
110
|
+
Effect.try({
|
|
111
|
+
try: () => {
|
|
112
|
+
if (auth.kind === "service-account") {
|
|
113
|
+
op.setGlobalFlags({});
|
|
114
|
+
op.setServiceAccount(auth.token);
|
|
115
|
+
} else {
|
|
116
|
+
op.setServiceAccount("");
|
|
117
|
+
op.setGlobalFlags({ account: auth.accountName });
|
|
118
|
+
}
|
|
119
|
+
return fn();
|
|
120
|
+
},
|
|
121
|
+
catch: (cause) => new OnePasswordError({
|
|
122
|
+
operation,
|
|
123
|
+
message: messageWithCause(`1Password CLI ${operation} failed`, cause)
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
).pipe(Effect.withSpan(`onepassword.cli.${operation}`));
|
|
127
|
+
return OnePasswordServiceTag.of({
|
|
128
|
+
resolveSecret: (uri) => wrapSync(() => op.read.parse(uri), "secret resolution"),
|
|
129
|
+
listVaults: () => wrapSync(() => op.vault.list(), "vault listing").pipe(
|
|
130
|
+
Effect.map((vaults) => vaults.map((v) => ({ id: v.id, title: v.name })))
|
|
131
|
+
),
|
|
132
|
+
listItems: (vaultId) => wrapSync(() => op.item.list({ vault: vaultId }), "item listing").pipe(
|
|
133
|
+
Effect.map((items) => items.map((i) => ({ id: i.id, title: i.title })))
|
|
134
|
+
)
|
|
135
|
+
});
|
|
136
|
+
}).pipe(Effect.withSpan("onepassword.cli.make_service"));
|
|
137
|
+
var isCliUnavailable = (error) => {
|
|
138
|
+
const message = error.message.toLowerCase();
|
|
139
|
+
return message.includes("enoent") || message.includes("not found") || message.includes("command not found") || message.includes("not installed") || message.includes("no such file") || message.includes("spawn op");
|
|
140
|
+
};
|
|
141
|
+
var chooseFallbackError = (cliError, sdkError) => isCliUnavailable(cliError) ? sdkError : cliError;
|
|
142
|
+
var makeOnePasswordService = (auth, options) => {
|
|
143
|
+
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
144
|
+
if (options?.preferSdk) {
|
|
145
|
+
return makeNativeSdkService(auth, timeoutMs);
|
|
146
|
+
}
|
|
147
|
+
return Effect.gen(function* () {
|
|
148
|
+
const cliService = yield* makeCliService(auth);
|
|
149
|
+
const sdkService = yield* Effect.cached(makeNativeSdkService(auth, timeoutMs));
|
|
150
|
+
const withSdkFallback = (cliEffect, sdkEffect) => cliEffect.pipe(
|
|
151
|
+
Effect.catch(
|
|
152
|
+
(cliError) => sdkService.pipe(
|
|
153
|
+
Effect.flatMap(sdkEffect),
|
|
154
|
+
Effect.mapError(
|
|
155
|
+
(sdkError) => chooseFallbackError(cliError, sdkError)
|
|
156
|
+
)
|
|
157
|
+
)
|
|
158
|
+
)
|
|
159
|
+
);
|
|
160
|
+
return OnePasswordServiceTag.of({
|
|
161
|
+
resolveSecret: (uri) => withSdkFallback(cliService.resolveSecret(uri), (service) => service.resolveSecret(uri)),
|
|
162
|
+
listVaults: () => withSdkFallback(cliService.listVaults(), (service) => service.listVaults()),
|
|
163
|
+
listItems: (vaultId) => withSdkFallback(cliService.listItems(vaultId), (service) => service.listItems(vaultId))
|
|
164
|
+
});
|
|
165
|
+
}).pipe(Effect.withSpan("onepassword.make_service"));
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/sdk/plugin.ts
|
|
169
|
+
import { Effect as Effect2, Schema } from "effect";
|
|
170
|
+
import {
|
|
171
|
+
definePlugin,
|
|
172
|
+
StorageError,
|
|
173
|
+
ToolResult,
|
|
174
|
+
tool,
|
|
175
|
+
ProviderItemId,
|
|
176
|
+
ProviderKey
|
|
177
|
+
} from "@rafads/sdk/core";
|
|
178
|
+
var CREDENTIAL_FIELD = "credential";
|
|
179
|
+
var DEFAULT_TIMEOUT_MS2 = 15e3;
|
|
180
|
+
var CONFIG_KEY = "config";
|
|
181
|
+
var PROVIDER_KEY = ProviderKey.make("onepassword");
|
|
182
|
+
var schemaToStaticToolSchema = (schema) => Schema.toStandardSchemaV1(Schema.toStandardJSONSchemaV1(schema));
|
|
183
|
+
var OnePasswordConfigureInput = Schema.Struct({
|
|
184
|
+
auth: OnePasswordAuth,
|
|
185
|
+
vaultId: Schema.String,
|
|
186
|
+
name: Schema.String
|
|
187
|
+
});
|
|
188
|
+
var OnePasswordConfigureOutput = Schema.Struct({
|
|
189
|
+
configured: Schema.Boolean
|
|
190
|
+
});
|
|
191
|
+
var OnePasswordGetConfigOutput = Schema.Struct({
|
|
192
|
+
config: Schema.NullOr(RedactedOnePasswordConfig)
|
|
193
|
+
});
|
|
194
|
+
var OnePasswordListVaultsInput = OnePasswordAuth;
|
|
195
|
+
var OnePasswordListVaultsOutput = Schema.Struct({
|
|
196
|
+
vaults: Schema.Array(Vault)
|
|
197
|
+
});
|
|
198
|
+
var OnePasswordRemoveConfigOutput = Schema.Struct({
|
|
199
|
+
removed: Schema.Boolean
|
|
200
|
+
});
|
|
201
|
+
var OnePasswordStatusOutput = ConnectionStatus;
|
|
202
|
+
var OnePasswordConfigureInputStd = schemaToStaticToolSchema(OnePasswordConfigureInput);
|
|
203
|
+
var OnePasswordConfigureOutputStd = schemaToStaticToolSchema(OnePasswordConfigureOutput);
|
|
204
|
+
var OnePasswordGetConfigOutputStd = schemaToStaticToolSchema(OnePasswordGetConfigOutput);
|
|
205
|
+
var OnePasswordListVaultsInputStd = schemaToStaticToolSchema(OnePasswordListVaultsInput);
|
|
206
|
+
var OnePasswordListVaultsOutputStd = schemaToStaticToolSchema(OnePasswordListVaultsOutput);
|
|
207
|
+
var OnePasswordRemoveConfigOutputStd = schemaToStaticToolSchema(OnePasswordRemoveConfigOutput);
|
|
208
|
+
var OnePasswordStatusOutputStd = schemaToStaticToolSchema(OnePasswordStatusOutput);
|
|
209
|
+
var decodeConfig = Schema.decodeUnknownEffect(Schema.fromJsonString(OnePasswordConfig));
|
|
210
|
+
var blobStorageError = (operation) => (cause) => new StorageError({
|
|
211
|
+
message: `onepassword blob ${operation} failed`,
|
|
212
|
+
cause
|
|
213
|
+
});
|
|
214
|
+
var makeOnePasswordStore = (blobs) => ({
|
|
215
|
+
getConfig: () => blobs.get(CONFIG_KEY).pipe(
|
|
216
|
+
Effect2.mapError(blobStorageError("read")),
|
|
217
|
+
Effect2.flatMap((raw) => {
|
|
218
|
+
if (raw === null) return Effect2.succeed(null);
|
|
219
|
+
return decodeConfig(raw).pipe(
|
|
220
|
+
Effect2.mapError(
|
|
221
|
+
() => new OnePasswordError({
|
|
222
|
+
operation: "config decode",
|
|
223
|
+
message: "Failed to decode 1Password config"
|
|
224
|
+
})
|
|
225
|
+
)
|
|
226
|
+
);
|
|
227
|
+
})
|
|
228
|
+
),
|
|
229
|
+
saveConfig: (config, owner) => blobs.put(
|
|
230
|
+
CONFIG_KEY,
|
|
231
|
+
JSON.stringify({
|
|
232
|
+
auth: config.auth,
|
|
233
|
+
vaultId: config.vaultId,
|
|
234
|
+
name: config.name
|
|
235
|
+
}),
|
|
236
|
+
{ owner }
|
|
237
|
+
).pipe(Effect2.mapError(blobStorageError("write"))),
|
|
238
|
+
deleteConfig: (owner) => blobs.delete(CONFIG_KEY, { owner }).pipe(Effect2.mapError(blobStorageError("delete")))
|
|
239
|
+
});
|
|
240
|
+
var resolveAuth = (auth) => auth.kind === "desktop-app" ? { kind: "desktop-app", accountName: auth.accountName } : { kind: "service-account", token: auth.token };
|
|
241
|
+
var getServiceFromConfig = (config, timeoutMs, preferSdk) => makeOnePasswordService(resolveAuth(config.auth), { timeoutMs, preferSdk });
|
|
242
|
+
var configuredVaultUri = (config, itemId) => {
|
|
243
|
+
if (!itemId.startsWith("op://")) {
|
|
244
|
+
return `op://${config.vaultId}/${itemId}/${CREDENTIAL_FIELD}`;
|
|
245
|
+
}
|
|
246
|
+
const match = itemId.match(/^op:\/\/([^/]+)\/.+/);
|
|
247
|
+
if (!match || match[1] !== config.vaultId) return null;
|
|
248
|
+
return itemId;
|
|
249
|
+
};
|
|
250
|
+
var makeProvider = (ctx, timeoutMs, preferSdk) => ({
|
|
251
|
+
key: PROVIDER_KEY,
|
|
252
|
+
writable: false,
|
|
253
|
+
get: (id) => ctx.storage.getConfig().pipe(
|
|
254
|
+
Effect2.flatMap((config) => {
|
|
255
|
+
if (!config) return Effect2.succeed(null);
|
|
256
|
+
const uri = configuredVaultUri(config, id);
|
|
257
|
+
if (uri === null) return Effect2.succeed(null);
|
|
258
|
+
return getServiceFromConfig(config, timeoutMs, preferSdk).pipe(
|
|
259
|
+
Effect2.flatMap((svc) => svc.resolveSecret(uri)),
|
|
260
|
+
Effect2.map((v) => v),
|
|
261
|
+
Effect2.orElseSucceed(() => null)
|
|
262
|
+
);
|
|
263
|
+
}),
|
|
264
|
+
Effect2.catch(() => Effect2.succeed(null))
|
|
265
|
+
),
|
|
266
|
+
list: () => ctx.storage.getConfig().pipe(
|
|
267
|
+
Effect2.flatMap((config) => {
|
|
268
|
+
if (!config) return Effect2.succeed([]);
|
|
269
|
+
return getServiceFromConfig(config, timeoutMs, preferSdk).pipe(
|
|
270
|
+
Effect2.flatMap((svc) => svc.listItems(config.vaultId)),
|
|
271
|
+
Effect2.map(
|
|
272
|
+
(items) => items.map((item2) => ({ id: ProviderItemId.make(item2.id), name: item2.title }))
|
|
273
|
+
)
|
|
274
|
+
);
|
|
275
|
+
}),
|
|
276
|
+
Effect2.catch(() => Effect2.succeed([]))
|
|
277
|
+
)
|
|
278
|
+
});
|
|
279
|
+
var ownerForCtx = (ctx) => ctx.owner.subject === null ? "org" : "user";
|
|
280
|
+
var makeOnePasswordExtension = (ctx, timeoutMs, preferSdk) => {
|
|
281
|
+
return {
|
|
282
|
+
configure: (config) => ctx.storage.saveConfig(config, ownerForCtx(ctx)),
|
|
283
|
+
getConfig: () => ctx.storage.getConfig().pipe(Effect2.map((config) => config ? redactConfig(config) : null)),
|
|
284
|
+
removeConfig: () => ctx.storage.deleteConfig(ownerForCtx(ctx)),
|
|
285
|
+
status: () => Effect2.gen(function* () {
|
|
286
|
+
const config = yield* ctx.storage.getConfig();
|
|
287
|
+
if (!config) {
|
|
288
|
+
return ConnectionStatus.make({
|
|
289
|
+
connected: false,
|
|
290
|
+
error: "Not configured"
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
const svc = yield* getServiceFromConfig(config, timeoutMs, preferSdk);
|
|
294
|
+
const vaults = yield* svc.listVaults();
|
|
295
|
+
const vault2 = vaults.find((v) => v.id === config.vaultId);
|
|
296
|
+
return ConnectionStatus.make({
|
|
297
|
+
connected: true,
|
|
298
|
+
vaultName: vault2?.title
|
|
299
|
+
});
|
|
300
|
+
}),
|
|
301
|
+
listVaults: (auth) => Effect2.gen(function* () {
|
|
302
|
+
const svc = yield* makeOnePasswordService(resolveAuth(auth), {
|
|
303
|
+
timeoutMs,
|
|
304
|
+
preferSdk
|
|
305
|
+
});
|
|
306
|
+
const vaults = yield* svc.listVaults();
|
|
307
|
+
return vaults.map((v) => Vault.make({ id: v.id, name: v.title })).sort((a, b) => a.name.localeCompare(b.name));
|
|
308
|
+
}),
|
|
309
|
+
resolve: (uri) => Effect2.gen(function* () {
|
|
310
|
+
const config = yield* ctx.storage.getConfig();
|
|
311
|
+
if (!config) {
|
|
312
|
+
return yield* new OnePasswordError({
|
|
313
|
+
operation: "resolve",
|
|
314
|
+
message: "1Password is not configured"
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
const scopedUri = configuredVaultUri(config, uri);
|
|
318
|
+
if (scopedUri === null) {
|
|
319
|
+
return yield* new OnePasswordError({
|
|
320
|
+
operation: "resolve",
|
|
321
|
+
message: "1Password secret URI is outside the configured vault"
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
const svc = yield* getServiceFromConfig(config, timeoutMs, preferSdk);
|
|
325
|
+
return yield* svc.resolveSecret(scopedUri);
|
|
326
|
+
})
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
var onepasswordPlugin = definePlugin((options) => {
|
|
330
|
+
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS2;
|
|
331
|
+
const preferSdk = options?.preferSdk;
|
|
332
|
+
return {
|
|
333
|
+
id: "onepassword",
|
|
334
|
+
packageName: "@rafads/plugin-onepassword",
|
|
335
|
+
storage: ({ blobs }) => makeOnePasswordStore(blobs),
|
|
336
|
+
extension: (ctx) => makeOnePasswordExtension(ctx, timeoutMs, preferSdk),
|
|
337
|
+
staticIntegrations: (self) => [
|
|
338
|
+
{
|
|
339
|
+
id: "onepassword",
|
|
340
|
+
kind: "executor",
|
|
341
|
+
name: "1Password",
|
|
342
|
+
tools: [
|
|
343
|
+
tool({
|
|
344
|
+
name: "status",
|
|
345
|
+
description: "Check whether the 1Password credential provider is configured and can reach its selected vault. This returns status only, never secret values.",
|
|
346
|
+
outputSchema: OnePasswordStatusOutputStd,
|
|
347
|
+
execute: () => Effect2.map(self.status(), ToolResult.ok)
|
|
348
|
+
}),
|
|
349
|
+
tool({
|
|
350
|
+
name: "getConfig",
|
|
351
|
+
description: "Read the current 1Password provider configuration. This returns account/vault metadata only; service-account token values are never returned.",
|
|
352
|
+
outputSchema: OnePasswordGetConfigOutputStd,
|
|
353
|
+
execute: () => Effect2.map(self.getConfig(), (config) => ToolResult.ok({ config }))
|
|
354
|
+
}),
|
|
355
|
+
tool({
|
|
356
|
+
name: "listVaults",
|
|
357
|
+
description: "List available 1Password vaults before configuring the provider. For service-account auth, pass the service account token directly.",
|
|
358
|
+
inputSchema: OnePasswordListVaultsInputStd,
|
|
359
|
+
outputSchema: OnePasswordListVaultsOutputStd,
|
|
360
|
+
execute: (input) => Effect2.map(self.listVaults(input), (vaults) => ToolResult.ok({ vaults }))
|
|
361
|
+
}),
|
|
362
|
+
tool({
|
|
363
|
+
name: "configure",
|
|
364
|
+
description: "Configure the 1Password credential provider for the acting owner. Use desktop-app auth for local biometric access, or service-account auth with the token. The token is stored in the plugin's owner-partitioned config and never surfaced again.",
|
|
365
|
+
annotations: {
|
|
366
|
+
requiresApproval: true,
|
|
367
|
+
approvalDescription: "Configure the 1Password credential provider"
|
|
368
|
+
},
|
|
369
|
+
inputSchema: OnePasswordConfigureInputStd,
|
|
370
|
+
outputSchema: OnePasswordConfigureOutputStd,
|
|
371
|
+
execute: (input) => Effect2.as(
|
|
372
|
+
self.configure({ auth: input.auth, vaultId: input.vaultId, name: input.name }),
|
|
373
|
+
ToolResult.ok({ configured: true })
|
|
374
|
+
)
|
|
375
|
+
}),
|
|
376
|
+
tool({
|
|
377
|
+
name: "removeConfig",
|
|
378
|
+
description: "Remove the 1Password provider configuration for the acting owner. Future 1Password secret resolution stops until reconfigured.",
|
|
379
|
+
annotations: {
|
|
380
|
+
requiresApproval: true,
|
|
381
|
+
approvalDescription: "Remove the 1Password credential provider configuration"
|
|
382
|
+
},
|
|
383
|
+
outputSchema: OnePasswordRemoveConfigOutputStd,
|
|
384
|
+
execute: () => Effect2.as(self.removeConfig(), ToolResult.ok({ removed: true }))
|
|
385
|
+
})
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
],
|
|
389
|
+
credentialProviders: (ctx) => [makeProvider(ctx, timeoutMs, preferSdk)]
|
|
390
|
+
};
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
export {
|
|
394
|
+
OnePasswordServiceTag,
|
|
395
|
+
makeNativeSdkService,
|
|
396
|
+
makeCliService,
|
|
397
|
+
makeOnePasswordService,
|
|
398
|
+
makeOnePasswordStore,
|
|
399
|
+
onepasswordPlugin
|
|
400
|
+
};
|
|
401
|
+
//# sourceMappingURL=chunk-JNJOYLVW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk/service.ts","../src/sdk/plugin.ts"],"sourcesContent":["import { Context, Duration, Effect, Semaphore } from \"effect\";\nimport * as op from \"@1password/op-js\";\n\nimport { OnePasswordError } from \"./errors\";\nimport type { OnePasswordSdkModule } from \"./onepassword-sdk\";\n\n// ---------------------------------------------------------------------------\n// Canonical service interface — all backends (SDK, CLI) implement this\n// ---------------------------------------------------------------------------\n\nexport interface OnePasswordVault {\n readonly id: string;\n readonly title: string;\n}\n\nexport interface OnePasswordItem {\n readonly id: string;\n readonly title: string;\n}\n\nexport interface OnePasswordService {\n /** Resolve a secret by op:// URI */\n readonly resolveSecret: (uri: string) => Effect.Effect<string, OnePasswordError>;\n\n /** List accessible vaults */\n readonly listVaults: () => Effect.Effect<ReadonlyArray<OnePasswordVault>, OnePasswordError>;\n\n /** List items in a vault */\n readonly listItems: (\n vaultId: string,\n ) => Effect.Effect<ReadonlyArray<OnePasswordItem>, OnePasswordError>;\n}\n\nexport class OnePasswordServiceTag extends Context.Service<\n OnePasswordServiceTag,\n OnePasswordService\n>()(\"@rafads/plugin-onepassword/OnePasswordService\") {}\n\n// ---------------------------------------------------------------------------\n// Resolved auth — raw credentials ready for any backend\n// ---------------------------------------------------------------------------\n\nexport type ResolvedAuth =\n | { readonly kind: \"desktop-app\"; readonly accountName: string }\n | { readonly kind: \"service-account\"; readonly token: string };\n\n// ---------------------------------------------------------------------------\n// SDK backend — uses @1password/sdk native IPC\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_TIMEOUT_MS = 15_000;\nconst MAX_ERROR_MESSAGE_LENGTH = 300;\nconst SERVICE_ACCOUNT_TOKEN_RE = /ops_[A-Za-z0-9_-]+/g;\n\nconst formatCause = (cause: unknown): string => {\n // oxlint-disable-next-line executor/no-unknown-error-message -- boundary: normalizing untyped op-js/SDK throwables into OnePasswordError.message\n const maybeMessage = (cause as { readonly message?: unknown } | null | undefined)?.message;\n const raw =\n // oxlint-disable-next-line executor/no-unknown-error-message -- boundary: last-resort stringification of a non-Error throwable\n typeof maybeMessage === \"string\" && maybeMessage.length > 0 ? maybeMessage : String(cause);\n return raw\n .replace(SERVICE_ACCOUNT_TOKEN_RE, \"[redacted 1Password token]\")\n .replace(/\\s+/g, \" \")\n .trim();\n};\n\nconst messageWithCause = (prefix: string, cause: unknown): string => {\n const causeMessage = formatCause(cause);\n const message = causeMessage ? `${prefix}: ${causeMessage}` : prefix;\n return message.length > MAX_ERROR_MESSAGE_LENGTH\n ? `${message.slice(0, MAX_ERROR_MESSAGE_LENGTH - 3)}...`\n : message;\n};\n\nconst hasOnePasswordSdkShape = (value: unknown): value is OnePasswordSdkModule => {\n const sdk = value as Partial<OnePasswordSdkModule> | null | undefined;\n return typeof sdk?.createClient === \"function\" && typeof sdk.DesktopAuth === \"function\";\n};\n\nconst invalidOnePasswordSdkError = () =>\n new OnePasswordError({\n operation: \"sdk module load\",\n message: [\n \"Failed to load 1Password SDK: the packaged SDK module did not expose createClient and DesktopAuth.\",\n \"Install the 1Password CLI (`op`) in /opt/homebrew/bin or /usr/local/bin and retry, or update Executor.\",\n ].join(\" \"),\n });\n\nconst loadOnePasswordSdk = (): Effect.Effect<OnePasswordSdkModule, OnePasswordError> =>\n Effect.tryPromise({\n try: () => import(\"./onepassword-sdk\").then((module) => module.onePasswordSdk),\n catch: (cause) =>\n new OnePasswordError({\n operation: \"sdk module load\",\n message: messageWithCause(\"Failed to load 1Password SDK\", cause),\n }),\n }).pipe(\n Effect.flatMap((sdk) =>\n hasOnePasswordSdkShape(sdk) ? Effect.succeed(sdk) : Effect.fail(invalidOnePasswordSdkError()),\n ),\n );\n\nconst makeTimeoutMessage = (operation: string, timeoutMs: number): string =>\n [\n `${operation}: timed out after ${Math.floor(timeoutMs / 1000)}s.`,\n \"Troubleshooting:\",\n \"1. Make sure the 1Password desktop app is open and unlocked\",\n \"2. Check for an approval prompt in the 1Password app — it may be behind other windows\",\n \"3. Ensure 'Developer > Connect with 1Password CLI' is enabled in 1Password Settings\",\n \"4. Make sure no other app or terminal is waiting for 1Password approval (only one prompt at a time)\",\n \"5. Try quitting 1Password completely and reopening it, then retry\",\n ].join(\"\\n\");\n\nconst timeoutWithOnePasswordError = (operation: string, timeoutMs: number) =>\n Effect.timeoutOrElse({\n duration: Duration.millis(timeoutMs),\n orElse: () =>\n Effect.fail(\n new OnePasswordError({\n operation,\n message: makeTimeoutMessage(operation, timeoutMs),\n }),\n ),\n });\n\nexport const makeNativeSdkService = (\n auth: ResolvedAuth,\n timeoutMs: number = DEFAULT_TIMEOUT_MS,\n): Effect.Effect<OnePasswordService, OnePasswordError> =>\n Effect.gen(function* () {\n const sdk = yield* loadOnePasswordSdk().pipe(\n timeoutWithOnePasswordError(\"sdk module load\", timeoutMs),\n );\n\n const client = yield* Effect.tryPromise({\n try: () =>\n sdk.createClient({\n auth: auth.kind === \"desktop-app\" ? new sdk.DesktopAuth(auth.accountName) : auth.token,\n integrationName: \"Executor\",\n integrationVersion: \"0.0.0\",\n }),\n catch: (cause) =>\n new OnePasswordError({\n operation: \"client setup\",\n message: messageWithCause(\"Failed to set up 1Password client\", cause),\n }),\n }).pipe(timeoutWithOnePasswordError(\"client setup\", timeoutMs));\n\n const wrap = <A>(fn: () => Promise<A>, operation: string): Effect.Effect<A, OnePasswordError> =>\n Effect.tryPromise({\n try: fn,\n catch: (cause) =>\n new OnePasswordError({\n operation,\n message: messageWithCause(`1Password SDK ${operation} failed`, cause),\n }),\n }).pipe(\n timeoutWithOnePasswordError(operation, timeoutMs),\n Effect.withSpan(`onepassword.sdk.${operation}`),\n );\n\n return OnePasswordServiceTag.of({\n resolveSecret: (uri) => wrap(() => client.secrets.resolve(uri), \"secret resolution\"),\n\n listVaults: () =>\n wrap(() => client.vaults.list({ decryptDetails: true }), \"vault listing\").pipe(\n Effect.map((vaults) => vaults.map((v) => ({ id: v.id, title: v.title }))),\n ),\n\n listItems: (vaultId) =>\n wrap(() => client.items.list(vaultId), \"item listing\").pipe(\n Effect.map((items) => items.map((i) => ({ id: i.id, title: i.title }))),\n ),\n });\n }).pipe(Effect.withSpan(\"onepassword.sdk.make_service\"));\n\n// ---------------------------------------------------------------------------\n// CLI backend — uses @1password/op-js (shells out to `op` CLI)\n// ---------------------------------------------------------------------------\n\nconst cliAuthLock = Semaphore.makeUnsafe(1);\n\nexport const makeCliService = (\n auth: ResolvedAuth,\n): Effect.Effect<OnePasswordService, OnePasswordError> =>\n Effect.sync(() => {\n const wrapSync = <A>(fn: () => A, operation: string): Effect.Effect<A, OnePasswordError> =>\n cliAuthLock\n .withPermits(1)(\n Effect.try({\n try: () => {\n if (auth.kind === \"service-account\") {\n op.setGlobalFlags({});\n op.setServiceAccount(auth.token);\n } else {\n op.setServiceAccount(\"\");\n op.setGlobalFlags({ account: auth.accountName });\n }\n return fn();\n },\n catch: (cause) =>\n new OnePasswordError({\n operation,\n message: messageWithCause(`1Password CLI ${operation} failed`, cause),\n }),\n }),\n )\n .pipe(Effect.withSpan(`onepassword.cli.${operation}`));\n\n return OnePasswordServiceTag.of({\n resolveSecret: (uri) => wrapSync(() => op.read.parse(uri), \"secret resolution\"),\n\n listVaults: () =>\n wrapSync(() => op.vault.list(), \"vault listing\").pipe(\n Effect.map((vaults) => vaults.map((v) => ({ id: v.id, title: v.name }))),\n ),\n\n listItems: (vaultId) =>\n wrapSync(() => op.item.list({ vault: vaultId }), \"item listing\").pipe(\n Effect.map((items) => items.map((i) => ({ id: i.id, title: i.title }))),\n ),\n });\n }).pipe(Effect.withSpan(\"onepassword.cli.make_service\"));\n\n// ---------------------------------------------------------------------------\n// Smart factory — tries CLI first (avoids IPC hang), falls back to SDK\n// ---------------------------------------------------------------------------\n\nconst isCliUnavailable = (error: OnePasswordError): boolean => {\n // oxlint-disable-next-line executor/no-unknown-error-message -- boundary: OnePasswordError carries a typed `message`\n const message = error.message.toLowerCase();\n return (\n message.includes(\"enoent\") ||\n message.includes(\"not found\") ||\n message.includes(\"command not found\") ||\n message.includes(\"not installed\") ||\n message.includes(\"no such file\") ||\n message.includes(\"spawn op\")\n );\n};\n\nconst chooseFallbackError = (\n cliError: OnePasswordError,\n sdkError: OnePasswordError,\n): OnePasswordError => (isCliUnavailable(cliError) ? sdkError : cliError);\n\nexport const makeOnePasswordService = (\n auth: ResolvedAuth,\n options?: { readonly preferSdk?: boolean; readonly timeoutMs?: number },\n): Effect.Effect<OnePasswordService, OnePasswordError> => {\n const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n\n if (options?.preferSdk) {\n return makeNativeSdkService(auth, timeoutMs);\n }\n\n return Effect.gen(function* () {\n const cliService = yield* makeCliService(auth);\n const sdkService = yield* Effect.cached(makeNativeSdkService(auth, timeoutMs));\n\n const withSdkFallback = <A>(\n cliEffect: Effect.Effect<A, OnePasswordError>,\n sdkEffect: (service: OnePasswordService) => Effect.Effect<A, OnePasswordError>,\n ): Effect.Effect<A, OnePasswordError> =>\n cliEffect.pipe(\n Effect.catch((cliError: OnePasswordError) =>\n sdkService.pipe(\n Effect.flatMap(sdkEffect),\n Effect.mapError((sdkError: OnePasswordError) =>\n chooseFallbackError(cliError, sdkError),\n ),\n ),\n ),\n );\n\n return OnePasswordServiceTag.of({\n resolveSecret: (uri) =>\n withSdkFallback(cliService.resolveSecret(uri), (service) => service.resolveSecret(uri)),\n\n listVaults: () => withSdkFallback(cliService.listVaults(), (service) => service.listVaults()),\n\n listItems: (vaultId) =>\n withSdkFallback(cliService.listItems(vaultId), (service) => service.listItems(vaultId)),\n });\n }).pipe(Effect.withSpan(\"onepassword.make_service\"));\n};\n","import { Effect, Schema } from \"effect\";\n\nimport {\n definePlugin,\n StorageError,\n ToolResult,\n tool,\n ProviderItemId,\n ProviderKey,\n type CredentialProvider,\n type Owner,\n type PluginCtx,\n type PluginBlobStore,\n type ProviderEntry,\n type StaticToolSchema,\n type StorageFailure,\n} from \"@rafads/sdk/core\";\n\nimport {\n OnePasswordAuth,\n OnePasswordConfig,\n RedactedOnePasswordConfig,\n Vault,\n ConnectionStatus,\n redactConfig,\n} from \"./types\";\nimport { OnePasswordError } from \"./errors\";\nimport { makeOnePasswordService, type ResolvedAuth, type OnePasswordService } from \"./service\";\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\nconst CREDENTIAL_FIELD = \"credential\";\nconst DEFAULT_TIMEOUT_MS = 15_000;\nconst CONFIG_KEY = \"config\";\nconst PROVIDER_KEY = ProviderKey.make(\"onepassword\");\n\nconst schemaToStaticToolSchema = <A, I>(schema: Schema.Decoder<A, I>): StaticToolSchema<A, I> =>\n Schema.toStandardSchemaV1(Schema.toStandardJSONSchemaV1(schema) as never) as StaticToolSchema<\n A,\n I\n >;\n\nconst OnePasswordConfigureInput = Schema.Struct({\n auth: OnePasswordAuth,\n vaultId: Schema.String,\n name: Schema.String,\n});\n\nconst OnePasswordConfigureOutput = Schema.Struct({\n configured: Schema.Boolean,\n});\n\nconst OnePasswordGetConfigOutput = Schema.Struct({\n config: Schema.NullOr(RedactedOnePasswordConfig),\n});\n\nconst OnePasswordListVaultsInput = OnePasswordAuth;\n\nconst OnePasswordListVaultsOutput = Schema.Struct({\n vaults: Schema.Array(Vault),\n});\n\nconst OnePasswordRemoveConfigOutput = Schema.Struct({\n removed: Schema.Boolean,\n});\n\nconst OnePasswordStatusOutput = ConnectionStatus;\n\nconst OnePasswordConfigureInputStd = schemaToStaticToolSchema<\n typeof OnePasswordConfigureInput.Type,\n typeof OnePasswordConfigureInput.Encoded\n>(OnePasswordConfigureInput);\nconst OnePasswordConfigureOutputStd = schemaToStaticToolSchema(OnePasswordConfigureOutput);\nconst OnePasswordGetConfigOutputStd = schemaToStaticToolSchema(OnePasswordGetConfigOutput);\nconst OnePasswordListVaultsInputStd = schemaToStaticToolSchema<\n typeof OnePasswordListVaultsInput.Type,\n typeof OnePasswordListVaultsInput.Encoded\n>(OnePasswordListVaultsInput);\nconst OnePasswordListVaultsOutputStd = schemaToStaticToolSchema(OnePasswordListVaultsOutput);\nconst OnePasswordRemoveConfigOutputStd = schemaToStaticToolSchema(OnePasswordRemoveConfigOutput);\nconst OnePasswordStatusOutputStd = schemaToStaticToolSchema(OnePasswordStatusOutput);\n\n// ---------------------------------------------------------------------------\n// Shared failure alias.\n//\n// Every extension method either touches storage (`ctx.storage` blobs) or\n// reaches the 1Password backend. Storage I/O surfaces as `StorageFailure`;\n// the HTTP edge (`withCapture`) translates `StorageError` to\n// `InternalError({ traceId })`. Domain problems (not configured, backend RPC\n// failure) stay as `OnePasswordError` and encode to 502 via the schema\n// annotation on the class.\n// ---------------------------------------------------------------------------\n\nexport type OnePasswordExtensionFailure = OnePasswordError | StorageFailure;\n\n// ---------------------------------------------------------------------------\n// Typed config store — single blob, JSON encoded, owner-partitioned. The\n// stored config carries the auth credential (desktop account name, or\n// service-account token) plus the selected vault. v1 keyed this by executor\n// scope; v2 partitions by `owner` — the plugin-owned config row owns the\n// partition, mirroring the connection model. Blob I/O failures surface as\n// `StorageError`; decode failures stay `OnePasswordError`.\n// ---------------------------------------------------------------------------\n\nexport interface OnePasswordStore {\n readonly getConfig: () => Effect.Effect<\n OnePasswordConfig | null,\n StorageError | OnePasswordError\n >;\n readonly saveConfig: (\n config: OnePasswordConfig,\n owner: Owner,\n ) => Effect.Effect<void, StorageError>;\n readonly deleteConfig: (owner: Owner) => Effect.Effect<void, StorageError>;\n}\n\nconst decodeConfig = Schema.decodeUnknownEffect(Schema.fromJsonString(OnePasswordConfig));\n\nconst blobStorageError =\n (operation: string) =>\n (cause: unknown): StorageError =>\n new StorageError({\n message: `onepassword blob ${operation} failed`,\n cause,\n });\n\nexport const makeOnePasswordStore = (blobs: PluginBlobStore): OnePasswordStore => ({\n getConfig: () =>\n blobs.get(CONFIG_KEY).pipe(\n Effect.mapError(blobStorageError(\"read\")),\n Effect.flatMap((raw) => {\n if (raw === null) return Effect.succeed(null);\n return decodeConfig(raw).pipe(\n Effect.mapError(\n () =>\n new OnePasswordError({\n operation: \"config decode\",\n message: \"Failed to decode 1Password config\",\n }),\n ),\n );\n }),\n ),\n\n saveConfig: (config, owner) =>\n blobs\n .put(\n CONFIG_KEY,\n JSON.stringify({\n auth: config.auth,\n vaultId: config.vaultId,\n name: config.name,\n }),\n { owner },\n )\n .pipe(Effect.mapError(blobStorageError(\"write\"))),\n\n deleteConfig: (owner) =>\n blobs.delete(CONFIG_KEY, { owner }).pipe(Effect.mapError(blobStorageError(\"delete\"))),\n});\n\n// ---------------------------------------------------------------------------\n// Helpers — auth resolution + service construction\n// ---------------------------------------------------------------------------\n\nconst resolveAuth = (auth: OnePasswordAuth): ResolvedAuth =>\n auth.kind === \"desktop-app\"\n ? { kind: \"desktop-app\", accountName: auth.accountName }\n : { kind: \"service-account\", token: auth.token };\n\nconst getServiceFromConfig = (\n config: OnePasswordConfig,\n timeoutMs: number,\n preferSdk: boolean | undefined,\n): Effect.Effect<OnePasswordService, OnePasswordError> =>\n makeOnePasswordService(resolveAuth(config.auth), { timeoutMs, preferSdk });\n\nconst configuredVaultUri = (config: OnePasswordConfig, itemId: string): string | null => {\n if (!itemId.startsWith(\"op://\")) {\n return `op://${config.vaultId}/${itemId}/${CREDENTIAL_FIELD}`;\n }\n const match = itemId.match(/^op:\\/\\/([^/]+)\\/.+/);\n if (!match || match[1] !== config.vaultId) return null;\n return itemId;\n};\n\n// ---------------------------------------------------------------------------\n// CredentialProvider — read-only, resolves op:// URIs or vaultId-based lookups.\n//\n// v2: `get(id)` receives only an opaque `ProviderItemId` — no scope. The id is\n// either a fully-qualified `op://vault/item/field` URI or a bare item id that\n// the stored config's vault scopes. The plugin's stored config supplies the\n// auth + vault binding; the provider never writes (writable: false).\n// ---------------------------------------------------------------------------\n\nconst makeProvider = (\n ctx: PluginCtx<OnePasswordStore>,\n timeoutMs: number,\n preferSdk: boolean | undefined,\n): CredentialProvider => ({\n key: PROVIDER_KEY,\n writable: false,\n\n get: (id: ProviderItemId): Effect.Effect<string | null, StorageFailure> =>\n ctx.storage.getConfig().pipe(\n Effect.flatMap((config) => {\n if (!config) return Effect.succeed(null as string | null);\n\n const uri = configuredVaultUri(config, id);\n if (uri === null) return Effect.succeed(null as string | null);\n\n return getServiceFromConfig(config, timeoutMs, preferSdk).pipe(\n Effect.flatMap((svc) => svc.resolveSecret(uri)),\n Effect.map((v): string | null => v),\n Effect.orElseSucceed(() => null),\n );\n }),\n Effect.catch(() => Effect.succeed(null as string | null)),\n ),\n\n list: (): Effect.Effect<readonly ProviderEntry[], StorageFailure> =>\n ctx.storage.getConfig().pipe(\n Effect.flatMap((config) => {\n if (!config) return Effect.succeed([] as readonly ProviderEntry[]);\n return getServiceFromConfig(config, timeoutMs, preferSdk).pipe(\n Effect.flatMap((svc) => svc.listItems(config.vaultId)),\n Effect.map((items): readonly ProviderEntry[] =>\n items.map((item) => ({ id: ProviderItemId.make(item.id), name: item.title })),\n ),\n );\n }),\n Effect.catch(() => Effect.succeed([] as readonly ProviderEntry[])),\n ),\n});\n\n// ---------------------------------------------------------------------------\n// Owner resolution — config is a single shared 1Password binding. We persist\n// it under the `user` partition when the executor is bound to a subject, else\n// the shared `org` partition.\n// ---------------------------------------------------------------------------\n\nconst ownerForCtx = (ctx: PluginCtx<OnePasswordStore>): Owner =>\n ctx.owner.subject === null ? \"org\" : \"user\";\n\nconst makeOnePasswordExtension = (\n ctx: PluginCtx<OnePasswordStore>,\n timeoutMs: number,\n preferSdk: boolean | undefined,\n) => {\n return {\n configure: (config: OnePasswordConfig) => ctx.storage.saveConfig(config, ownerForCtx(ctx)),\n\n getConfig: (): Effect.Effect<\n RedactedOnePasswordConfig | null,\n StorageError | OnePasswordError\n > =>\n ctx.storage.getConfig().pipe(Effect.map((config) => (config ? redactConfig(config) : null))),\n\n removeConfig: () => ctx.storage.deleteConfig(ownerForCtx(ctx)),\n\n status: () =>\n Effect.gen(function* () {\n const config = yield* ctx.storage.getConfig();\n if (!config) {\n return ConnectionStatus.make({\n connected: false,\n error: \"Not configured\",\n });\n }\n const svc = yield* getServiceFromConfig(config, timeoutMs, preferSdk);\n const vaults = yield* svc.listVaults();\n const vault = vaults.find((v) => v.id === config.vaultId);\n return ConnectionStatus.make({\n connected: true,\n vaultName: vault?.title,\n });\n }),\n\n listVaults: (auth: OnePasswordAuth) =>\n Effect.gen(function* () {\n const svc = yield* makeOnePasswordService(resolveAuth(auth), {\n timeoutMs,\n preferSdk,\n });\n const vaults = yield* svc.listVaults();\n return vaults\n .map((v) => Vault.make({ id: v.id, name: v.title }))\n .sort((a, b) => a.name.localeCompare(b.name));\n }),\n\n resolve: (uri: string) =>\n Effect.gen(function* () {\n const config = yield* ctx.storage.getConfig();\n if (!config) {\n return yield* new OnePasswordError({\n operation: \"resolve\",\n message: \"1Password is not configured\",\n });\n }\n const scopedUri = configuredVaultUri(config, uri);\n if (scopedUri === null) {\n return yield* new OnePasswordError({\n operation: \"resolve\",\n message: \"1Password secret URI is outside the configured vault\",\n });\n }\n const svc = yield* getServiceFromConfig(config, timeoutMs, preferSdk);\n return yield* svc.resolveSecret(scopedUri);\n }),\n };\n};\n\nexport type OnePasswordExtension = ReturnType<typeof makeOnePasswordExtension>;\n\n// ---------------------------------------------------------------------------\n// Plugin factory\n// ---------------------------------------------------------------------------\n\nexport interface OnePasswordPluginOptions {\n /** Request timeout in ms (default: 15000) */\n readonly timeoutMs?: number;\n /** Force use of the native SDK instead of the CLI (default: false) */\n readonly preferSdk?: boolean;\n}\n\nexport const onepasswordPlugin = definePlugin((options?: OnePasswordPluginOptions) => {\n const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const preferSdk = options?.preferSdk;\n\n return {\n id: \"onepassword\" as const,\n packageName: \"@rafads/plugin-onepassword\",\n storage: ({ blobs }) => makeOnePasswordStore(blobs),\n\n extension: (ctx) => makeOnePasswordExtension(ctx, timeoutMs, preferSdk),\n\n staticIntegrations: (self) => [\n {\n id: \"onepassword\",\n kind: \"executor\",\n name: \"1Password\",\n tools: [\n tool({\n name: \"status\",\n description:\n \"Check whether the 1Password credential provider is configured and can reach its selected vault. This returns status only, never secret values.\",\n outputSchema: OnePasswordStatusOutputStd,\n execute: () => Effect.map(self.status(), ToolResult.ok),\n }),\n tool({\n name: \"getConfig\",\n description:\n \"Read the current 1Password provider configuration. This returns account/vault metadata only; service-account token values are never returned.\",\n outputSchema: OnePasswordGetConfigOutputStd,\n execute: () => Effect.map(self.getConfig(), (config) => ToolResult.ok({ config })),\n }),\n tool({\n name: \"listVaults\",\n description:\n \"List available 1Password vaults before configuring the provider. For service-account auth, pass the service account token directly.\",\n inputSchema: OnePasswordListVaultsInputStd,\n outputSchema: OnePasswordListVaultsOutputStd,\n execute: (input) =>\n Effect.map(self.listVaults(input), (vaults) => ToolResult.ok({ vaults })),\n }),\n tool({\n name: \"configure\",\n description:\n \"Configure the 1Password credential provider for the acting owner. Use desktop-app auth for local biometric access, or service-account auth with the token. The token is stored in the plugin's owner-partitioned config and never surfaced again.\",\n annotations: {\n requiresApproval: true,\n approvalDescription: \"Configure the 1Password credential provider\",\n },\n inputSchema: OnePasswordConfigureInputStd,\n outputSchema: OnePasswordConfigureOutputStd,\n execute: (input) =>\n Effect.as(\n self.configure({ auth: input.auth, vaultId: input.vaultId, name: input.name }),\n ToolResult.ok({ configured: true }),\n ),\n }),\n tool({\n name: \"removeConfig\",\n description:\n \"Remove the 1Password provider configuration for the acting owner. Future 1Password secret resolution stops until reconfigured.\",\n annotations: {\n requiresApproval: true,\n approvalDescription: \"Remove the 1Password credential provider configuration\",\n },\n outputSchema: OnePasswordRemoveConfigOutputStd,\n execute: () => Effect.as(self.removeConfig(), ToolResult.ok({ removed: true })),\n }),\n ],\n },\n ],\n\n credentialProviders: (ctx) => [makeProvider(ctx, timeoutMs, preferSdk)],\n };\n // HTTP transport (routes/handlers/extensionService) is layered on by\n // the api-aware factory in `@rafads/plugin-onepassword/api`. Hosts\n // that want the HTTP surface import the plugin from there; SDK-only\n // consumers stay on this entry and avoid the server-only deps.\n});\n"],"mappings":";;;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,GAAG,EAAE,SAAS,KAAK,CAAC,CAAC;AAAA,UAChF,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,IAEA,qBAAqB,CAAC,QAAQ,CAAC,aAAa,KAAK,WAAW,SAAS,CAAC;AAAA,EACxE;AAKF,CAAC;","names":["Effect","DEFAULT_TIMEOUT_MS","Effect","item","vault"]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// src/sdk/types.ts
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
var DesktopAppAuth = Schema.Struct({
|
|
4
|
+
kind: Schema.Literal("desktop-app"),
|
|
5
|
+
/** 1Password account domain, e.g. "my.1password.com" */
|
|
6
|
+
accountName: Schema.String
|
|
7
|
+
});
|
|
8
|
+
var ServiceAccountAuth = Schema.Struct({
|
|
9
|
+
kind: Schema.Literal("service-account"),
|
|
10
|
+
/** The service account token. Persisted in the plugin's owner-partitioned
|
|
11
|
+
* config blob — never surfaced to agents (`getConfig` redacts it). v1 stored
|
|
12
|
+
* this behind a separate secret id; v2 has no secrets table, so the
|
|
13
|
+
* plugin-owned config row carries it directly. */
|
|
14
|
+
token: Schema.String
|
|
15
|
+
});
|
|
16
|
+
var OnePasswordAuth = Schema.Union([DesktopAppAuth, ServiceAccountAuth]);
|
|
17
|
+
var OnePasswordConfig = Schema.Struct({
|
|
18
|
+
auth: OnePasswordAuth,
|
|
19
|
+
/** Vault to scope operations to */
|
|
20
|
+
vaultId: Schema.String,
|
|
21
|
+
/** Human label */
|
|
22
|
+
name: Schema.String
|
|
23
|
+
});
|
|
24
|
+
var RedactedDesktopAppAuth = DesktopAppAuth;
|
|
25
|
+
var RedactedServiceAccountAuth = Schema.Struct({
|
|
26
|
+
kind: Schema.Literal("service-account")
|
|
27
|
+
});
|
|
28
|
+
var RedactedOnePasswordAuth = Schema.Union([
|
|
29
|
+
RedactedDesktopAppAuth,
|
|
30
|
+
RedactedServiceAccountAuth
|
|
31
|
+
]);
|
|
32
|
+
var RedactedOnePasswordConfig = Schema.Struct({
|
|
33
|
+
auth: RedactedOnePasswordAuth,
|
|
34
|
+
vaultId: Schema.String,
|
|
35
|
+
name: Schema.String
|
|
36
|
+
});
|
|
37
|
+
var redactConfig = (config) => ({
|
|
38
|
+
auth: config.auth.kind === "desktop-app" ? { kind: "desktop-app", accountName: config.auth.accountName } : { kind: "service-account" },
|
|
39
|
+
vaultId: config.vaultId,
|
|
40
|
+
name: config.name
|
|
41
|
+
});
|
|
42
|
+
var Vault = Schema.Struct({
|
|
43
|
+
id: Schema.String,
|
|
44
|
+
name: Schema.String
|
|
45
|
+
});
|
|
46
|
+
var ConnectionStatus = Schema.Struct({
|
|
47
|
+
connected: Schema.Boolean,
|
|
48
|
+
vaultName: Schema.optional(Schema.String),
|
|
49
|
+
error: Schema.optional(Schema.String)
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// src/sdk/errors.ts
|
|
53
|
+
import { Schema as Schema2 } from "effect";
|
|
54
|
+
var OnePasswordError = class extends Schema2.TaggedErrorClass()(
|
|
55
|
+
"OnePasswordError",
|
|
56
|
+
{
|
|
57
|
+
operation: Schema2.String,
|
|
58
|
+
message: Schema2.String
|
|
59
|
+
},
|
|
60
|
+
{ httpApiStatus: 502 }
|
|
61
|
+
) {
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
DesktopAppAuth,
|
|
66
|
+
ServiceAccountAuth,
|
|
67
|
+
OnePasswordAuth,
|
|
68
|
+
OnePasswordConfig,
|
|
69
|
+
RedactedOnePasswordAuth,
|
|
70
|
+
RedactedOnePasswordConfig,
|
|
71
|
+
redactConfig,
|
|
72
|
+
Vault,
|
|
73
|
+
ConnectionStatus,
|
|
74
|
+
OnePasswordError
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=chunk-OYHEG6OK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk/types.ts","../src/sdk/errors.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\n// ---------------------------------------------------------------------------\n// Auth — how to talk to 1Password\n// ---------------------------------------------------------------------------\n\nexport const DesktopAppAuth = Schema.Struct({\n kind: Schema.Literal(\"desktop-app\"),\n /** 1Password account domain, e.g. \"my.1password.com\" */\n accountName: Schema.String,\n});\nexport type DesktopAppAuth = typeof DesktopAppAuth.Type;\n\nexport const ServiceAccountAuth = Schema.Struct({\n kind: Schema.Literal(\"service-account\"),\n /** The service account token. Persisted in the plugin's owner-partitioned\n * config blob — never surfaced to agents (`getConfig` redacts it). v1 stored\n * this behind a separate secret id; v2 has no secrets table, so the\n * plugin-owned config row carries it directly. */\n token: Schema.String,\n});\nexport type ServiceAccountAuth = typeof ServiceAccountAuth.Type;\n\nexport const OnePasswordAuth = Schema.Union([DesktopAppAuth, ServiceAccountAuth]);\nexport type OnePasswordAuth = typeof OnePasswordAuth.Type;\n\n// ---------------------------------------------------------------------------\n// Stored config — persisted via KV\n// ---------------------------------------------------------------------------\n\nexport const OnePasswordConfig = Schema.Struct({\n auth: OnePasswordAuth,\n /** Vault to scope operations to */\n vaultId: Schema.String,\n /** Human label */\n name: Schema.String,\n});\nexport type OnePasswordConfig = typeof OnePasswordConfig.Type;\n\n// ---------------------------------------------------------------------------\n// Redacted config — what `getConfig` returns to agents / the UI. The\n// service-account token is stripped; only the auth kind + account metadata is\n// surfaced.\n// ---------------------------------------------------------------------------\n\nexport const RedactedDesktopAppAuth = DesktopAppAuth;\n\nexport const RedactedServiceAccountAuth = Schema.Struct({\n kind: Schema.Literal(\"service-account\"),\n});\n\nexport const RedactedOnePasswordAuth = Schema.Union([\n RedactedDesktopAppAuth,\n RedactedServiceAccountAuth,\n]);\n\nexport const RedactedOnePasswordConfig = Schema.Struct({\n auth: RedactedOnePasswordAuth,\n vaultId: Schema.String,\n name: Schema.String,\n});\nexport type RedactedOnePasswordConfig = typeof RedactedOnePasswordConfig.Type;\n\n/** Strip the service-account token from a stored config for external exposure. */\nexport const redactConfig = (config: OnePasswordConfig): RedactedOnePasswordConfig => ({\n auth:\n config.auth.kind === \"desktop-app\"\n ? { kind: \"desktop-app\", accountName: config.auth.accountName }\n : { kind: \"service-account\" },\n vaultId: config.vaultId,\n name: config.name,\n});\n\n// ---------------------------------------------------------------------------\n// Vault\n// ---------------------------------------------------------------------------\n\nexport const Vault = Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n});\nexport type Vault = typeof Vault.Type;\n\n// ---------------------------------------------------------------------------\n// Connection status\n// ---------------------------------------------------------------------------\n\nexport const ConnectionStatus = Schema.Struct({\n connected: Schema.Boolean,\n vaultName: Schema.optional(Schema.String),\n error: Schema.optional(Schema.String),\n});\nexport type ConnectionStatus = typeof ConnectionStatus.Type;\n","import { Schema } from \"effect\";\n\nexport class OnePasswordError extends Schema.TaggedErrorClass<OnePasswordError>()(\n \"OnePasswordError\",\n {\n operation: Schema.String,\n message: Schema.String,\n },\n { httpApiStatus: 502 },\n) {}\n"],"mappings":";AAAA,SAAS,cAAc;AAMhB,IAAM,iBAAiB,OAAO,OAAO;AAAA,EAC1C,MAAM,OAAO,QAAQ,aAAa;AAAA;AAAA,EAElC,aAAa,OAAO;AACtB,CAAC;AAGM,IAAM,qBAAqB,OAAO,OAAO;AAAA,EAC9C,MAAM,OAAO,QAAQ,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtC,OAAO,OAAO;AAChB,CAAC;AAGM,IAAM,kBAAkB,OAAO,MAAM,CAAC,gBAAgB,kBAAkB,CAAC;AAOzE,IAAM,oBAAoB,OAAO,OAAO;AAAA,EAC7C,MAAM;AAAA;AAAA,EAEN,SAAS,OAAO;AAAA;AAAA,EAEhB,MAAM,OAAO;AACf,CAAC;AASM,IAAM,yBAAyB;AAE/B,IAAM,6BAA6B,OAAO,OAAO;AAAA,EACtD,MAAM,OAAO,QAAQ,iBAAiB;AACxC,CAAC;AAEM,IAAM,0BAA0B,OAAO,MAAM;AAAA,EAClD;AAAA,EACA;AACF,CAAC;AAEM,IAAM,4BAA4B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