Files
simstudioai--sim/apps/sim/tools/onepassword/list_items.ts
T
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

142 lines
4.6 KiB
TypeScript

import type {
OnePasswordListItemsParams,
OnePasswordListItemsResponse,
} from '@/tools/onepassword/types'
import type { ToolConfig } from '@/tools/types'
export const listItemsTool: ToolConfig<OnePasswordListItemsParams, OnePasswordListItemsResponse> = {
id: 'onepassword_list_items',
name: '1Password List Items',
description: 'List items in a vault. Returns summaries without field values.',
version: '1.0.0',
params: {
connectionMode: {
type: 'string',
required: false,
description: 'Connection mode: "service_account" or "connect"',
},
serviceAccountToken: {
type: 'string',
required: false,
visibility: 'user-only',
description: '1Password Service Account token (for Service Account mode)',
},
apiKey: {
type: 'string',
required: false,
visibility: 'user-only',
description: '1Password Connect API token (for Connect Server mode)',
},
serverUrl: {
type: 'string',
required: false,
visibility: 'user-only',
description: '1Password Connect server URL (for Connect Server mode)',
},
vaultId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The vault UUID to list items from',
},
filter: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'SCIM filter expression (e.g., title eq "API Key" or tag eq "production")',
},
},
request: {
url: '/api/tools/onepassword/list-items',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
connectionMode: params.connectionMode,
serviceAccountToken: params.serviceAccountToken,
serverUrl: params.serverUrl,
apiKey: params.apiKey,
vaultId: params.vaultId,
filter: params.filter,
}),
},
transformResponse: async (response) => {
const data = await response.json()
if (data.error) {
return { success: false, output: { items: [] }, error: data.error }
}
const items = Array.isArray(data) ? data : [data]
return {
success: true,
output: {
items: items.map((item: any) => ({
id: item.id ?? null,
title: item.title ?? null,
vault: item.vault ?? null,
category: item.category ?? null,
urls: (item.urls ?? []).map((url: any) => ({
href: url.href ?? null,
label: url.label ?? null,
primary: url.primary ?? false,
})),
favorite: item.favorite ?? false,
tags: item.tags ?? [],
version: item.version ?? 0,
state: item.state ?? null,
createdAt: item.createdAt ?? null,
updatedAt: item.updatedAt ?? null,
lastEditedBy: item.lastEditedBy ?? null,
})),
},
}
},
outputs: {
items: {
type: 'array',
description: 'List of items in the vault (summaries without field values)',
items: {
type: 'object',
properties: {
id: { type: 'string', description: 'Item ID' },
title: { type: 'string', description: 'Item title' },
vault: {
type: 'object',
description: 'Vault reference',
properties: {
id: { type: 'string', description: 'Vault ID' },
},
},
category: { type: 'string', description: 'Item category (e.g., LOGIN, API_CREDENTIAL)' },
urls: {
type: 'array',
description: 'URLs associated with the item',
optional: true,
items: {
type: 'object',
properties: {
href: { type: 'string', description: 'URL' },
label: { type: 'string', description: 'URL label', optional: true },
primary: { type: 'boolean', description: 'Whether this is the primary URL' },
},
},
},
favorite: { type: 'boolean', description: 'Whether the item is favorited' },
tags: { type: 'array', description: 'Item tags' },
version: { type: 'number', description: 'Item version number' },
state: {
type: 'string',
description: 'Item state (ARCHIVED, or absent/null when active)',
optional: true,
},
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
updatedAt: { type: 'string', description: 'Last update timestamp', optional: true },
lastEditedBy: { type: 'string', description: 'ID of the last editor', optional: true },
},
},
},
},
}