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

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
+102
View File
@@ -0,0 +1,102 @@
import type { PostgresDeleteParams, PostgresDeleteResponse } from '@/tools/postgresql/types'
import type { ToolConfig } from '@/tools/types'
export const deleteTool: ToolConfig<PostgresDeleteParams, PostgresDeleteResponse> = {
id: 'postgresql_delete',
name: 'PostgreSQL Delete',
description: 'Delete data from PostgreSQL database',
version: '1.0',
params: {
host: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server hostname or IP address',
},
port: {
type: 'number',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server port (default: 5432)',
},
database: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database name to connect to',
},
username: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database username',
},
password: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database password',
},
ssl: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'SSL connection mode (disabled, required, preferred)',
},
table: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Table name to delete data from',
},
where: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'WHERE clause condition (without WHERE keyword)',
},
},
request: {
url: '/api/tools/postgresql/delete',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => ({
host: params.host,
port: Number(params.port),
database: params.database,
username: params.username,
password: params.password,
ssl: params.ssl || 'required',
table: params.table,
where: params.where,
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
if (!response.ok) {
throw new Error(data.error || 'PostgreSQL delete failed')
}
return {
success: true,
output: {
message: data.message || 'Data deleted successfully',
rows: data.rows || [],
rowCount: data.rowCount || 0,
},
error: undefined,
}
},
outputs: {
message: { type: 'string', description: 'Operation status message' },
rows: { type: 'array', description: 'Deleted data (if RETURNING clause used)' },
rowCount: { type: 'number', description: 'Number of rows deleted' },
},
}
+95
View File
@@ -0,0 +1,95 @@
import type { PostgresExecuteParams, PostgresExecuteResponse } from '@/tools/postgresql/types'
import type { ToolConfig } from '@/tools/types'
export const executeTool: ToolConfig<PostgresExecuteParams, PostgresExecuteResponse> = {
id: 'postgresql_execute',
name: 'PostgreSQL Execute',
description: 'Execute raw SQL query on PostgreSQL database',
version: '1.0',
params: {
host: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server hostname or IP address',
},
port: {
type: 'number',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server port (default: 5432)',
},
database: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database name to connect to',
},
username: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database username',
},
password: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database password',
},
ssl: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'SSL connection mode (disabled, required, preferred)',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Raw SQL query to execute',
},
},
request: {
url: '/api/tools/postgresql/execute',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => ({
host: params.host,
port: Number(params.port),
database: params.database,
username: params.username,
password: params.password,
ssl: params.ssl || 'required',
query: params.query,
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
if (!response.ok) {
throw new Error(data.error || 'PostgreSQL execute failed')
}
return {
success: true,
output: {
message: data.message || 'Query executed successfully',
rows: data.rows || [],
rowCount: data.rowCount || 0,
},
error: undefined,
}
},
outputs: {
message: { type: 'string', description: 'Operation status message' },
rows: { type: 'array', description: 'Array of rows returned from the query' },
rowCount: { type: 'number', description: 'Number of rows affected' },
},
}
+13
View File
@@ -0,0 +1,13 @@
import { deleteTool } from './delete'
import { executeTool } from './execute'
import { insertTool } from './insert'
import { introspectTool } from './introspect'
import { queryTool } from './query'
import { updateTool } from './update'
export const postgresDeleteTool = deleteTool
export const postgresExecuteTool = executeTool
export const postgresInsertTool = insertTool
export const postgresIntrospectTool = introspectTool
export const postgresQueryTool = queryTool
export const postgresUpdateTool = updateTool
+102
View File
@@ -0,0 +1,102 @@
import type { PostgresInsertParams, PostgresInsertResponse } from '@/tools/postgresql/types'
import type { ToolConfig } from '@/tools/types'
export const insertTool: ToolConfig<PostgresInsertParams, PostgresInsertResponse> = {
id: 'postgresql_insert',
name: 'PostgreSQL Insert',
description: 'Insert data into PostgreSQL database',
version: '1.0',
params: {
host: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server hostname or IP address',
},
port: {
type: 'number',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server port (default: 5432)',
},
database: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database name to connect to',
},
username: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database username',
},
password: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database password',
},
ssl: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'SSL connection mode (disabled, required, preferred)',
},
table: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Table name to insert data into',
},
data: {
type: 'object',
required: true,
visibility: 'user-or-llm',
description: 'Data object to insert (key-value pairs)',
},
},
request: {
url: '/api/tools/postgresql/insert',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => ({
host: params.host,
port: Number(params.port),
database: params.database,
username: params.username,
password: params.password,
ssl: params.ssl || 'required',
table: params.table,
data: params.data,
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
if (!response.ok) {
throw new Error(data.error || 'PostgreSQL insert failed')
}
return {
success: true,
output: {
message: data.message || 'Data inserted successfully',
rows: data.rows || [],
rowCount: data.rowCount || 0,
},
error: undefined,
}
},
outputs: {
message: { type: 'string', description: 'Operation status message' },
rows: { type: 'array', description: 'Inserted data (if RETURNING clause used)' },
rowCount: { type: 'number', description: 'Number of rows inserted' },
},
}
+108
View File
@@ -0,0 +1,108 @@
import type { PostgresIntrospectParams, PostgresIntrospectResponse } from '@/tools/postgresql/types'
import { POSTGRES_TABLE_OUTPUT_PROPERTIES } from '@/tools/postgresql/types'
import type { ToolConfig } from '@/tools/types'
export const introspectTool: ToolConfig<PostgresIntrospectParams, PostgresIntrospectResponse> = {
id: 'postgresql_introspect',
name: 'PostgreSQL Introspect',
description:
'Introspect PostgreSQL database schema to retrieve table structures, columns, and relationships',
version: '1.0',
params: {
host: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server hostname or IP address',
},
port: {
type: 'number',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server port (default: 5432)',
},
database: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database name to connect to',
},
username: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database username',
},
password: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database password',
},
ssl: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'SSL connection mode (disabled, required, preferred)',
},
schema: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Schema to introspect (default: public)',
},
},
request: {
url: '/api/tools/postgresql/introspect',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => ({
host: params.host,
port: Number(params.port),
database: params.database,
username: params.username,
password: params.password,
ssl: params.ssl || 'required',
schema: params.schema || 'public',
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
if (!response.ok) {
throw new Error(data.error || 'PostgreSQL introspection failed')
}
return {
success: true,
output: {
message: data.message || 'Schema introspection completed successfully',
tables: data.tables || [],
schemas: data.schemas || [],
},
error: undefined,
}
},
outputs: {
message: { type: 'string', description: 'Operation status message' },
tables: {
type: 'array',
description: 'Array of table schemas with columns, keys, and indexes',
items: {
type: 'object',
properties: POSTGRES_TABLE_OUTPUT_PROPERTIES,
},
},
schemas: {
type: 'array',
description: 'List of available schemas in the database',
items: { type: 'string', description: 'Schema name' },
},
},
}
+95
View File
@@ -0,0 +1,95 @@
import type { PostgresQueryParams, PostgresQueryResponse } from '@/tools/postgresql/types'
import type { ToolConfig } from '@/tools/types'
export const queryTool: ToolConfig<PostgresQueryParams, PostgresQueryResponse> = {
id: 'postgresql_query',
name: 'PostgreSQL Query',
description: 'Execute a SELECT query on PostgreSQL database',
version: '1.0',
params: {
host: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server hostname or IP address',
},
port: {
type: 'number',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server port (default: 5432)',
},
database: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database name to connect to',
},
username: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database username',
},
password: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database password',
},
ssl: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'SSL connection mode (disabled, required, preferred)',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'SQL SELECT query to execute',
},
},
request: {
url: '/api/tools/postgresql/query',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => ({
host: params.host,
port: Number(params.port),
database: params.database,
username: params.username,
password: params.password,
ssl: params.ssl || 'required',
query: params.query,
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
if (!response.ok) {
throw new Error(data.error || 'PostgreSQL query failed')
}
return {
success: true,
output: {
message: data.message || 'Query executed successfully',
rows: data.rows || [],
rowCount: data.rowCount || 0,
},
error: undefined,
}
},
outputs: {
message: { type: 'string', description: 'Operation status message' },
rows: { type: 'array', description: 'Array of rows returned from the query' },
rowCount: { type: 'number', description: 'Number of rows returned' },
},
}
+199
View File
@@ -0,0 +1,199 @@
import type { OutputProperty, ToolResponse } from '@/tools/types'
/**
* Output property definitions for PostgreSQL introspection and query responses.
* @see https://www.postgresql.org/docs/current/information-schema.html
*/
/**
* Output definition for table column objects from introspection.
* @see https://www.postgresql.org/docs/current/infoschema-columns.html
*/
export const POSTGRES_COLUMN_OUTPUT_PROPERTIES = {
name: { type: 'string', description: 'Column name' },
type: { type: 'string', description: 'Data type (e.g., integer, varchar, timestamp)' },
nullable: { type: 'boolean', description: 'Whether the column allows NULL values' },
default: { type: 'string', description: 'Default value expression', optional: true },
isPrimaryKey: { type: 'boolean', description: 'Whether the column is part of the primary key' },
isForeignKey: { type: 'boolean', description: 'Whether the column is a foreign key' },
references: {
type: 'object',
description: 'Foreign key reference information',
optional: true,
properties: {
table: { type: 'string', description: 'Referenced table name' },
column: { type: 'string', description: 'Referenced column name' },
},
},
} as const satisfies Record<string, OutputProperty>
/**
* Complete column output definition
*/
export const POSTGRES_COLUMN_OUTPUT: OutputProperty = {
type: 'object',
description: 'PostgreSQL table column',
properties: POSTGRES_COLUMN_OUTPUT_PROPERTIES,
}
/**
* Output definition for foreign key constraint objects.
*/
export const POSTGRES_FOREIGN_KEY_OUTPUT_PROPERTIES = {
column: { type: 'string', description: 'Local column name' },
referencesTable: { type: 'string', description: 'Referenced table name' },
referencesColumn: { type: 'string', description: 'Referenced column name' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for index objects.
* @see https://www.postgresql.org/docs/current/catalog-pg-index.html
*/
export const POSTGRES_INDEX_OUTPUT_PROPERTIES = {
name: { type: 'string', description: 'Index name' },
columns: {
type: 'array',
description: 'Columns included in the index',
items: { type: 'string', description: 'Column name' },
},
unique: { type: 'boolean', description: 'Whether the index enforces uniqueness' },
} as const satisfies Record<string, OutputProperty>
/**
* Output definition for table schema objects from introspection.
*/
export const POSTGRES_TABLE_OUTPUT_PROPERTIES = {
name: { type: 'string', description: 'Table name' },
schema: { type: 'string', description: 'Schema name (e.g., public)' },
columns: {
type: 'array',
description: 'Table columns',
items: {
type: 'object',
properties: POSTGRES_COLUMN_OUTPUT_PROPERTIES,
},
},
primaryKey: {
type: 'array',
description: 'Primary key column names',
items: { type: 'string', description: 'Column name' },
},
foreignKeys: {
type: 'array',
description: 'Foreign key constraints',
items: {
type: 'object',
properties: POSTGRES_FOREIGN_KEY_OUTPUT_PROPERTIES,
},
},
indexes: {
type: 'array',
description: 'Table indexes',
items: {
type: 'object',
properties: POSTGRES_INDEX_OUTPUT_PROPERTIES,
},
},
} as const satisfies Record<string, OutputProperty>
/**
* Complete table schema output definition
*/
export const POSTGRES_TABLE_OUTPUT: OutputProperty = {
type: 'object',
description: 'PostgreSQL table schema information',
properties: POSTGRES_TABLE_OUTPUT_PROPERTIES,
}
export interface PostgresConnectionConfig {
host: string
port: number
database: string
username: string
password: string
ssl: 'disabled' | 'required' | 'preferred'
}
export interface PostgresQueryParams extends PostgresConnectionConfig {
query: string
}
export interface PostgresInsertParams extends PostgresConnectionConfig {
table: string
data: Record<string, unknown>
}
export interface PostgresUpdateParams extends PostgresConnectionConfig {
table: string
data: Record<string, unknown>
where: string
}
export interface PostgresDeleteParams extends PostgresConnectionConfig {
table: string
where: string
}
export interface PostgresExecuteParams extends PostgresConnectionConfig {
query: string
}
export interface PostgresIntrospectParams extends PostgresConnectionConfig {
schema?: string
}
interface PostgresBaseResponse extends ToolResponse {
output: {
message: string
rows: unknown[]
rowCount: number
}
error?: string
}
export interface PostgresQueryResponse extends PostgresBaseResponse {}
export interface PostgresInsertResponse extends PostgresBaseResponse {}
export interface PostgresUpdateResponse extends PostgresBaseResponse {}
export interface PostgresDeleteResponse extends PostgresBaseResponse {}
export interface PostgresExecuteResponse extends PostgresBaseResponse {}
interface TableColumn {
name: string
type: string
nullable: boolean
default: string | null
isPrimaryKey: boolean
isForeignKey: boolean
references?: {
table: string
column: string
}
}
interface TableSchema {
name: string
schema: string
columns: TableColumn[]
primaryKey: string[]
foreignKeys: Array<{
column: string
referencesTable: string
referencesColumn: string
}>
indexes: Array<{
name: string
columns: string[]
unique: boolean
}>
}
export interface PostgresIntrospectResponse extends ToolResponse {
output: {
message: string
tables: TableSchema[]
schemas: string[]
}
error?: string
}
export interface PostgresResponse extends PostgresBaseResponse {}
+109
View File
@@ -0,0 +1,109 @@
import type { PostgresUpdateParams, PostgresUpdateResponse } from '@/tools/postgresql/types'
import type { ToolConfig } from '@/tools/types'
export const updateTool: ToolConfig<PostgresUpdateParams, PostgresUpdateResponse> = {
id: 'postgresql_update',
name: 'PostgreSQL Update',
description: 'Update data in PostgreSQL database',
version: '1.0',
params: {
host: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server hostname or IP address',
},
port: {
type: 'number',
required: true,
visibility: 'user-only',
description: 'PostgreSQL server port (default: 5432)',
},
database: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database name to connect to',
},
username: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database username',
},
password: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Database password',
},
ssl: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'SSL connection mode (disabled, required, preferred)',
},
table: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Table name to update data in',
},
data: {
type: 'object',
required: true,
visibility: 'user-or-llm',
description: 'Data object with fields to update (key-value pairs)',
},
where: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'WHERE clause condition (without WHERE keyword)',
},
},
request: {
url: '/api/tools/postgresql/update',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => ({
host: params.host,
port: Number(params.port),
database: params.database,
username: params.username,
password: params.password,
ssl: params.ssl || 'required',
table: params.table,
data: params.data,
where: params.where,
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
if (!response.ok) {
throw new Error(data.error || 'PostgreSQL update failed')
}
return {
success: true,
output: {
message: data.message || 'Data updated successfully',
rows: data.rows || [],
rowCount: data.rowCount || 0,
},
error: undefined,
}
},
outputs: {
message: { type: 'string', description: 'Operation status message' },
rows: { type: 'array', description: 'Updated data (if RETURNING clause used)' },
rowCount: { type: 'number', description: 'Number of rows updated' },
},
}