Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ Copilot is a Sim-managed service. To use Copilot on a self-hosted instance:

- Go to https://sim.ai → Settings → Copilot and generate a Copilot API key
- Set `COPILOT_API_KEY` in your self-hosted environment to that value
- Host Sim on a publicly available DNS and set NEXT_PUBLIC_APP_URL and BETTER_AUTH_URL to that value ([ngrok](https://ngrok.com/))

## Tech Stack

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/tools/microsoft_excel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Read data from a Microsoft Excel spreadsheet
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `spreadsheetId` | string | Yes | The ID of the spreadsheet to read from |
| `range` | string | No | The range of cells to read from |
| `range` | string | No | The range of cells to read from. Accepts "SheetName!A1:B2" for explicit ranges or just "SheetName" to read the used range of that sheet. If omitted, reads the used range of the first sheet. |

#### Output

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/content/docs/tools/onedrive.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Upload a file to OneDrive
| `fileName` | string | Yes | The name of the file to upload |
| `content` | string | Yes | The content of the file to upload |
| `folderSelector` | string | No | Select the folder to upload the file to |
| `folderId` | string | No | The ID of the folder to upload the file to \(internal use\) |
| `manualFolderId` | string | No | Manually entered folder ID \(advanced mode\) |

#### Output

Expand All @@ -87,7 +87,7 @@ Create a new folder in OneDrive
| --------- | ---- | -------- | ----------- |
| `folderName` | string | Yes | Name of the folder to create |
| `folderSelector` | string | No | Select the parent folder to create the folder in |
| `folderId` | string | No | ID of the parent folder \(internal use\) |
| `manualFolderId` | string | No | Manually entered parent folder ID \(advanced mode\) |

#### Output

Expand All @@ -105,7 +105,7 @@ List files and folders in OneDrive
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `folderSelector` | string | No | Select the folder to list files from |
| `folderId` | string | No | The ID of the folder to list files from \(internal use\) |
| `manualFolderId` | string | No | The manually entered folder ID \(advanced mode\) |
| `query` | string | No | A query to filter the files |
| `pageSize` | number | No | The number of files to return |

Expand Down
23 changes: 20 additions & 3 deletions apps/docs/content/docs/tools/outlook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,27 @@ Read emails from Outlook

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `success` | boolean | Email read operation success status |
| `messageCount` | number | Number of emails retrieved |
| `messages` | array | Array of email message objects |
| `message` | string | Success or status message |
| `results` | array | Array of email message objects |

### `outlook_forward`

Forward an existing Outlook message to specified recipients

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `messageId` | string | Yes | The ID of the message to forward |
| `to` | string | Yes | Recipient email address\(es\), comma-separated |
| `comment` | string | No | Optional comment to include with the forwarded message |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `message` | string | Success or error message |
| `results` | object | Delivery result details |



Expand Down
8 changes: 1 addition & 7 deletions apps/sim/app/(auth)/login/login-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,12 @@ const PASSWORD_VALIDATIONS = {
},
}

// Validate callback URL to prevent open redirect vulnerabilities
const validateCallbackUrl = (url: string): boolean => {
try {
// If it's a relative URL, it's safe
if (url.startsWith('/')) {
return true
}

// If absolute URL, check if it belongs to the same origin
const currentOrigin = typeof window !== 'undefined' ? window.location.origin : ''
if (url.startsWith(currentOrigin)) {
return true
Expand All @@ -70,7 +67,6 @@ const validateCallbackUrl = (url: string): boolean => {
}
}

// Validate password and return array of error messages
const validatePassword = (passwordValue: string): string[] => {
const errors: string[] = []

Expand Down Expand Up @@ -521,9 +517,7 @@ export default function LoginPage({
</div>
{resetStatus.type && (
<div
className={`text-sm ${
resetStatus.type === 'success' ? 'text-[#4CAF50]' : 'text-red-500'
}`}
className={`text-sm ${resetStatus.type === 'success' ? 'text-[#4CAF50]' : 'text-red-500'}`}
>
{resetStatus.message}
</div>
Expand Down
1 change: 1 addition & 0 deletions apps/sim/app/api/chat/subdomains/validate/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export async function GET(request: Request) {
'support',
'admin',
'qa',
'agent',
]
if (reservedSubdomains.includes(subdomain)) {
return NextResponse.json(
Expand Down
5 changes: 4 additions & 1 deletion apps/sim/app/api/copilot/api-keys/generate/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export async function POST(req: NextRequest) {

const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/generate`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: {
'Content-Type': 'application/json',
...(env.COPILOT_API_KEY ? { 'x-api-key': env.COPILOT_API_KEY } : {}),
},
body: JSON.stringify({ userId }),
})

Expand Down
10 changes: 8 additions & 2 deletions apps/sim/app/api/copilot/api-keys/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export async function GET(request: NextRequest) {

const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/get-api-keys`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: {
'Content-Type': 'application/json',
...(env.COPILOT_API_KEY ? { 'x-api-key': env.COPILOT_API_KEY } : {}),
},
body: JSON.stringify({ userId }),
})

Expand Down Expand Up @@ -61,7 +64,10 @@ export async function DELETE(request: NextRequest) {

const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/delete`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: {
'Content-Type': 'application/json',
...(env.COPILOT_API_KEY ? { 'x-api-key': env.COPILOT_API_KEY } : {}),
},
body: JSON.stringify({ userId, apiKeyId: id }),
})

Expand Down
13 changes: 0 additions & 13 deletions apps/sim/app/api/copilot/chat/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ describe('Copilot Chat API Route', () => {
streamToolCalls: true,
mode: 'agent',
depth: 0,
origin: 'http://localhost:3000',
}),
})
)
Expand Down Expand Up @@ -288,7 +287,6 @@ describe('Copilot Chat API Route', () => {
streamToolCalls: true,
mode: 'agent',
depth: 0,
origin: 'http://localhost:3000',
}),
})
)
Expand All @@ -298,7 +296,6 @@ describe('Copilot Chat API Route', () => {
const authMocks = mockAuth()
authMocks.setAuthenticated()

// Mock new chat creation
const newChat = {
id: 'chat-123',
userId: 'user-123',
Expand All @@ -307,8 +304,6 @@ describe('Copilot Chat API Route', () => {
}
mockReturning.mockResolvedValue([newChat])

// Mock sim agent response

;(global.fetch as any).mockResolvedValue({
ok: true,
body: new ReadableStream({
Expand Down Expand Up @@ -343,7 +338,6 @@ describe('Copilot Chat API Route', () => {
streamToolCalls: true,
mode: 'agent',
depth: 0,
origin: 'http://localhost:3000',
}),
})
)
Expand All @@ -353,11 +347,8 @@ describe('Copilot Chat API Route', () => {
const authMocks = mockAuth()
authMocks.setAuthenticated()

// Mock new chat creation
mockReturning.mockResolvedValue([{ id: 'chat-123', messages: [] }])

// Mock sim agent error

;(global.fetch as any).mockResolvedValue({
ok: false,
status: 500,
Expand Down Expand Up @@ -403,11 +394,8 @@ describe('Copilot Chat API Route', () => {
const authMocks = mockAuth()
authMocks.setAuthenticated()

// Mock new chat creation
mockReturning.mockResolvedValue([{ id: 'chat-123', messages: [] }])

// Mock sim agent response

;(global.fetch as any).mockResolvedValue({
ok: true,
body: new ReadableStream({
Expand Down Expand Up @@ -438,7 +426,6 @@ describe('Copilot Chat API Route', () => {
streamToolCalls: true,
mode: 'ask',
depth: 0,
origin: 'http://localhost:3000',
}),
})
)
Expand Down
Loading