mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 19:34:38 +00:00
fix(agent): resolve lint, typecheck, and stop button UI issues
This commit is contained in:
@@ -21,14 +21,9 @@ import {
|
||||
import * as piAgent from '../index'
|
||||
import { type AgentHarness, type Session } from '@earendil-works/pi-agent-core'
|
||||
import { type DatabaseSessionMetadata } from '../database-session-storage'
|
||||
import {
|
||||
isTemporal,
|
||||
triggerLocalCancel,
|
||||
} from '@shumai/workflow-core'
|
||||
import { triggerLocalCancel } from '@shumai/workflow-core'
|
||||
import { Context } from '@temporalio/activity'
|
||||
|
||||
|
||||
|
||||
import {
|
||||
prisma,
|
||||
AssetType,
|
||||
@@ -101,8 +96,13 @@ describe('Agent Activities', () => {
|
||||
})
|
||||
|
||||
it('should register local cancellation handler and call harness.abort when cancelled in local mode', async () => {
|
||||
let resolvePrompt: any
|
||||
const promptPromise = new Promise((resolve) => {
|
||||
let resolvePrompt!: (value: {
|
||||
content: Array<{ type: string; text: string } | { type: string }>
|
||||
usage: { input: number; output: number }
|
||||
stopReason?: string
|
||||
errorMessage?: string
|
||||
}) => void
|
||||
const promptPromise = new Promise<Parameters<typeof resolvePrompt>[0]>((resolve) => {
|
||||
resolvePrompt = resolve
|
||||
})
|
||||
|
||||
@@ -163,8 +163,13 @@ describe('Agent Activities', () => {
|
||||
} as unknown as Context
|
||||
vi.spyOn(Context, 'current').mockReturnValue(mockTemporalContext)
|
||||
|
||||
let resolvePrompt: any
|
||||
const promptPromise = new Promise((resolve) => {
|
||||
let resolvePrompt!: (value: {
|
||||
content: Array<{ type: string; text: string } | { type: string }>
|
||||
usage: { input: number; output: number }
|
||||
stopReason?: string
|
||||
errorMessage?: string
|
||||
}) => void
|
||||
const promptPromise = new Promise<Parameters<typeof resolvePrompt>[0]>((resolve) => {
|
||||
resolvePrompt = resolve
|
||||
})
|
||||
|
||||
|
||||
@@ -14,11 +14,7 @@ import { uploadService } from '@shumai/core/src/upload/upload'
|
||||
import { VersionStackService } from '@shumai/core/src/versionStack/versionStack'
|
||||
import { AssetType, prisma, Prisma, type Skill } from '@shumai/db'
|
||||
import { ApplicationFailure, Context } from '@temporalio/activity'
|
||||
import {
|
||||
isTemporal,
|
||||
registerLocalCancelHandler,
|
||||
unregisterLocalCancelHandler,
|
||||
} from '@shumai/workflow-core'
|
||||
import { registerLocalCancelHandler, unregisterLocalCancelHandler } from '@shumai/workflow-core'
|
||||
import { generateKeyBetween } from 'jittered-fractional-indexing'
|
||||
import { ulid } from 'ulid'
|
||||
import { DatabaseSessionStorage } from '../database-session-storage'
|
||||
@@ -157,16 +153,14 @@ If you need to create files in the local filesystem (for example, a temporary fi
|
||||
|
||||
let heartbeatInterval: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
let isTemporalActivity = false
|
||||
let temporalSignal: any
|
||||
let temporalSignal: EventTarget | undefined
|
||||
try {
|
||||
temporalSignal = Context.current().cancellationSignal
|
||||
isTemporalActivity = true
|
||||
} catch {
|
||||
isTemporalActivity = false
|
||||
// Ignore
|
||||
}
|
||||
|
||||
if (isTemporalActivity && temporalSignal) {
|
||||
if (temporalSignal) {
|
||||
temporalSignal.addEventListener(
|
||||
'abort',
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user