@lota-sdk/core 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lota-sdk/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@chat-adapter/slack": "^4.23.0",
|
|
33
33
|
"@chat-adapter/state-ioredis": "^4.23.0",
|
|
34
34
|
"@logtape/logtape": "^2.0.5",
|
|
35
|
-
"@lota-sdk/shared": "0.1.
|
|
35
|
+
"@lota-sdk/shared": "0.1.30",
|
|
36
36
|
"@mendable/firecrawl-js": "^4.18.0",
|
|
37
37
|
"@surrealdb/node": "^3.0.3",
|
|
38
38
|
"ai": "^6.0.141",
|
|
@@ -483,13 +483,16 @@ export async function prepareWorkstreamRunCore(params: WorkstreamRunCoreParams):
|
|
|
483
483
|
|
|
484
484
|
const workstreamRecord = await waitForWorkstreamCompactionIfNeeded(workstreamRef)
|
|
485
485
|
timer.step('compaction-gate')
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
486
|
+
// Plan turns run without the chat lease — they must not block or be blocked by user messages.
|
|
487
|
+
if (params.kind !== 'planTurn') {
|
|
488
|
+
if (
|
|
489
|
+
(await workstreamService.hasActiveRunLease(workstreamRef)) ||
|
|
490
|
+
toOptionalTrimmedString(workstreamRecord.activeRunId)
|
|
491
|
+
) {
|
|
492
|
+
const clearedStaleRun = await workstreamService.clearStaleActiveRunIfMissingFromRegistry(workstreamRef)
|
|
493
|
+
if (!clearedStaleRun) {
|
|
494
|
+
throw new WorkstreamTurnError('A chat run is already active.', 409)
|
|
495
|
+
}
|
|
493
496
|
}
|
|
494
497
|
}
|
|
495
498
|
|
|
@@ -759,8 +762,11 @@ export async function prepareWorkstreamRunCore(params: WorkstreamRunCoreParams):
|
|
|
759
762
|
const runTimer = lotaDebugLogger.timer('run')
|
|
760
763
|
const serverRunId = Bun.randomUUIDv7()
|
|
761
764
|
const runAbort = createServerRunAbortController(params.abortSignal)
|
|
762
|
-
|
|
763
|
-
|
|
765
|
+
// Plan turns run without the chat lease — don't claim the active run slot.
|
|
766
|
+
if (params.kind !== 'planTurn') {
|
|
767
|
+
await workstreamService.setActiveTurn(workstreamRef, serverRunId, params.streamId ?? null)
|
|
768
|
+
chatRunRegistry.register(serverRunId, runAbort.controller)
|
|
769
|
+
}
|
|
764
770
|
runTimer.step('set-active-run+stream')
|
|
765
771
|
|
|
766
772
|
try {
|
|
@@ -1093,6 +1099,16 @@ export async function prepareWorkstreamRunCore(params: WorkstreamRunCoreParams):
|
|
|
1093
1099
|
}
|
|
1094
1100
|
}
|
|
1095
1101
|
|
|
1102
|
+
// Plan turns run without the chat lease so they never block user messages.
|
|
1103
|
+
// The heartbeat lock already prevents duplicate plan turns on the same node.
|
|
1104
|
+
if (params.kind === 'planTurn') {
|
|
1105
|
+
const runResult = await executeRun()
|
|
1106
|
+
if (runResult) {
|
|
1107
|
+
return runResult
|
|
1108
|
+
}
|
|
1109
|
+
return { inputMessageId: referenceUserMessage?.id, assistantMessages: [...allAssistantMessages] }
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1096
1112
|
try {
|
|
1097
1113
|
return await workstreamService.withActiveRunLease(workstreamRef, async () => {
|
|
1098
1114
|
const runResult = await executeRun()
|