@lota-sdk/core 0.1.46 → 0.1.48

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.
@@ -18,7 +18,6 @@ DEFINE FIELD IF NOT EXISTS compactionSummary ON TABLE workstream TYPE option<str
18
18
  DEFINE FIELD IF NOT EXISTS lastCompactedMessageId ON TABLE workstream TYPE option<string>;
19
19
  DEFINE FIELD IF NOT EXISTS nameGenerated ON TABLE workstream TYPE bool DEFAULT false;
20
20
  DEFINE FIELD IF NOT EXISTS isCompacting ON TABLE workstream TYPE bool DEFAULT false;
21
- DEFINE FIELD IF NOT EXISTS state ON TABLE workstream TYPE option<object> FLEXIBLE;
22
21
  DEFINE FIELD IF NOT EXISTS members ON TABLE workstream TYPE option<array<string>> DEFAULT [];
23
22
  DEFINE FIELD IF NOT EXISTS turnCount ON TABLE workstream TYPE int DEFAULT 0;
24
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lota-sdk/core",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
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.46",
35
+ "@lota-sdk/shared": "0.1.48",
36
36
  "@mendable/firecrawl-js": "^4.18.0",
37
37
  "@surrealdb/node": "^3.0.3",
38
38
  "ai": "^6.0.141",
@@ -116,7 +116,6 @@ export function buildAgentRuntimeConfig<TAgent extends string, TSkill extends Pr
116
116
  preSeededMemoriesSection?: string
117
117
  retrievedKnowledgeSection?: string
118
118
  workstreamMemoryBlock?: string
119
- workstreamStateSection?: string
120
119
  responseGuardSection?: string
121
120
  learnedSkillsSection?: string
122
121
  additionalInstructionSections?: string[]
@@ -140,7 +139,6 @@ export function buildAgentRuntimeConfig<TAgent extends string, TSkill extends Pr
140
139
  params.preSeededMemoriesSection?.trim(),
141
140
  params.retrievedKnowledgeSection?.trim(),
142
141
  toMemoryBlockSection(params.workstreamMemoryBlock),
143
- params.workstreamStateSection?.trim(),
144
142
  ...(params.additionalInstructionSections?.map((section) => section.trim()) ?? []),
145
143
  params.responseGuardSection?.trim(),
146
144
  params.onboardingActive ? 'Onboarding is active. Keep responses onboarding-focused and concise.' : undefined,
@@ -50,22 +50,38 @@ export function createAgentMessageMetadata(params: {
50
50
  }
51
51
  }
52
52
 
53
- export function createServerRunAbortController(externalAbortSignal?: AbortSignal) {
53
+ function toExternalAbortSignals(externalAbortSignal?: AbortSignal | readonly AbortSignal[]): AbortSignal[] {
54
+ if (!externalAbortSignal) return []
55
+
56
+ const signals = Array.isArray(externalAbortSignal) ? externalAbortSignal : [externalAbortSignal]
57
+ return [...new Set<AbortSignal>(signals)]
58
+ }
59
+
60
+ export function createServerRunAbortController(externalAbortSignal?: AbortSignal | readonly AbortSignal[]) {
54
61
  const controller = new AbortController()
55
62
  const abort = (reason?: unknown) => {
56
63
  if (controller.signal.aborted) return
57
64
  controller.abort(reason ?? new DOMException('Run stopped by user.', 'AbortError'))
58
65
  }
59
66
 
60
- const abortFromExternal = () => {
61
- abort((externalAbortSignal as (AbortSignal & { reason?: unknown }) | undefined)?.reason)
62
- }
67
+ const externalSignals = toExternalAbortSignals(externalAbortSignal)
68
+ const listeners = externalSignals.map((signal) => {
69
+ const abortFromExternal = () => {
70
+ abort((signal as AbortSignal & { reason?: unknown }).reason)
71
+ }
63
72
 
64
- if (externalAbortSignal) {
65
- if (externalAbortSignal.aborted) {
73
+ if (signal.aborted) {
66
74
  abortFromExternal()
67
75
  } else {
68
- externalAbortSignal.addEventListener('abort', abortFromExternal, { once: true })
76
+ signal.addEventListener('abort', abortFromExternal, { once: true })
77
+ }
78
+
79
+ return { signal, abortFromExternal }
80
+ })
81
+
82
+ if (controller.signal.aborted) {
83
+ for (const { signal, abortFromExternal } of listeners) {
84
+ signal.removeEventListener('abort', abortFromExternal)
69
85
  }
70
86
  }
71
87
 
@@ -74,8 +90,9 @@ export function createServerRunAbortController(externalAbortSignal?: AbortSignal
74
90
  signal: controller.signal,
75
91
  abort,
76
92
  dispose: () => {
77
- if (!externalAbortSignal) return
78
- externalAbortSignal.removeEventListener('abort', abortFromExternal)
93
+ for (const { signal, abortFromExternal } of listeners) {
94
+ signal.removeEventListener('abort', abortFromExternal)
95
+ }
79
96
  },
80
97
  }
81
98
  }
@@ -2,6 +2,7 @@ import { createContextCompactionAgent } from '../system-agents/context-compactio
2
2
  import {
3
3
  buildContextCompactionPrompt,
4
4
  buildMemoryBlockCompactionPrompt,
5
+ ContextCompactionOutputSchema,
5
6
  createContextCompactionRuntime,
6
7
  parseCompactionOutput,
7
8
  } from './context-compaction'
@@ -16,7 +17,6 @@ import {
16
17
  SUMMARY_ROLLUP_MAX_TOKENS,
17
18
  } from './context-compaction-constants'
18
19
  import type { GenerateHelperStructuredParams, GenerateHelperTextParams } from './helper-model'
19
- import { StructuredCompactionOutputSchema } from './workstream-state'
20
20
 
21
21
  const CONTEXT_COMPACTION_MAX_OUTPUT_TOKENS = 512
22
22
 
@@ -40,12 +40,11 @@ async function runContextCompacter(helperModelRuntime: HelperModelRuntime, param
40
40
  role: 'user',
41
41
  content: buildContextCompactionPrompt({
42
42
  previousSummary: params.previousSummary,
43
- existingState: params.existingState,
44
43
  transcript: params.transcript,
45
44
  }),
46
45
  },
47
46
  ],
48
- schema: StructuredCompactionOutputSchema,
47
+ schema: ContextCompactionOutputSchema,
49
48
  maxOutputTokens: 8_000,
50
49
  })
51
50