openclaw-plugin-onepassword 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.
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Optional agent tools for 1Password vault/item operations.
3
+ *
4
+ * These run in-process (no exec sandbox) and are only registered when the
5
+ * operator sets `tools.enabled` (and `tools.allowWrite` for mutating tools).
6
+ * Read tools redact concealed field values by default so secrets are not
7
+ * casually surfaced into model context.
8
+ */
9
+ import { type TSchema } from "typebox";
10
+ import type { OnePasswordClient } from "./op-client.js";
11
+ /** Structural mirror of OpenClaw's AgentTool, kept local to avoid a hard SDK type import. */
12
+ export interface PluginTool {
13
+ name: string;
14
+ description: string;
15
+ label: string;
16
+ parameters: TSchema;
17
+ outputSchema?: TSchema;
18
+ execute: (toolCallId: string, params: unknown) => Promise<{
19
+ content: Array<{
20
+ type: "text";
21
+ text: string;
22
+ }>;
23
+ details: unknown;
24
+ }>;
25
+ }
26
+ export type ClientFactory = () => Promise<OnePasswordClient>;
27
+ export interface CreateToolsOptions {
28
+ getClient: ClientFactory;
29
+ allowWrite: boolean;
30
+ }
31
+ export declare function createTools(options: CreateToolsOptions): PluginTool[];
32
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,6FAA6F;AAC7F,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,CACP,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,KACZ,OAAO,CAAC;QAAE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACpF;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;CACrB;AA+FD,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,UAAU,EAAE,CA+LrE"}
package/dist/tools.js ADDED
@@ -0,0 +1,261 @@
1
+ /**
2
+ * Optional agent tools for 1Password vault/item operations.
3
+ *
4
+ * These run in-process (no exec sandbox) and are only registered when the
5
+ * operator sets `tools.enabled` (and `tools.allowWrite` for mutating tools).
6
+ * Read tools redact concealed field values by default so secrets are not
7
+ * casually surfaced into model context.
8
+ */
9
+ import { Type } from "typebox";
10
+ /** 1Password item categories accepted by the create/update tools. */
11
+ const ITEM_CATEGORIES = [
12
+ "Login",
13
+ "SecureNote",
14
+ "CreditCard",
15
+ "CryptoWallet",
16
+ "Identity",
17
+ "Password",
18
+ "Document",
19
+ "ApiCredentials",
20
+ "BankAccount",
21
+ "Database",
22
+ "DriverLicense",
23
+ "Email",
24
+ "MedicalRecord",
25
+ "Membership",
26
+ "OutdoorLicense",
27
+ "Passport",
28
+ "Rewards",
29
+ "Router",
30
+ "Server",
31
+ "SshKey",
32
+ "SocialSecurityNumber",
33
+ "SoftwareLicense",
34
+ "Person",
35
+ ];
36
+ const FIELD_TYPES = [
37
+ "Text",
38
+ "Concealed",
39
+ "CreditCardType",
40
+ "CreditCardNumber",
41
+ "Phone",
42
+ "Url",
43
+ "Totp",
44
+ "Email",
45
+ "Reference",
46
+ "Menu",
47
+ "MonthYear",
48
+ "Date",
49
+ ];
50
+ const CONCEALED_FIELD_TYPES = new Set(["Concealed", "Totp"]);
51
+ const FieldInput = Type.Object({
52
+ title: Type.String({ description: "Field label, e.g. 'password' or 'api_key'." }),
53
+ value: Type.String({ description: "Field value." }),
54
+ fieldType: Type.Optional(Type.Union(FIELD_TYPES.map((t) => Type.Literal(t)), { description: "Field type; defaults to 'Text' ('Concealed' for secrets)." })),
55
+ sectionId: Type.Optional(Type.String()),
56
+ });
57
+ function text(value) {
58
+ return { content: [{ type: "text", text: value }] };
59
+ }
60
+ function projectFields(fields, includeSecrets) {
61
+ return fields.map((field) => {
62
+ const concealed = CONCEALED_FIELD_TYPES.has(field.fieldType);
63
+ return {
64
+ id: field.id,
65
+ title: field.title,
66
+ fieldType: field.fieldType,
67
+ sectionId: field.sectionId,
68
+ value: concealed && !includeSecrets ? "<concealed>" : field.value,
69
+ };
70
+ });
71
+ }
72
+ function assertWriteEnabled(allowWrite, tool) {
73
+ if (!allowWrite) {
74
+ throw new Error(`Tool "${tool}" is disabled. Set plugins.entries.onepassword.config.tools.allowWrite = true to enable write operations.`);
75
+ }
76
+ }
77
+ export function createTools(options) {
78
+ const { getClient, allowWrite } = options;
79
+ const listVaults = {
80
+ name: "1password_list_vaults",
81
+ label: "List 1Password vaults",
82
+ description: "List all 1Password vaults accessible to the configured service account.",
83
+ parameters: Type.Object({}),
84
+ execute: async () => {
85
+ const client = await getClient();
86
+ const vaults = await client.listVaults();
87
+ const summary = vaults.map((v) => ({ id: v.id, title: v.title }));
88
+ return { ...text(JSON.stringify(summary, null, 2)), details: { vaults: summary } };
89
+ },
90
+ };
91
+ const ListItemsParams = Type.Object({
92
+ vaultId: Type.String({ description: "Vault ID (from 1password_list_vaults)." }),
93
+ });
94
+ const listItems = {
95
+ name: "1password_list_items",
96
+ label: "List 1Password items",
97
+ description: "List items in a 1Password vault. Returns overviews only (no field values).",
98
+ parameters: ListItemsParams,
99
+ execute: async (_id, raw) => {
100
+ const params = raw;
101
+ const client = await getClient();
102
+ const items = await client.listItems(params.vaultId);
103
+ const summary = items.map((i) => ({
104
+ id: i.id,
105
+ title: i.title,
106
+ category: i.category,
107
+ state: i.state,
108
+ }));
109
+ return { ...text(JSON.stringify(summary, null, 2)), details: { items: summary } };
110
+ },
111
+ };
112
+ const GetItemParams = Type.Object({
113
+ vaultId: Type.String(),
114
+ itemId: Type.String(),
115
+ includeSecrets: Type.Optional(Type.Boolean({
116
+ description: "Return concealed field values in plaintext. Defaults to false.",
117
+ })),
118
+ });
119
+ const getItem = {
120
+ name: "1password_get_item",
121
+ label: "Get 1Password item",
122
+ description: "Get a full 1Password item including its fields. Concealed values are redacted unless includeSecrets is true.",
123
+ parameters: GetItemParams,
124
+ execute: async (_id, raw) => {
125
+ const params = raw;
126
+ const client = await getClient();
127
+ const item = await client.getItem(params.vaultId, params.itemId);
128
+ const projected = {
129
+ id: item.id,
130
+ title: item.title,
131
+ category: item.category,
132
+ vaultId: item.vaultId,
133
+ tags: item.tags,
134
+ notes: item.notes,
135
+ fields: projectFields(item.fields, params.includeSecrets === true),
136
+ };
137
+ return { ...text(JSON.stringify(projected, null, 2)), details: projected };
138
+ },
139
+ };
140
+ const ReadFieldParams = Type.Object({
141
+ reference: Type.String({
142
+ description: "1Password secret reference, e.g. op://Vault/Item/field.",
143
+ pattern: "^op://",
144
+ }),
145
+ });
146
+ const readField = {
147
+ name: "1password_read_field",
148
+ label: "Read 1Password field",
149
+ description: "Resolve a single op:// secret reference to its value. Returns the secret in plaintext — use deliberately.",
150
+ parameters: ReadFieldParams,
151
+ execute: async (_id, raw) => {
152
+ const params = raw;
153
+ const client = await getClient();
154
+ const value = await client.resolve(params.reference);
155
+ return { ...text(value), details: { reference: params.reference, resolved: true } };
156
+ },
157
+ };
158
+ const tools = [listVaults, listItems, getItem, readField];
159
+ if (!allowWrite)
160
+ return tools;
161
+ const CreateItemParams = Type.Object({
162
+ vaultId: Type.String(),
163
+ title: Type.String(),
164
+ category: Type.Union(ITEM_CATEGORIES.map((c) => Type.Literal(c)), { description: "1Password item category." }),
165
+ fields: Type.Optional(Type.Array(FieldInput)),
166
+ tags: Type.Optional(Type.Array(Type.String())),
167
+ notes: Type.Optional(Type.String()),
168
+ });
169
+ const createItem = {
170
+ name: "1password_create_item",
171
+ label: "Create 1Password item",
172
+ description: "Create a new item in a 1Password vault.",
173
+ parameters: CreateItemParams,
174
+ execute: async (_id, raw) => {
175
+ assertWriteEnabled(allowWrite, "1password_create_item");
176
+ const params = raw;
177
+ const client = await getClient();
178
+ const created = await client.createItem({
179
+ vaultId: params.vaultId,
180
+ title: params.title,
181
+ // Enum values equal their string names in @1password/sdk.
182
+ category: params.category,
183
+ fields: mapFields(params.fields),
184
+ tags: params.tags,
185
+ notes: params.notes,
186
+ });
187
+ return {
188
+ ...text(`Created item ${created.id} (${created.title}).`),
189
+ details: { id: created.id, title: created.title, vaultId: created.vaultId },
190
+ };
191
+ },
192
+ };
193
+ const UpdateItemParams = Type.Object({
194
+ vaultId: Type.String(),
195
+ itemId: Type.String(),
196
+ title: Type.Optional(Type.String()),
197
+ fields: Type.Optional(Type.Array(FieldInput, {
198
+ description: "Replacement field set. When provided, replaces the item's fields.",
199
+ })),
200
+ tags: Type.Optional(Type.Array(Type.String())),
201
+ notes: Type.Optional(Type.String()),
202
+ });
203
+ const updateItem = {
204
+ name: "1password_update_item",
205
+ label: "Update 1Password item",
206
+ description: "Update an existing 1Password item. Fetches the current item, applies the provided changes, and saves it.",
207
+ parameters: UpdateItemParams,
208
+ execute: async (_id, raw) => {
209
+ assertWriteEnabled(allowWrite, "1password_update_item");
210
+ const params = raw;
211
+ const client = await getClient();
212
+ const current = await client.getItem(params.vaultId, params.itemId);
213
+ const next = {
214
+ ...current,
215
+ ...(params.title !== undefined ? { title: params.title } : {}),
216
+ ...(params.tags !== undefined ? { tags: params.tags } : {}),
217
+ ...(params.notes !== undefined ? { notes: params.notes } : {}),
218
+ ...(params.fields !== undefined ? { fields: mapFields(params.fields) } : {}),
219
+ };
220
+ const saved = await client.updateItem(next);
221
+ return {
222
+ ...text(`Updated item ${saved.id} (${saved.title}).`),
223
+ details: { id: saved.id, title: saved.title, version: saved.version },
224
+ };
225
+ },
226
+ };
227
+ const DeleteItemParams = Type.Object({
228
+ vaultId: Type.String(),
229
+ itemId: Type.String(),
230
+ });
231
+ const deleteItem = {
232
+ name: "1password_delete_item",
233
+ label: "Delete 1Password item",
234
+ description: "Permanently delete a 1Password item.",
235
+ parameters: DeleteItemParams,
236
+ execute: async (_id, raw) => {
237
+ assertWriteEnabled(allowWrite, "1password_delete_item");
238
+ const params = raw;
239
+ const client = await getClient();
240
+ await client.deleteItem(params.vaultId, params.itemId);
241
+ return {
242
+ ...text(`Deleted item ${params.itemId} from vault ${params.vaultId}.`),
243
+ details: { itemId: params.itemId, vaultId: params.vaultId, deleted: true },
244
+ };
245
+ },
246
+ };
247
+ tools.push(createItem, updateItem, deleteItem);
248
+ return tools;
249
+ }
250
+ function mapFields(fields) {
251
+ if (!fields)
252
+ return undefined;
253
+ return fields.map((f) => ({
254
+ id: f.title.toLowerCase().replace(/\s+/g, "_"),
255
+ title: f.title,
256
+ value: f.value,
257
+ fieldType: f.fieldType ?? "Text",
258
+ ...(f.sectionId ? { sectionId: f.sectionId } : {}),
259
+ }));
260
+ }
261
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAA6B,MAAM,SAAS,CAAC;AAwB1D,qEAAqE;AACrE,MAAM,eAAe,GAAG;IACtB,OAAO;IACP,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,UAAU;IACV,UAAU;IACV,UAAU;IACV,gBAAgB;IAChB,aAAa;IACb,UAAU;IACV,eAAe;IACf,OAAO;IACP,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,QA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,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACxB,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;QAC9C,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,MAAM;QAChC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnD,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Plugin version, reported to the 1Password SDK as the integration version and
3
+ * surfaced by the `onepassword.status` gateway method.
4
+ *
5
+ * Kept in sync with package.json by the `version-matches-package` unit test.
6
+ */
7
+ export declare const PLUGIN_VERSION = "0.1.0";
8
+ export declare const PLUGIN_ID = "onepassword";
9
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,eAAO,MAAM,SAAS,gBAAgB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Plugin version, reported to the 1Password SDK as the integration version and
3
+ * surfaced by the `onepassword.status` gateway method.
4
+ *
5
+ * Kept in sync with package.json by the `version-matches-package` unit test.
6
+ */
7
+ export const PLUGIN_VERSION = "0.1.0";
8
+ export const PLUGIN_ID = "onepassword";
9
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC"}
@@ -0,0 +1,58 @@
1
+ {
2
+ "$comment": "ADVANCED. Exec resolver via pluginIntegration, using op:// ids directly on SecretRefs. Runs as a sandboxed child process, so you MUST allowlist the 1Password API host under secrets.egressProxy for it to reach the network. Prefer store mode unless you specifically need op:// ids and native `openclaw secrets reload` re-fetching.",
3
+ "plugins": {
4
+ "entries": {
5
+ "onepassword": {
6
+ "enabled": true,
7
+ "config": {
8
+ "serviceAccountTokenEnvVar": "OP_SERVICE_ACCOUNT_TOKEN"
9
+ }
10
+ }
11
+ }
12
+ },
13
+ "secrets": {
14
+ "providers": {
15
+ "op": {
16
+ "source": "exec",
17
+ "pluginIntegration": { "pluginId": "onepassword", "integrationId": "op" }
18
+ }
19
+ },
20
+ "egressProxy": {
21
+ "enabled": true,
22
+ "allowedHosts": ["my.1password.com"]
23
+ }
24
+ },
25
+ "channels": {
26
+ "slack": {
27
+ "accounts": {
28
+ "myworkspace": {
29
+ "botToken": {
30
+ "source": "exec",
31
+ "provider": "op",
32
+ "id": "op://MyVault/SlackBot/bot_token"
33
+ },
34
+ "appToken": {
35
+ "source": "exec",
36
+ "provider": "op",
37
+ "id": "op://MyVault/SlackBot/app_token"
38
+ }
39
+ }
40
+ }
41
+ }
42
+ },
43
+ "agents": {
44
+ "defaults": {
45
+ "model": {
46
+ "providers": {
47
+ "openai": {
48
+ "apiKey": {
49
+ "source": "exec",
50
+ "provider": "op",
51
+ "id": "op://MyVault/OpenAI/credential"
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "$comment": "RECOMMENDED. In-process store sync. The plugin fetches op:// references from 1Password at startup and writes them into OpenClaw's shared store; SecretRefs use source:'store'. No secret values live in this file. Set OP_SERVICE_ACCOUNT_TOKEN on the Gateway process.",
3
+ "plugins": {
4
+ "entries": {
5
+ "onepassword": {
6
+ "enabled": true,
7
+ "config": {
8
+ "serviceAccountTokenEnvVar": "OP_SERVICE_ACCOUNT_TOKEN",
9
+ "syncOnStartup": true,
10
+ "secrets": {
11
+ "SLACK_BOT_TOKEN": "op://MyVault/SlackBot/bot_token",
12
+ "SLACK_APP_TOKEN": "op://MyVault/SlackBot/app_token",
13
+ "OPENAI_API_KEY": "op://MyVault/OpenAI/credential"
14
+ }
15
+ }
16
+ }
17
+ }
18
+ },
19
+ "channels": {
20
+ "slack": {
21
+ "accounts": {
22
+ "myworkspace": {
23
+ "botToken": { "source": "store", "id": "SLACK_BOT_TOKEN" },
24
+ "appToken": { "source": "store", "id": "SLACK_APP_TOKEN" }
25
+ }
26
+ }
27
+ }
28
+ },
29
+ "agents": {
30
+ "defaults": {
31
+ "model": {
32
+ "providers": {
33
+ "openai": {
34
+ "apiKey": { "source": "store", "id": "OPENAI_API_KEY" }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$comment": "Enable the 1Password agent tools so the AI can list vaults/items, read fields, and (opt-in) create/update/delete items. Runs in-process. Set OP_SERVICE_ACCOUNT_TOKEN on the Gateway process.",
3
+ "plugins": {
4
+ "entries": {
5
+ "onepassword": {
6
+ "enabled": true,
7
+ "config": {
8
+ "serviceAccountTokenEnvVar": "OP_SERVICE_ACCOUNT_TOKEN",
9
+ "tools": {
10
+ "enabled": true,
11
+ "allowWrite": false
12
+ }
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,104 @@
1
+ {
2
+ "id": "onepassword",
3
+ "name": "1Password",
4
+ "description": "Resolve 1Password secrets in-process into the OpenClaw shared store, and expose 1Password vault/item tools to agents.",
5
+ "version": "0.1.0",
6
+ "activation": {
7
+ "onStartup": true,
8
+ "onConfigPaths": ["plugins.entries.onepassword"]
9
+ },
10
+ "contracts": {
11
+ "tools": [
12
+ "1password_list_vaults",
13
+ "1password_list_items",
14
+ "1password_get_item",
15
+ "1password_read_field",
16
+ "1password_create_item",
17
+ "1password_update_item",
18
+ "1password_delete_item"
19
+ ],
20
+ "gatewayMethodDispatch": ["onepassword.sync", "onepassword.status"]
21
+ },
22
+ "toolMetadata": {
23
+ "1password_list_vaults": { "optional": true },
24
+ "1password_list_items": { "optional": true },
25
+ "1password_get_item": { "optional": true },
26
+ "1password_read_field": { "optional": true },
27
+ "1password_create_item": { "optional": true },
28
+ "1password_update_item": { "optional": true },
29
+ "1password_delete_item": { "optional": true }
30
+ },
31
+ "secretProviderIntegrations": {
32
+ "op": {
33
+ "providerAlias": "op",
34
+ "displayName": "1Password (exec resolver)",
35
+ "description": "Advanced/optional. Resolves op:// references via a child node resolver. Subject to the exec secret sandbox — requires egress allowlisting to reach the 1Password API. Prefer the in-process store sync for most setups.",
36
+ "source": "exec",
37
+ "command": "${node}",
38
+ "args": ["./dist/resolver.js"],
39
+ "jsonOnly": true,
40
+ "passEnv": ["PATH", "HOME", "OP_SERVICE_ACCOUNT_TOKEN"]
41
+ }
42
+ },
43
+ "configSchema": {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "properties": {
47
+ "serviceAccountTokenEnvVar": {
48
+ "type": "string",
49
+ "description": "Name of the environment variable holding the 1Password service account token.",
50
+ "default": "OP_SERVICE_ACCOUNT_TOKEN",
51
+ "minLength": 1
52
+ },
53
+ "integrationName": {
54
+ "type": "string",
55
+ "description": "Integration name reported to the 1Password SDK for audit logs.",
56
+ "default": "openclaw-plugin-onepassword"
57
+ },
58
+ "requestTimeoutMs": {
59
+ "type": "number",
60
+ "description": "Per-operation timeout for 1Password SDK calls, in milliseconds.",
61
+ "default": 15000,
62
+ "minimum": 1000
63
+ },
64
+ "syncOnStartup": {
65
+ "type": "boolean",
66
+ "description": "Fetch the configured `secrets` mapping from 1Password and write it into the OpenClaw store when the gateway starts.",
67
+ "default": true
68
+ },
69
+ "failFastOnStartup": {
70
+ "type": "boolean",
71
+ "description": "If true, a startup sync failure throws and prevents the gateway from starting. If false, the plugin logs the error and lets last-known-good store values be used.",
72
+ "default": false
73
+ },
74
+ "secrets": {
75
+ "type": "object",
76
+ "description": "Map of OpenClaw store key -> 1Password secret reference (op://Vault/Item[/Section]/Field). Store keys must match ^[A-Z][A-Z0-9_]{0,127}$.",
77
+ "propertyNames": { "pattern": "^[A-Z][A-Z0-9_]{0,127}$" },
78
+ "additionalProperties": {
79
+ "type": "string",
80
+ "pattern": "^op://"
81
+ },
82
+ "default": {}
83
+ },
84
+ "tools": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "description": "Agent tool exposure.",
88
+ "properties": {
89
+ "enabled": {
90
+ "type": "boolean",
91
+ "description": "Register the read-only 1Password agent tools.",
92
+ "default": false
93
+ },
94
+ "allowWrite": {
95
+ "type": "boolean",
96
+ "description": "Also register create/update/delete tools. Requires `enabled`.",
97
+ "default": false
98
+ }
99
+ },
100
+ "default": {}
101
+ }
102
+ }
103
+ }
104
+ }
package/package.json ADDED
@@ -0,0 +1,99 @@
1
+ {
2
+ "name": "openclaw-plugin-onepassword",
3
+ "version": "0.1.0",
4
+ "description": "Native OpenClaw plugin that resolves 1Password secrets in-process (no exec sandbox), plus agent tools for vault/item CRUD.",
5
+ "keywords": [
6
+ "openclaw",
7
+ "openclaw-plugin",
8
+ "1password",
9
+ "onepassword",
10
+ "secrets",
11
+ "secret-provider",
12
+ "service-account",
13
+ "vault"
14
+ ],
15
+ "license": "MIT",
16
+ "author": "OpenClaw 1Password plugin contributors",
17
+ "homepage": "https://github.com/ioleksiy/openclaw-plugin-onepassword#readme",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/ioleksiy/openclaw-plugin-onepassword.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/ioleksiy/openclaw-plugin-onepassword/issues"
24
+ },
25
+ "type": "module",
26
+ "engines": {
27
+ "node": ">=20.11.0"
28
+ },
29
+ "main": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.js"
35
+ },
36
+ "./resolver": {
37
+ "types": "./dist/resolver.d.ts",
38
+ "default": "./dist/resolver.js"
39
+ },
40
+ "./openclaw.plugin.json": "./openclaw.plugin.json"
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "openclaw.plugin.json",
45
+ "examples",
46
+ "README.md",
47
+ "LICENSE",
48
+ "CHANGELOG.md"
49
+ ],
50
+ "openclaw": {
51
+ "extensions": [
52
+ "./dist/index.js"
53
+ ],
54
+ "compat": {
55
+ "pluginApi": ">=2026.8.0",
56
+ "minGatewayVersion": "2026.8.0"
57
+ }
58
+ },
59
+ "scripts": {
60
+ "build": "tsc -p tsconfig.build.json",
61
+ "clean": "rimraf dist",
62
+ "typecheck": "tsc -p tsconfig.json --noEmit",
63
+ "lint": "eslint . --max-warnings 0",
64
+ "format": "prettier --write .",
65
+ "format:check": "prettier --check .",
66
+ "test": "vitest run",
67
+ "test:watch": "vitest",
68
+ "test:coverage": "vitest run --coverage",
69
+ "verify": "npm run typecheck && npm run lint && npm run format:check && npm test && npm run build",
70
+ "release:prepare": "node scripts/bump-version.mjs",
71
+ "prepack": "npm run clean && npm run build"
72
+ },
73
+ "dependencies": {
74
+ "@1password/sdk": "^0.5.0",
75
+ "typebox": "^1.3.17"
76
+ },
77
+ "peerDependencies": {
78
+ "openclaw": ">=2026.8.0"
79
+ },
80
+ "peerDependenciesMeta": {
81
+ "openclaw": {
82
+ "optional": false
83
+ }
84
+ },
85
+ "devDependencies": {
86
+ "@eslint/js": "^9.0.0",
87
+ "@types/node": "^22.0.0",
88
+ "@vitest/coverage-v8": "^2.1.0",
89
+ "eslint": "^9.0.0",
90
+ "eslint-config-prettier": "^9.1.0",
91
+ "globals": "^15.0.0",
92
+ "openclaw": ">=2026.8.0",
93
+ "prettier": "^3.3.0",
94
+ "rimraf": "^6.0.0",
95
+ "typescript": "^5.6.0",
96
+ "typescript-eslint": "^8.0.0",
97
+ "vitest": "^2.1.0"
98
+ }
99
+ }