Skip to content

Commit 4f40c4c

Browse files
authored
v0.6.35: additional jira fields, HITL docs, logs cleanup efficiency
2 parents d33acf4 + 3efbd1d commit 4f40c4c

File tree

7 files changed

+64
-31
lines changed

7 files changed

+64
-31
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"pages": [
3+
"listPausedExecutions",
4+
"getPausedExecution",
5+
"getPausedExecutionByResumePath",
6+
"getPauseContext",
7+
"resumeExecution"
8+
]
9+
}

apps/docs/content/docs/en/api-reference/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"typescript",
1111
"---Endpoints---",
1212
"(generated)/workflows",
13+
"(generated)/human-in-the-loop",
1314
"(generated)/logs",
1415
"(generated)/usage",
1516
"(generated)/audit-logs",

apps/sim/app/api/logs/cleanup/route.ts

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { db } from '@sim/db'
2-
import { subscription, user, workflowExecutionLogs, workspace } from '@sim/db/schema'
2+
import { subscription, workflowExecutionLogs, workspace } from '@sim/db/schema'
33
import { createLogger } from '@sim/logger'
44
import { and, eq, inArray, isNull, lt } from 'drizzle-orm'
55
import { type NextRequest, NextResponse } from 'next/server'
@@ -26,38 +26,19 @@ export async function GET(request: NextRequest) {
2626
const retentionDate = new Date()
2727
retentionDate.setDate(retentionDate.getDate() - Number(env.FREE_PLAN_LOG_RETENTION_DAYS || '7'))
2828

29-
const freeUsers = await db
30-
.select({ userId: user.id })
31-
.from(user)
29+
const freeWorkspacesSubquery = db
30+
.select({ id: workspace.id })
31+
.from(workspace)
3232
.leftJoin(
3333
subscription,
3434
and(
35-
eq(user.id, subscription.referenceId),
35+
eq(subscription.referenceId, workspace.billedAccountUserId),
3636
inArray(subscription.status, ENTITLED_SUBSCRIPTION_STATUSES),
3737
sqlIsPaid(subscription.plan)
3838
)
3939
)
4040
.where(isNull(subscription.id))
4141

42-
if (freeUsers.length === 0) {
43-
logger.info('No free users found for log cleanup')
44-
return NextResponse.json({ message: 'No free users found for cleanup' })
45-
}
46-
47-
const freeUserIds = freeUsers.map((u) => u.userId)
48-
49-
const workspacesQuery = await db
50-
.select({ id: workspace.id })
51-
.from(workspace)
52-
.where(inArray(workspace.billedAccountUserId, freeUserIds))
53-
54-
if (workspacesQuery.length === 0) {
55-
logger.info('No workspaces found for free users')
56-
return NextResponse.json({ message: 'No workspaces found for cleanup' })
57-
}
58-
59-
const workspaceIds = workspacesQuery.map((w) => w.id)
60-
6142
const results = {
6243
enhancedLogs: {
6344
total: 0,
@@ -83,7 +64,7 @@ export async function GET(request: NextRequest) {
8364
let batchesProcessed = 0
8465
let hasMoreLogs = true
8566

86-
logger.info(`Starting enhanced logs cleanup for ${workspaceIds.length} workspaces`)
67+
logger.info('Starting enhanced logs cleanup for free-plan workspaces')
8768

8869
while (hasMoreLogs && batchesProcessed < MAX_BATCHES) {
8970
const oldEnhancedLogs = await db
@@ -105,8 +86,8 @@ export async function GET(request: NextRequest) {
10586
.from(workflowExecutionLogs)
10687
.where(
10788
and(
108-
inArray(workflowExecutionLogs.workspaceId, workspaceIds),
109-
lt(workflowExecutionLogs.createdAt, retentionDate)
89+
inArray(workflowExecutionLogs.workspaceId, freeWorkspacesSubquery),
90+
lt(workflowExecutionLogs.startedAt, retentionDate)
11091
)
11192
)
11293
.limit(BATCH_SIZE)

apps/sim/blocks/blocks/jira.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,13 @@ Return ONLY the JQL query - no explanations or markdown formatting.`,
479479
placeholder: 'Maximum results to return (default: 50)',
480480
condition: { field: 'operation', value: ['search', 'get_comments', 'get_worklogs'] },
481481
},
482+
{
483+
id: 'fields',
484+
title: 'Fields',
485+
type: 'short-input',
486+
placeholder: 'Comma-separated fields to return (e.g., key,summary,status)',
487+
condition: { field: 'operation', value: 'search' },
488+
},
482489
// Comment fields
483490
{
484491
id: 'commentBody',
@@ -922,6 +929,12 @@ Return ONLY the comment text - no explanations.`,
922929
jql: params.jql,
923930
nextPageToken: params.nextPageToken || undefined,
924931
maxResults: params.maxResults ? Number.parseInt(params.maxResults) : undefined,
932+
fields: params.fields
933+
? params.fields
934+
.split(',')
935+
.map((f: string) => f.trim())
936+
.filter(Boolean)
937+
: undefined,
925938
}
926939
}
927940
case 'add_comment': {
@@ -1114,6 +1127,10 @@ Return ONLY the comment text - no explanations.`,
11141127
startAt: { type: 'string', description: 'Pagination start index' },
11151128
jql: { type: 'string', description: 'JQL (Jira Query Language) search query' },
11161129
maxResults: { type: 'string', description: 'Maximum number of results to return' },
1130+
fields: {
1131+
type: 'string',
1132+
description: 'Comma-separated field names to return (e.g., key,summary,status)',
1133+
},
11171134
// Comment operation inputs
11181135
commentBody: { type: 'string', description: 'Text content for comment operations' },
11191136
commentId: { type: 'string', description: 'Comment ID for update/delete operations' },

apps/sim/executor/handlers/agent/agent-handler.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ describe('AgentBlockHandler', () => {
667667
expect(result).toEqual({
668668
result: 'Success',
669669
score: 0.95,
670+
model: 'mock-model',
670671
tokens: { input: 10, output: 20, total: 30 },
671672
toolCalls: { list: [], count: 0 },
672673
providerTiming: { total: 100 },

apps/sim/executor/handlers/agent/agent-handler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,19 +1070,20 @@ export class AgentBlockHandler implements BlockHandler {
10701070
private processStandardResponse(result: any): BlockOutput {
10711071
return {
10721072
content: result.content,
1073-
model: result.model,
10741073
...this.createResponseMetadata(result),
10751074
...(result.interactionId && { interactionId: result.interactionId }),
10761075
}
10771076
}
10781077

10791078
private createResponseMetadata(result: {
1079+
model?: string
10801080
tokens?: { input?: number; output?: number; total?: number }
10811081
toolCalls?: Array<any>
10821082
timing?: any
10831083
cost?: any
10841084
}) {
10851085
return {
1086+
model: result.model,
10861087
tokens: result.tokens || {
10871088
input: DEFAULTS.TOKENS.PROMPT,
10881089
output: DEFAULTS.TOKENS.COMPLETION,

apps/sim/tools/jsm/utils.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,36 @@ export function parseJsmErrorMessage(
5050
): string {
5151
try {
5252
const errorData = JSON.parse(errorText)
53+
// JSM Service Desk: singular errorMessage
5354
if (errorData.errorMessage) {
54-
return `JSM Forms API error: ${errorData.errorMessage}`
55+
return errorData.errorMessage
56+
}
57+
// Jira Platform: errorMessages array
58+
if (Array.isArray(errorData.errorMessages) && errorData.errorMessages.length > 0) {
59+
return errorData.errorMessages.join(', ')
60+
}
61+
// Confluence v2 / Forms API: RFC 7807 errors array
62+
if (Array.isArray(errorData.errors) && errorData.errors.length > 0) {
63+
const err = errorData.errors[0]
64+
if (err?.title) {
65+
return err.detail ? `${err.title}: ${err.detail}` : err.title
66+
}
67+
}
68+
// Jira Platform field-level errors object
69+
if (errorData.errors && !Array.isArray(errorData.errors)) {
70+
const fieldErrors = Object.entries(errorData.errors)
71+
.map(([field, msg]) => `${field}: ${msg}`)
72+
.join(', ')
73+
if (fieldErrors) return fieldErrors
74+
}
75+
// Generic message fallback
76+
if (errorData.message) {
77+
return errorData.message
5578
}
5679
} catch {
5780
if (errorText) {
58-
return `JSM Forms API error: ${errorText}`
81+
return errorText
5982
}
6083
}
61-
return `JSM Forms API error: ${status} ${statusText}`
84+
return `${status} ${statusText}`
6285
}

0 commit comments

Comments
 (0)