chore: import upstream snapshot with attribution
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
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
This commit is contained in:
@@ -0,0 +1,254 @@
|
||||
import type {
|
||||
InfisicalCreateSecretParams,
|
||||
InfisicalCreateSecretResponse,
|
||||
} from '@/tools/infisical/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const createSecretTool: ToolConfig<
|
||||
InfisicalCreateSecretParams,
|
||||
InfisicalCreateSecretResponse
|
||||
> = {
|
||||
id: 'infisical_create_secret',
|
||||
name: 'Infisical Create Secret',
|
||||
description: 'Create a new secret in a project environment.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Infisical API token',
|
||||
},
|
||||
baseUrl: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Infisical instance URL (default: "https://us.infisical.com"). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL.',
|
||||
},
|
||||
projectId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the project',
|
||||
},
|
||||
environment: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The environment slug (e.g., "dev", "staging", "prod")',
|
||||
},
|
||||
secretName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the secret to create',
|
||||
},
|
||||
secretValue: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The value of the secret',
|
||||
},
|
||||
secretPath: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The path for the secret (default: "/")',
|
||||
},
|
||||
secretComment: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'A comment for the secret',
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Secret type: "shared" or "personal" (default: "shared")',
|
||||
},
|
||||
tagIds: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Comma-separated tag IDs to attach to the secret',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: (params) =>
|
||||
`${params.baseUrl?.replace(/\/+$/, '') ?? 'https://us.infisical.com'}/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}`,
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => {
|
||||
const body: Record<string, unknown> = {
|
||||
projectId: params.projectId,
|
||||
environment: params.environment,
|
||||
secretValue: params.secretValue,
|
||||
}
|
||||
if (params.secretPath) body.secretPath = params.secretPath
|
||||
if (params.secretComment) body.secretComment = params.secretComment
|
||||
if (params.type) body.type = params.type
|
||||
if (params.tagIds) {
|
||||
body.tagIds = params.tagIds.split(',').map((id) => id.trim())
|
||||
}
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
return {
|
||||
success: false,
|
||||
output: { secret: {} as InfisicalCreateSecretResponse['output']['secret'] },
|
||||
error: data.message ?? `Request failed with status ${response.status}`,
|
||||
}
|
||||
}
|
||||
const s = data.secret ?? data
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
secret: {
|
||||
id: s.id ?? null,
|
||||
workspace: s.workspace ?? null,
|
||||
secretKey: s.secretKey ?? null,
|
||||
secretValue: s.secretValue ?? null,
|
||||
secretComment: s.secretComment ?? null,
|
||||
secretPath: s.secretPath ?? null,
|
||||
version: s.version ?? null,
|
||||
type: s.type ?? null,
|
||||
environment: s.environment ?? null,
|
||||
secretValueHidden: s.secretValueHidden ?? null,
|
||||
isRotatedSecret: s.isRotatedSecret ?? null,
|
||||
rotationId: s.rotationId ?? null,
|
||||
secretReminderNote: s.secretReminderNote ?? null,
|
||||
secretReminderRepeatDays: s.secretReminderRepeatDays ?? null,
|
||||
skipMultilineEncoding: s.skipMultilineEncoding ?? null,
|
||||
actor: s.actor
|
||||
? {
|
||||
actorId: s.actor.actorId ?? null,
|
||||
actorType: s.actor.actorType ?? null,
|
||||
name: s.actor.name ?? null,
|
||||
membershipId: s.actor.membershipId ?? null,
|
||||
groupId: s.actor.groupId ?? null,
|
||||
}
|
||||
: null,
|
||||
tags:
|
||||
(s.tags as Array<Record<string, unknown>> | undefined)?.map(
|
||||
(t: Record<string, unknown>) => ({
|
||||
id: (t.id as string) ?? null,
|
||||
slug: (t.slug as string) ?? null,
|
||||
color: (t.color as string) ?? null,
|
||||
name: (t.name as string) ?? null,
|
||||
})
|
||||
) ?? [],
|
||||
secretMetadata:
|
||||
(s.secretMetadata as Array<Record<string, unknown>> | undefined)?.map(
|
||||
(m: Record<string, unknown>) => ({
|
||||
key: (m.key as string) ?? null,
|
||||
value: (m.value as string) ?? null,
|
||||
isEncrypted: (m.isEncrypted as boolean) ?? null,
|
||||
})
|
||||
) ?? [],
|
||||
createdAt: s.createdAt ?? null,
|
||||
updatedAt: s.updatedAt ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
secret: {
|
||||
type: 'object',
|
||||
description: 'The created secret',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Secret ID' },
|
||||
workspace: { type: 'string', description: 'Workspace/project ID', optional: true },
|
||||
secretKey: { type: 'string', description: 'Secret name/key' },
|
||||
secretValue: { type: 'string', description: 'Secret value', optional: true },
|
||||
secretComment: { type: 'string', description: 'Secret comment', optional: true },
|
||||
secretPath: { type: 'string', description: 'Secret path', optional: true },
|
||||
version: { type: 'number', description: 'Secret version' },
|
||||
type: { type: 'string', description: 'Secret type (shared or personal)' },
|
||||
environment: { type: 'string', description: 'Environment slug' },
|
||||
secretValueHidden: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the secret value was hidden in the response',
|
||||
optional: true,
|
||||
},
|
||||
isRotatedSecret: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the secret is managed by secret rotation',
|
||||
optional: true,
|
||||
},
|
||||
rotationId: { type: 'string', description: 'Secret rotation ID', optional: true },
|
||||
secretReminderNote: {
|
||||
type: 'string',
|
||||
description: 'Rotation reminder note',
|
||||
optional: true,
|
||||
},
|
||||
secretReminderRepeatDays: {
|
||||
type: 'number',
|
||||
description: 'Rotation reminder interval in days',
|
||||
optional: true,
|
||||
},
|
||||
skipMultilineEncoding: {
|
||||
type: 'boolean',
|
||||
description: 'Whether multiline encoding is skipped for this secret',
|
||||
optional: true,
|
||||
},
|
||||
tags: {
|
||||
type: 'array',
|
||||
description: 'Tags attached to the secret',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Tag ID' },
|
||||
slug: { type: 'string', description: 'Tag slug' },
|
||||
color: { type: 'string', description: 'Tag color', optional: true },
|
||||
name: { type: 'string', description: 'Tag name' },
|
||||
},
|
||||
},
|
||||
},
|
||||
secretMetadata: {
|
||||
type: 'array',
|
||||
description: 'Custom metadata key-value pairs',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
key: { type: 'string', description: 'Metadata key' },
|
||||
value: { type: 'string', description: 'Metadata value' },
|
||||
isEncrypted: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the metadata value is encrypted',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
actor: {
|
||||
type: 'object',
|
||||
description: 'Identity that last modified the secret',
|
||||
optional: true,
|
||||
properties: {
|
||||
actorId: { type: 'string', description: 'Actor ID', optional: true },
|
||||
actorType: { type: 'string', description: 'Actor type', optional: true },
|
||||
name: { type: 'string', description: 'Actor name', optional: true },
|
||||
membershipId: { type: 'string', description: 'Membership ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp' },
|
||||
updatedAt: { type: 'string', description: 'Last update timestamp' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
import type {
|
||||
InfisicalDeleteSecretParams,
|
||||
InfisicalDeleteSecretResponse,
|
||||
} from '@/tools/infisical/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const deleteSecretTool: ToolConfig<
|
||||
InfisicalDeleteSecretParams,
|
||||
InfisicalDeleteSecretResponse
|
||||
> = {
|
||||
id: 'infisical_delete_secret',
|
||||
name: 'Infisical Delete Secret',
|
||||
description: 'Delete a secret from a project environment.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Infisical API token',
|
||||
},
|
||||
baseUrl: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Infisical instance URL (default: "https://us.infisical.com"). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL.',
|
||||
},
|
||||
projectId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the project',
|
||||
},
|
||||
environment: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The environment slug (e.g., "dev", "staging", "prod")',
|
||||
},
|
||||
secretName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the secret to delete',
|
||||
},
|
||||
secretPath: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The path of the secret (default: "/")',
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Secret type: "shared" or "personal" (default: "shared")',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'DELETE',
|
||||
url: (params) =>
|
||||
`${params.baseUrl?.replace(/\/+$/, '') ?? 'https://us.infisical.com'}/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}`,
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => {
|
||||
const body: Record<string, unknown> = {
|
||||
projectId: params.projectId,
|
||||
environment: params.environment,
|
||||
}
|
||||
if (params.secretPath) body.secretPath = params.secretPath
|
||||
if (params.type) body.type = params.type
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
return {
|
||||
success: false,
|
||||
output: { secret: {} as InfisicalDeleteSecretResponse['output']['secret'] },
|
||||
error: data.message ?? `Request failed with status ${response.status}`,
|
||||
}
|
||||
}
|
||||
const s = data.secret ?? data
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
secret: {
|
||||
id: s.id ?? null,
|
||||
workspace: s.workspace ?? null,
|
||||
secretKey: s.secretKey ?? null,
|
||||
secretValue: s.secretValue ?? null,
|
||||
secretComment: s.secretComment ?? null,
|
||||
secretPath: s.secretPath ?? null,
|
||||
version: s.version ?? null,
|
||||
type: s.type ?? null,
|
||||
environment: s.environment ?? null,
|
||||
secretValueHidden: s.secretValueHidden ?? null,
|
||||
isRotatedSecret: s.isRotatedSecret ?? null,
|
||||
rotationId: s.rotationId ?? null,
|
||||
secretReminderNote: s.secretReminderNote ?? null,
|
||||
secretReminderRepeatDays: s.secretReminderRepeatDays ?? null,
|
||||
skipMultilineEncoding: s.skipMultilineEncoding ?? null,
|
||||
actor: s.actor
|
||||
? {
|
||||
actorId: s.actor.actorId ?? null,
|
||||
actorType: s.actor.actorType ?? null,
|
||||
name: s.actor.name ?? null,
|
||||
membershipId: s.actor.membershipId ?? null,
|
||||
groupId: s.actor.groupId ?? null,
|
||||
}
|
||||
: null,
|
||||
tags:
|
||||
(s.tags as Array<Record<string, unknown>> | undefined)?.map(
|
||||
(t: Record<string, unknown>) => ({
|
||||
id: (t.id as string) ?? null,
|
||||
slug: (t.slug as string) ?? null,
|
||||
color: (t.color as string) ?? null,
|
||||
name: (t.name as string) ?? null,
|
||||
})
|
||||
) ?? [],
|
||||
secretMetadata:
|
||||
(s.secretMetadata as Array<Record<string, unknown>> | undefined)?.map(
|
||||
(m: Record<string, unknown>) => ({
|
||||
key: (m.key as string) ?? null,
|
||||
value: (m.value as string) ?? null,
|
||||
isEncrypted: (m.isEncrypted as boolean) ?? null,
|
||||
})
|
||||
) ?? [],
|
||||
createdAt: s.createdAt ?? null,
|
||||
updatedAt: s.updatedAt ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
secret: {
|
||||
type: 'object',
|
||||
description: 'The deleted secret',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Secret ID' },
|
||||
workspace: { type: 'string', description: 'Workspace/project ID', optional: true },
|
||||
secretKey: { type: 'string', description: 'Secret name/key' },
|
||||
secretValue: { type: 'string', description: 'Secret value', optional: true },
|
||||
secretComment: { type: 'string', description: 'Secret comment', optional: true },
|
||||
secretPath: { type: 'string', description: 'Secret path', optional: true },
|
||||
version: { type: 'number', description: 'Secret version' },
|
||||
type: { type: 'string', description: 'Secret type (shared or personal)' },
|
||||
environment: { type: 'string', description: 'Environment slug' },
|
||||
secretValueHidden: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the secret value was hidden in the response',
|
||||
optional: true,
|
||||
},
|
||||
isRotatedSecret: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the secret is managed by secret rotation',
|
||||
optional: true,
|
||||
},
|
||||
rotationId: { type: 'string', description: 'Secret rotation ID', optional: true },
|
||||
secretReminderNote: {
|
||||
type: 'string',
|
||||
description: 'Rotation reminder note',
|
||||
optional: true,
|
||||
},
|
||||
secretReminderRepeatDays: {
|
||||
type: 'number',
|
||||
description: 'Rotation reminder interval in days',
|
||||
optional: true,
|
||||
},
|
||||
skipMultilineEncoding: {
|
||||
type: 'boolean',
|
||||
description: 'Whether multiline encoding is skipped for this secret',
|
||||
optional: true,
|
||||
},
|
||||
tags: {
|
||||
type: 'array',
|
||||
description: 'Tags attached to the secret',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Tag ID' },
|
||||
slug: { type: 'string', description: 'Tag slug' },
|
||||
color: { type: 'string', description: 'Tag color', optional: true },
|
||||
name: { type: 'string', description: 'Tag name' },
|
||||
},
|
||||
},
|
||||
},
|
||||
secretMetadata: {
|
||||
type: 'array',
|
||||
description: 'Custom metadata key-value pairs',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
key: { type: 'string', description: 'Metadata key' },
|
||||
value: { type: 'string', description: 'Metadata value' },
|
||||
isEncrypted: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the metadata value is encrypted',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
actor: {
|
||||
type: 'object',
|
||||
description: 'Identity that last modified the secret',
|
||||
optional: true,
|
||||
properties: {
|
||||
actorId: { type: 'string', description: 'Actor ID', optional: true },
|
||||
actorType: { type: 'string', description: 'Actor type', optional: true },
|
||||
name: { type: 'string', description: 'Actor name', optional: true },
|
||||
membershipId: { type: 'string', description: 'Membership ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp' },
|
||||
updatedAt: { type: 'string', description: 'Last update timestamp' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
import type { InfisicalGetSecretParams, InfisicalGetSecretResponse } from '@/tools/infisical/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getSecretTool: ToolConfig<InfisicalGetSecretParams, InfisicalGetSecretResponse> = {
|
||||
id: 'infisical_get_secret',
|
||||
name: 'Infisical Get Secret',
|
||||
description: 'Retrieve a single secret by name from a project environment.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Infisical API token',
|
||||
},
|
||||
baseUrl: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Infisical instance URL (default: "https://us.infisical.com"). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL.',
|
||||
},
|
||||
projectId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the project',
|
||||
},
|
||||
environment: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The environment slug (e.g., "dev", "staging", "prod")',
|
||||
},
|
||||
secretName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the secret to retrieve',
|
||||
},
|
||||
secretPath: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The path of the secret (default: "/")',
|
||||
},
|
||||
version: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Specific version of the secret to retrieve',
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Secret type: "shared" or "personal" (default: "shared")',
|
||||
},
|
||||
viewSecretValue: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to include the secret value in the response (default: true)',
|
||||
},
|
||||
expandSecretReferences: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to expand secret references (default: true)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: (params) => {
|
||||
const searchParams = new URLSearchParams()
|
||||
searchParams.set('projectId', params.projectId)
|
||||
searchParams.set('environment', params.environment)
|
||||
if (params.secretPath) searchParams.set('secretPath', params.secretPath)
|
||||
if (params.version != null) searchParams.set('version', String(params.version))
|
||||
if (params.type) searchParams.set('type', params.type)
|
||||
if (params.viewSecretValue != null)
|
||||
searchParams.set('viewSecretValue', String(params.viewSecretValue))
|
||||
if (params.expandSecretReferences != null)
|
||||
searchParams.set('expandSecretReferences', String(params.expandSecretReferences))
|
||||
const base = params.baseUrl?.replace(/\/+$/, '') ?? 'https://us.infisical.com'
|
||||
return `${base}/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}?${searchParams.toString()}`
|
||||
},
|
||||
headers: (params) => ({
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
return {
|
||||
success: false,
|
||||
output: { secret: {} as InfisicalGetSecretResponse['output']['secret'] },
|
||||
error: data.message ?? `Request failed with status ${response.status}`,
|
||||
}
|
||||
}
|
||||
const s = data.secret ?? data
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
secret: {
|
||||
id: s.id ?? null,
|
||||
workspace: s.workspace ?? null,
|
||||
secretKey: s.secretKey ?? null,
|
||||
secretValue: s.secretValue ?? null,
|
||||
secretComment: s.secretComment ?? null,
|
||||
secretPath: s.secretPath ?? null,
|
||||
version: s.version ?? null,
|
||||
type: s.type ?? null,
|
||||
environment: s.environment ?? null,
|
||||
secretValueHidden: s.secretValueHidden ?? null,
|
||||
isRotatedSecret: s.isRotatedSecret ?? null,
|
||||
rotationId: s.rotationId ?? null,
|
||||
secretReminderNote: s.secretReminderNote ?? null,
|
||||
secretReminderRepeatDays: s.secretReminderRepeatDays ?? null,
|
||||
skipMultilineEncoding: s.skipMultilineEncoding ?? null,
|
||||
actor: s.actor
|
||||
? {
|
||||
actorId: s.actor.actorId ?? null,
|
||||
actorType: s.actor.actorType ?? null,
|
||||
name: s.actor.name ?? null,
|
||||
membershipId: s.actor.membershipId ?? null,
|
||||
groupId: s.actor.groupId ?? null,
|
||||
}
|
||||
: null,
|
||||
tags:
|
||||
(s.tags as Array<Record<string, unknown>> | undefined)?.map(
|
||||
(t: Record<string, unknown>) => ({
|
||||
id: (t.id as string) ?? null,
|
||||
slug: (t.slug as string) ?? null,
|
||||
color: (t.color as string) ?? null,
|
||||
name: (t.name as string) ?? null,
|
||||
})
|
||||
) ?? [],
|
||||
secretMetadata:
|
||||
(s.secretMetadata as Array<Record<string, unknown>> | undefined)?.map(
|
||||
(m: Record<string, unknown>) => ({
|
||||
key: (m.key as string) ?? null,
|
||||
value: (m.value as string) ?? null,
|
||||
isEncrypted: (m.isEncrypted as boolean) ?? null,
|
||||
})
|
||||
) ?? [],
|
||||
createdAt: s.createdAt ?? null,
|
||||
updatedAt: s.updatedAt ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
secret: {
|
||||
type: 'object',
|
||||
description: 'The retrieved secret',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Secret ID' },
|
||||
workspace: { type: 'string', description: 'Workspace/project ID', optional: true },
|
||||
secretKey: { type: 'string', description: 'Secret name/key' },
|
||||
secretValue: { type: 'string', description: 'Secret value', optional: true },
|
||||
secretComment: { type: 'string', description: 'Secret comment', optional: true },
|
||||
secretPath: { type: 'string', description: 'Secret path', optional: true },
|
||||
version: { type: 'number', description: 'Secret version' },
|
||||
type: { type: 'string', description: 'Secret type (shared or personal)' },
|
||||
environment: { type: 'string', description: 'Environment slug' },
|
||||
secretValueHidden: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the secret value was hidden in the response',
|
||||
optional: true,
|
||||
},
|
||||
isRotatedSecret: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the secret is managed by secret rotation',
|
||||
optional: true,
|
||||
},
|
||||
rotationId: { type: 'string', description: 'Secret rotation ID', optional: true },
|
||||
secretReminderNote: {
|
||||
type: 'string',
|
||||
description: 'Rotation reminder note',
|
||||
optional: true,
|
||||
},
|
||||
secretReminderRepeatDays: {
|
||||
type: 'number',
|
||||
description: 'Rotation reminder interval in days',
|
||||
optional: true,
|
||||
},
|
||||
skipMultilineEncoding: {
|
||||
type: 'boolean',
|
||||
description: 'Whether multiline encoding is skipped for this secret',
|
||||
optional: true,
|
||||
},
|
||||
tags: {
|
||||
type: 'array',
|
||||
description: 'Tags attached to the secret',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Tag ID' },
|
||||
slug: { type: 'string', description: 'Tag slug' },
|
||||
color: { type: 'string', description: 'Tag color', optional: true },
|
||||
name: { type: 'string', description: 'Tag name' },
|
||||
},
|
||||
},
|
||||
},
|
||||
secretMetadata: {
|
||||
type: 'array',
|
||||
description: 'Custom metadata key-value pairs',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
key: { type: 'string', description: 'Metadata key' },
|
||||
value: { type: 'string', description: 'Metadata value' },
|
||||
isEncrypted: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the metadata value is encrypted',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
actor: {
|
||||
type: 'object',
|
||||
description: 'Identity that last modified the secret',
|
||||
optional: true,
|
||||
properties: {
|
||||
actorId: { type: 'string', description: 'Actor ID', optional: true },
|
||||
actorType: { type: 'string', description: 'Actor type', optional: true },
|
||||
name: { type: 'string', description: 'Actor name', optional: true },
|
||||
membershipId: { type: 'string', description: 'Membership ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp' },
|
||||
updatedAt: { type: 'string', description: 'Last update timestamp' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { createSecretTool } from '@/tools/infisical/create_secret'
|
||||
import { deleteSecretTool } from '@/tools/infisical/delete_secret'
|
||||
import { getSecretTool } from '@/tools/infisical/get_secret'
|
||||
import { listSecretsTool } from '@/tools/infisical/list_secrets'
|
||||
import { updateSecretTool } from '@/tools/infisical/update_secret'
|
||||
|
||||
export const infisicalListSecretsTool = listSecretsTool
|
||||
export const infisicalGetSecretTool = getSecretTool
|
||||
export const infisicalCreateSecretTool = createSecretTool
|
||||
export const infisicalUpdateSecretTool = updateSecretTool
|
||||
export const infisicalDeleteSecretTool = deleteSecretTool
|
||||
|
||||
export * from './types'
|
||||
@@ -0,0 +1,256 @@
|
||||
import type {
|
||||
InfisicalListSecretsParams,
|
||||
InfisicalListSecretsResponse,
|
||||
} from '@/tools/infisical/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listSecretsTool: ToolConfig<InfisicalListSecretsParams, InfisicalListSecretsResponse> =
|
||||
{
|
||||
id: 'infisical_list_secrets',
|
||||
name: 'Infisical List Secrets',
|
||||
description:
|
||||
'List all secrets in a project environment. Returns secret keys, values, comments, tags, and metadata.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Infisical API token',
|
||||
},
|
||||
baseUrl: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Infisical instance URL (default: "https://us.infisical.com"). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL.',
|
||||
},
|
||||
projectId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the project to list secrets from',
|
||||
},
|
||||
environment: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The environment slug (e.g., "dev", "staging", "prod")',
|
||||
},
|
||||
secretPath: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The path of the secrets (default: "/")',
|
||||
},
|
||||
recursive: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to fetch secrets recursively from subdirectories',
|
||||
},
|
||||
expandSecretReferences: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to expand secret references (default: true)',
|
||||
},
|
||||
viewSecretValue: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to include secret values in the response (default: true)',
|
||||
},
|
||||
includeImports: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to include imported secrets (default: true)',
|
||||
},
|
||||
tagSlugs: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Comma-separated tag slugs to filter secrets by',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: (params) => {
|
||||
const searchParams = new URLSearchParams()
|
||||
searchParams.set('projectId', params.projectId)
|
||||
searchParams.set('environment', params.environment)
|
||||
if (params.secretPath) searchParams.set('secretPath', params.secretPath)
|
||||
if (params.recursive != null) searchParams.set('recursive', String(params.recursive))
|
||||
if (params.expandSecretReferences != null)
|
||||
searchParams.set('expandSecretReferences', String(params.expandSecretReferences))
|
||||
if (params.viewSecretValue != null)
|
||||
searchParams.set('viewSecretValue', String(params.viewSecretValue))
|
||||
if (params.includeImports != null)
|
||||
searchParams.set('includeImports', String(params.includeImports))
|
||||
if (params.tagSlugs) searchParams.set('tagSlugs', params.tagSlugs)
|
||||
const base = params.baseUrl?.replace(/\/+$/, '') ?? 'https://us.infisical.com'
|
||||
return `${base}/api/v4/secrets?${searchParams.toString()}`
|
||||
},
|
||||
headers: (params) => ({
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
return {
|
||||
success: false,
|
||||
output: { secrets: [], count: 0 },
|
||||
error: data.message ?? `Request failed with status ${response.status}`,
|
||||
}
|
||||
}
|
||||
const secrets = (data.secrets ?? []).map((s: Record<string, unknown>) => {
|
||||
const actor = s.actor as Record<string, unknown> | undefined
|
||||
return {
|
||||
id: s.id ?? null,
|
||||
workspace: s.workspace ?? null,
|
||||
secretKey: s.secretKey ?? null,
|
||||
secretValue: s.secretValue ?? null,
|
||||
secretComment: s.secretComment ?? null,
|
||||
secretPath: s.secretPath ?? null,
|
||||
version: s.version ?? null,
|
||||
type: s.type ?? null,
|
||||
environment: s.environment ?? null,
|
||||
secretValueHidden: s.secretValueHidden ?? null,
|
||||
isRotatedSecret: s.isRotatedSecret ?? null,
|
||||
rotationId: s.rotationId ?? null,
|
||||
secretReminderNote: s.secretReminderNote ?? null,
|
||||
secretReminderRepeatDays: s.secretReminderRepeatDays ?? null,
|
||||
skipMultilineEncoding: s.skipMultilineEncoding ?? null,
|
||||
actor: actor
|
||||
? {
|
||||
actorId: (actor.actorId as string) ?? null,
|
||||
actorType: (actor.actorType as string) ?? null,
|
||||
name: (actor.name as string) ?? null,
|
||||
membershipId: (actor.membershipId as string) ?? null,
|
||||
groupId: (actor.groupId as string) ?? null,
|
||||
}
|
||||
: null,
|
||||
tags:
|
||||
(s.tags as Array<Record<string, unknown>> | undefined)?.map((t) => ({
|
||||
id: (t.id as string) ?? null,
|
||||
slug: (t.slug as string) ?? null,
|
||||
color: (t.color as string) ?? null,
|
||||
name: (t.name as string) ?? null,
|
||||
})) ?? [],
|
||||
secretMetadata:
|
||||
(s.secretMetadata as Array<Record<string, unknown>> | undefined)?.map((m) => ({
|
||||
key: (m.key as string) ?? null,
|
||||
value: (m.value as string) ?? null,
|
||||
isEncrypted: (m.isEncrypted as boolean) ?? null,
|
||||
})) ?? [],
|
||||
createdAt: s.createdAt ?? null,
|
||||
updatedAt: s.updatedAt ?? null,
|
||||
}
|
||||
})
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
secrets,
|
||||
count: secrets.length,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
secrets: {
|
||||
type: 'array',
|
||||
description: 'Array of secrets',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Secret ID' },
|
||||
workspace: { type: 'string', description: 'Workspace/project ID', optional: true },
|
||||
secretKey: { type: 'string', description: 'Secret name/key' },
|
||||
secretValue: { type: 'string', description: 'Secret value', optional: true },
|
||||
secretComment: { type: 'string', description: 'Secret comment', optional: true },
|
||||
secretPath: { type: 'string', description: 'Secret path', optional: true },
|
||||
version: { type: 'number', description: 'Secret version' },
|
||||
type: { type: 'string', description: 'Secret type (shared or personal)' },
|
||||
environment: { type: 'string', description: 'Environment slug' },
|
||||
secretValueHidden: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the secret value was hidden in the response',
|
||||
optional: true,
|
||||
},
|
||||
isRotatedSecret: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the secret is managed by secret rotation',
|
||||
optional: true,
|
||||
},
|
||||
rotationId: { type: 'string', description: 'Secret rotation ID', optional: true },
|
||||
secretReminderNote: {
|
||||
type: 'string',
|
||||
description: 'Rotation reminder note',
|
||||
optional: true,
|
||||
},
|
||||
secretReminderRepeatDays: {
|
||||
type: 'number',
|
||||
description: 'Rotation reminder interval in days',
|
||||
optional: true,
|
||||
},
|
||||
skipMultilineEncoding: {
|
||||
type: 'boolean',
|
||||
description: 'Whether multiline encoding is skipped for this secret',
|
||||
optional: true,
|
||||
},
|
||||
tags: {
|
||||
type: 'array',
|
||||
description: 'Tags attached to the secret',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Tag ID' },
|
||||
slug: { type: 'string', description: 'Tag slug' },
|
||||
color: { type: 'string', description: 'Tag color', optional: true },
|
||||
name: { type: 'string', description: 'Tag name' },
|
||||
},
|
||||
},
|
||||
},
|
||||
secretMetadata: {
|
||||
type: 'array',
|
||||
description: 'Custom metadata key-value pairs',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
key: { type: 'string', description: 'Metadata key' },
|
||||
value: { type: 'string', description: 'Metadata value' },
|
||||
isEncrypted: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the metadata value is encrypted',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
actor: {
|
||||
type: 'object',
|
||||
description: 'Identity that last modified the secret',
|
||||
optional: true,
|
||||
properties: {
|
||||
actorId: { type: 'string', description: 'Actor ID', optional: true },
|
||||
actorType: { type: 'string', description: 'Actor type', optional: true },
|
||||
name: { type: 'string', description: 'Actor name', optional: true },
|
||||
membershipId: { type: 'string', description: 'Membership ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp' },
|
||||
updatedAt: { type: 'string', description: 'Last update timestamp' },
|
||||
},
|
||||
},
|
||||
},
|
||||
count: { type: 'number', description: 'Total number of secrets returned' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
import type { ToolResponse } from '@/tools/types'
|
||||
|
||||
export interface InfisicalListSecretsParams {
|
||||
apiKey: string
|
||||
baseUrl?: string
|
||||
projectId: string
|
||||
environment: string
|
||||
secretPath?: string
|
||||
recursive?: boolean
|
||||
expandSecretReferences?: boolean
|
||||
viewSecretValue?: boolean
|
||||
includeImports?: boolean
|
||||
tagSlugs?: string
|
||||
}
|
||||
|
||||
export interface InfisicalGetSecretParams {
|
||||
apiKey: string
|
||||
baseUrl?: string
|
||||
projectId: string
|
||||
environment: string
|
||||
secretName: string
|
||||
secretPath?: string
|
||||
version?: number
|
||||
type?: string
|
||||
viewSecretValue?: boolean
|
||||
expandSecretReferences?: boolean
|
||||
}
|
||||
|
||||
export interface InfisicalCreateSecretParams {
|
||||
apiKey: string
|
||||
baseUrl?: string
|
||||
projectId: string
|
||||
environment: string
|
||||
secretName: string
|
||||
secretValue: string
|
||||
secretPath?: string
|
||||
secretComment?: string
|
||||
type?: string
|
||||
tagIds?: string
|
||||
}
|
||||
|
||||
export interface InfisicalUpdateSecretParams {
|
||||
apiKey: string
|
||||
baseUrl?: string
|
||||
projectId: string
|
||||
environment: string
|
||||
secretName: string
|
||||
secretValue?: string
|
||||
secretPath?: string
|
||||
secretComment?: string
|
||||
newSecretName?: string
|
||||
type?: string
|
||||
tagIds?: string
|
||||
}
|
||||
|
||||
export interface InfisicalDeleteSecretParams {
|
||||
apiKey: string
|
||||
baseUrl?: string
|
||||
projectId: string
|
||||
environment: string
|
||||
secretName: string
|
||||
secretPath?: string
|
||||
type?: string
|
||||
}
|
||||
|
||||
interface InfisicalTag {
|
||||
id: string
|
||||
slug: string
|
||||
color: string | null
|
||||
name: string
|
||||
}
|
||||
|
||||
interface InfisicalSecretMetadata {
|
||||
key: string
|
||||
value: string
|
||||
isEncrypted: boolean | null
|
||||
}
|
||||
|
||||
interface InfisicalActor {
|
||||
actorId: string | null
|
||||
actorType: string | null
|
||||
name: string | null
|
||||
membershipId: string | null
|
||||
groupId: string | null
|
||||
}
|
||||
|
||||
interface InfisicalSecret {
|
||||
id: string
|
||||
workspace: string | null
|
||||
secretKey: string
|
||||
secretValue: string | null
|
||||
secretComment: string | null
|
||||
secretPath: string | null
|
||||
version: number
|
||||
type: string
|
||||
environment: string
|
||||
secretValueHidden: boolean | null
|
||||
isRotatedSecret: boolean | null
|
||||
rotationId: string | null
|
||||
secretReminderNote: string | null
|
||||
secretReminderRepeatDays: number | null
|
||||
skipMultilineEncoding: boolean | null
|
||||
actor: InfisicalActor | null
|
||||
tags: InfisicalTag[]
|
||||
secretMetadata: InfisicalSecretMetadata[]
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface InfisicalListSecretsResponse extends ToolResponse {
|
||||
output: {
|
||||
secrets: InfisicalSecret[]
|
||||
count: number
|
||||
}
|
||||
}
|
||||
|
||||
export interface InfisicalGetSecretResponse extends ToolResponse {
|
||||
output: {
|
||||
secret: InfisicalSecret
|
||||
}
|
||||
}
|
||||
|
||||
export interface InfisicalCreateSecretResponse extends ToolResponse {
|
||||
output: {
|
||||
secret: InfisicalSecret
|
||||
}
|
||||
}
|
||||
|
||||
export interface InfisicalUpdateSecretResponse extends ToolResponse {
|
||||
output: {
|
||||
secret: InfisicalSecret
|
||||
}
|
||||
}
|
||||
|
||||
export interface InfisicalDeleteSecretResponse extends ToolResponse {
|
||||
output: {
|
||||
secret: InfisicalSecret
|
||||
}
|
||||
}
|
||||
|
||||
export type InfisicalResponse =
|
||||
| InfisicalListSecretsResponse
|
||||
| InfisicalGetSecretResponse
|
||||
| InfisicalCreateSecretResponse
|
||||
| InfisicalUpdateSecretResponse
|
||||
| InfisicalDeleteSecretResponse
|
||||
@@ -0,0 +1,261 @@
|
||||
import type {
|
||||
InfisicalUpdateSecretParams,
|
||||
InfisicalUpdateSecretResponse,
|
||||
} from '@/tools/infisical/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const updateSecretTool: ToolConfig<
|
||||
InfisicalUpdateSecretParams,
|
||||
InfisicalUpdateSecretResponse
|
||||
> = {
|
||||
id: 'infisical_update_secret',
|
||||
name: 'Infisical Update Secret',
|
||||
description: 'Update an existing secret in a project environment.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Infisical API token',
|
||||
},
|
||||
baseUrl: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Infisical instance URL (default: "https://us.infisical.com"). Use "https://eu.infisical.com" for EU Cloud or your self-hosted URL.',
|
||||
},
|
||||
projectId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the project',
|
||||
},
|
||||
environment: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The environment slug (e.g., "dev", "staging", "prod")',
|
||||
},
|
||||
secretName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the secret to update',
|
||||
},
|
||||
secretValue: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The new value for the secret',
|
||||
},
|
||||
secretPath: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The path of the secret (default: "/")',
|
||||
},
|
||||
secretComment: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'A comment for the secret',
|
||||
},
|
||||
newSecretName: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'New name for the secret (to rename it)',
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Secret type: "shared" or "personal" (default: "shared")',
|
||||
},
|
||||
tagIds: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Comma-separated tag IDs to set on the secret',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
method: 'PATCH',
|
||||
url: (params) =>
|
||||
`${params.baseUrl?.replace(/\/+$/, '') ?? 'https://us.infisical.com'}/api/v4/secrets/${encodeURIComponent(params.secretName.trim())}`,
|
||||
headers: (params) => ({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${params.apiKey}`,
|
||||
}),
|
||||
body: (params) => {
|
||||
const body: Record<string, unknown> = {
|
||||
projectId: params.projectId,
|
||||
environment: params.environment,
|
||||
}
|
||||
if (params.secretValue) body.secretValue = params.secretValue
|
||||
if (params.secretPath) body.secretPath = params.secretPath
|
||||
if (params.secretComment) body.secretComment = params.secretComment
|
||||
if (params.newSecretName) body.newSecretName = params.newSecretName
|
||||
if (params.type) body.type = params.type
|
||||
if (params.tagIds) {
|
||||
body.tagIds = params.tagIds.split(',').map((id) => id.trim())
|
||||
}
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
return {
|
||||
success: false,
|
||||
output: { secret: {} as InfisicalUpdateSecretResponse['output']['secret'] },
|
||||
error: data.message ?? `Request failed with status ${response.status}`,
|
||||
}
|
||||
}
|
||||
const s = data.secret ?? data
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
secret: {
|
||||
id: s.id ?? null,
|
||||
workspace: s.workspace ?? null,
|
||||
secretKey: s.secretKey ?? null,
|
||||
secretValue: s.secretValue ?? null,
|
||||
secretComment: s.secretComment ?? null,
|
||||
secretPath: s.secretPath ?? null,
|
||||
version: s.version ?? null,
|
||||
type: s.type ?? null,
|
||||
environment: s.environment ?? null,
|
||||
secretValueHidden: s.secretValueHidden ?? null,
|
||||
isRotatedSecret: s.isRotatedSecret ?? null,
|
||||
rotationId: s.rotationId ?? null,
|
||||
secretReminderNote: s.secretReminderNote ?? null,
|
||||
secretReminderRepeatDays: s.secretReminderRepeatDays ?? null,
|
||||
skipMultilineEncoding: s.skipMultilineEncoding ?? null,
|
||||
actor: s.actor
|
||||
? {
|
||||
actorId: s.actor.actorId ?? null,
|
||||
actorType: s.actor.actorType ?? null,
|
||||
name: s.actor.name ?? null,
|
||||
membershipId: s.actor.membershipId ?? null,
|
||||
groupId: s.actor.groupId ?? null,
|
||||
}
|
||||
: null,
|
||||
tags:
|
||||
(s.tags as Array<Record<string, unknown>> | undefined)?.map(
|
||||
(t: Record<string, unknown>) => ({
|
||||
id: (t.id as string) ?? null,
|
||||
slug: (t.slug as string) ?? null,
|
||||
color: (t.color as string) ?? null,
|
||||
name: (t.name as string) ?? null,
|
||||
})
|
||||
) ?? [],
|
||||
secretMetadata:
|
||||
(s.secretMetadata as Array<Record<string, unknown>> | undefined)?.map(
|
||||
(m: Record<string, unknown>) => ({
|
||||
key: (m.key as string) ?? null,
|
||||
value: (m.value as string) ?? null,
|
||||
isEncrypted: (m.isEncrypted as boolean) ?? null,
|
||||
})
|
||||
) ?? [],
|
||||
createdAt: s.createdAt ?? null,
|
||||
updatedAt: s.updatedAt ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
secret: {
|
||||
type: 'object',
|
||||
description: 'The updated secret',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Secret ID' },
|
||||
workspace: { type: 'string', description: 'Workspace/project ID', optional: true },
|
||||
secretKey: { type: 'string', description: 'Secret name/key' },
|
||||
secretValue: { type: 'string', description: 'Secret value', optional: true },
|
||||
secretComment: { type: 'string', description: 'Secret comment', optional: true },
|
||||
secretPath: { type: 'string', description: 'Secret path', optional: true },
|
||||
version: { type: 'number', description: 'Secret version' },
|
||||
type: { type: 'string', description: 'Secret type (shared or personal)' },
|
||||
environment: { type: 'string', description: 'Environment slug' },
|
||||
secretValueHidden: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the secret value was hidden in the response',
|
||||
optional: true,
|
||||
},
|
||||
isRotatedSecret: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the secret is managed by secret rotation',
|
||||
optional: true,
|
||||
},
|
||||
rotationId: { type: 'string', description: 'Secret rotation ID', optional: true },
|
||||
secretReminderNote: {
|
||||
type: 'string',
|
||||
description: 'Rotation reminder note',
|
||||
optional: true,
|
||||
},
|
||||
secretReminderRepeatDays: {
|
||||
type: 'number',
|
||||
description: 'Rotation reminder interval in days',
|
||||
optional: true,
|
||||
},
|
||||
skipMultilineEncoding: {
|
||||
type: 'boolean',
|
||||
description: 'Whether multiline encoding is skipped for this secret',
|
||||
optional: true,
|
||||
},
|
||||
tags: {
|
||||
type: 'array',
|
||||
description: 'Tags attached to the secret',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Tag ID' },
|
||||
slug: { type: 'string', description: 'Tag slug' },
|
||||
color: { type: 'string', description: 'Tag color', optional: true },
|
||||
name: { type: 'string', description: 'Tag name' },
|
||||
},
|
||||
},
|
||||
},
|
||||
secretMetadata: {
|
||||
type: 'array',
|
||||
description: 'Custom metadata key-value pairs',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
key: { type: 'string', description: 'Metadata key' },
|
||||
value: { type: 'string', description: 'Metadata value' },
|
||||
isEncrypted: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the metadata value is encrypted',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
actor: {
|
||||
type: 'object',
|
||||
description: 'Identity that last modified the secret',
|
||||
optional: true,
|
||||
properties: {
|
||||
actorId: { type: 'string', description: 'Actor ID', optional: true },
|
||||
actorType: { type: 'string', description: 'Actor type', optional: true },
|
||||
name: { type: 'string', description: 'Actor name', optional: true },
|
||||
membershipId: { type: 'string', description: 'Membership ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp' },
|
||||
updatedAt: { type: 'string', description: 'Last update timestamp' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user