@lota-sdk/core 0.1.9 → 0.1.12
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/infrastructure/schema/00_workstream.surql +1 -0
- package/infrastructure/schema/02_execution_plan.surql +202 -52
- package/package.json +4 -87
- package/src/ai/index.ts +3 -0
- package/src/bifrost/bifrost.ts +94 -25
- package/src/bifrost/index.ts +1 -0
- package/src/config/agent-defaults.ts +30 -7
- package/src/config/constants.ts +0 -9
- package/src/config/debug-logger.ts +43 -0
- package/src/config/index.ts +5 -0
- package/src/config/model-constants.ts +8 -9
- package/src/config/workstream-defaults.ts +4 -0
- package/src/db/cursor-pagination.ts +2 -2
- package/src/db/index.ts +10 -0
- package/src/db/memory-store.ts +3 -71
- package/src/db/memory.ts +9 -15
- package/src/db/service.ts +42 -2
- package/src/db/tables.ts +9 -2
- package/src/document/index.ts +2 -0
- package/src/document/parsing.ts +0 -25
- package/src/embeddings/provider.ts +102 -22
- package/src/index.ts +15 -499
- package/src/queues/index.ts +10 -0
- package/src/redis/connection-accessor.ts +26 -0
- package/src/redis/connection.ts +1 -1
- package/src/redis/index.ts +9 -25
- package/src/redis/org-memory-lock.ts +1 -1
- package/src/redis/redis-lease-lock.ts +1 -1
- package/src/redis/stream-context.ts +54 -0
- package/src/runtime/agent-runtime-policy.ts +9 -5
- package/src/runtime/agent-stream-helpers.ts +6 -3
- package/src/runtime/agent-types.ts +1 -5
- package/src/runtime/approval-continuation.ts +68 -1
- package/src/runtime/chat-attachments.ts +1 -1
- package/src/runtime/chat-request-routing.ts +6 -2
- package/src/runtime/context-compaction-runtime.ts +2 -2
- package/src/runtime/context-compaction.ts +1 -1
- package/src/runtime/execution-plan.ts +22 -15
- package/src/runtime/index.ts +26 -0
- package/src/runtime/indexed-repositories-policy.ts +10 -10
- package/src/runtime/memory-pipeline.ts +0 -2
- package/src/runtime/runtime-config.ts +238 -0
- package/src/runtime/runtime-extensions.ts +3 -2
- package/src/runtime/runtime-worker-registry.ts +47 -0
- package/src/runtime/team-consultation-orchestrator.ts +9 -6
- package/src/runtime/team-consultation-prompts.ts +3 -2
- package/src/runtime/turn-lifecycle.ts +13 -5
- package/src/runtime/workstream-chat-helpers.ts +0 -54
- package/src/runtime/workstream-routing-policy.ts +3 -7
- package/src/runtime.ts +387 -0
- package/src/services/chat-attachments.service.ts +1 -1
- package/src/services/context-compaction.service.ts +1 -1
- package/src/services/document-chunk.service.ts +2 -2
- package/src/services/execution-plan.service.ts +584 -793
- package/src/services/index.ts +14 -0
- package/src/services/learned-skill.service.ts +82 -39
- package/src/services/memory.service.ts +5 -4
- package/src/services/mutating-approval.service.ts +1 -1
- package/src/services/organization-member.service.ts +1 -1
- package/src/services/organization.service.ts +1 -1
- package/src/services/plan-approval.service.ts +83 -0
- package/src/services/plan-artifact.service.ts +44 -0
- package/src/services/plan-builder.service.ts +61 -0
- package/src/services/plan-checkpoint.service.ts +53 -0
- package/src/services/plan-compiler.service.ts +81 -0
- package/src/services/plan-executor.service.ts +1624 -0
- package/src/services/plan-run.service.ts +422 -0
- package/src/services/plan-validator.service.ts +760 -0
- package/src/services/recent-activity-title.service.ts +1 -1
- package/src/services/recent-activity.service.ts +14 -16
- package/src/services/user.service.ts +2 -2
- package/src/services/workstream-message.service.ts +2 -3
- package/src/services/workstream-title.service.ts +1 -1
- package/src/services/workstream-turn-preparation.ts +156 -59
- package/src/services/workstream-turn.ts +26 -1
- package/src/services/workstream.service.ts +35 -9
- package/src/services/workstream.types.ts +1 -0
- package/src/storage/attachment-parser.ts +1 -1
- package/src/storage/attachment-storage.service.ts +11 -10
- package/src/storage/generated-document-storage.service.ts +7 -6
- package/src/storage/index.ts +10 -0
- package/src/system-agents/delegated-agent-factory.ts +78 -29
- package/src/system-agents/index.ts +4 -0
- package/src/system-agents/recent-activity-title-refiner.agent.ts +38 -3
- package/src/system-agents/regular-chat-memory-digest.agent.ts +1 -1
- package/src/system-agents/skill-extractor.agent.ts +1 -1
- package/src/system-agents/skill-manager.agent.ts +2 -4
- package/src/system-agents/title-generator.agent.ts +2 -2
- package/src/tools/execution-plan.tool.ts +22 -48
- package/src/tools/firecrawl-client.ts +2 -2
- package/src/tools/index.ts +12 -0
- package/src/tools/log-hello-world.tool.ts +17 -0
- package/src/tools/research-topic.tool.ts +1 -1
- package/src/tools/team-think.tool.ts +1 -1
- package/src/tools/user-questions.tool.ts +2 -2
- package/src/utils/index.ts +6 -0
- package/src/workers/bootstrap.ts +8 -16
- package/src/workers/index.ts +7 -0
- package/src/workers/regular-chat-memory-digest.runner.ts +1 -1
- package/src/workers/skill-extraction.runner.ts +3 -3
- package/src/workers/utils/{repo-indexer-chunker.ts → file-section-chunker.ts} +23 -52
- package/src/workers/utils/repo-structure-extractor.ts +2 -5
- package/src/workers/utils/repomix-file-sections.ts +42 -0
- package/src/config/env-shapes.ts +0 -121
- package/src/runtime/agent-contract.ts +0 -1
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
RecentActivitySchema,
|
|
9
9
|
RecentActivitySourceSchema,
|
|
10
10
|
RecentActivityTitleSourceSchema,
|
|
11
|
-
} from '@lota-sdk/shared
|
|
11
|
+
} from '@lota-sdk/shared'
|
|
12
12
|
import type {
|
|
13
13
|
RecentActivity,
|
|
14
14
|
RecentActivityEvent,
|
|
15
15
|
RecentActivityEventInput,
|
|
16
16
|
RecentActivitySource,
|
|
17
|
-
} from '@lota-sdk/shared
|
|
17
|
+
} from '@lota-sdk/shared'
|
|
18
18
|
import { RecordId } from 'surrealdb'
|
|
19
19
|
import { z } from 'zod'
|
|
20
20
|
|
|
@@ -83,18 +83,16 @@ function buildDeterministicRecordId(table: string, key: string): RecordId {
|
|
|
83
83
|
return new RecordId(table, digest)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function
|
|
87
|
-
return existing?.titleSource === '
|
|
86
|
+
function shouldKeepExistingAgentTitle(existing: RecentActivityRow | null): boolean {
|
|
87
|
+
return existing?.titleSource === 'agent' && compactWhitespace(existing.title).length > 0
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function buildRecentActivityAreaKey(
|
|
91
|
-
row: Pick<RecentActivityRow, '
|
|
91
|
+
row: Pick<RecentActivityRow, 'targetKind' | 'targetId' | 'kind' | 'mergeKey' | 'metadata'>,
|
|
92
92
|
): string {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (target.chat) return `workstream:${target.chat}`
|
|
97
|
-
if (target.agent) return `agent:${target.agent}`
|
|
93
|
+
if (row.targetId) {
|
|
94
|
+
return `${row.targetKind}:${row.targetId}`
|
|
95
|
+
}
|
|
98
96
|
|
|
99
97
|
const normalizedWebsiteUrl = row.metadata?.normalizedWebsiteUrl
|
|
100
98
|
if (row.kind === 'website-intelligence.viewed' && normalizedWebsiteUrl) {
|
|
@@ -230,8 +228,8 @@ class RecentActivityService {
|
|
|
230
228
|
{ mutation: 'merge' },
|
|
231
229
|
)
|
|
232
230
|
|
|
233
|
-
const
|
|
234
|
-
const visibleTitle =
|
|
231
|
+
const keepExistingAgentTitle = shouldKeepExistingAgentTitle(existingRecent)
|
|
232
|
+
const visibleTitle = keepExistingAgentTitle && existingRecent ? existingRecent.title : parsedEvent.title
|
|
235
233
|
const recentRow = await databaseService.upsert(
|
|
236
234
|
TABLES.RECENT_ACTIVITY,
|
|
237
235
|
recentRecordId,
|
|
@@ -244,7 +242,7 @@ class RecentActivityService {
|
|
|
244
242
|
targetId: parsedEvent.targetId,
|
|
245
243
|
title: visibleTitle,
|
|
246
244
|
systemTitle: parsedEvent.title,
|
|
247
|
-
titleSource:
|
|
245
|
+
titleSource: keepExistingAgentTitle ? 'agent' : 'system',
|
|
248
246
|
sourceLabel: parsedEvent.sourceLabel,
|
|
249
247
|
deepLink: parsedEvent.deepLink,
|
|
250
248
|
metadata: parsedEvent.metadata,
|
|
@@ -326,7 +324,7 @@ class RecentActivityService {
|
|
|
326
324
|
const updated = await databaseService.update(
|
|
327
325
|
TABLES.RECENT_ACTIVITY,
|
|
328
326
|
activityRef,
|
|
329
|
-
{ title: nextTitle, titleSource: '
|
|
327
|
+
{ title: nextTitle, titleSource: 'agent', titleRefinedAt: new Date() },
|
|
330
328
|
RecentActivityRowSchema,
|
|
331
329
|
{ mutation: 'merge' },
|
|
332
330
|
)
|
|
@@ -365,7 +363,7 @@ class RecentActivityService {
|
|
|
365
363
|
return activity.titleSource === 'system'
|
|
366
364
|
}
|
|
367
365
|
|
|
368
|
-
|
|
366
|
+
isAgentTitleUseful(params: { currentTitle: string; systemTitle: string; candidateTitle: string }): boolean {
|
|
369
367
|
const candidate = compactWhitespace(params.candidateTitle)
|
|
370
368
|
if (!candidate) return false
|
|
371
369
|
|
|
@@ -385,7 +383,7 @@ class RecentActivityService {
|
|
|
385
383
|
'follow up',
|
|
386
384
|
'conversation',
|
|
387
385
|
'chat',
|
|
388
|
-
'
|
|
386
|
+
'agent task',
|
|
389
387
|
'recent activity',
|
|
390
388
|
'workstream update',
|
|
391
389
|
])
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SdkUser, SdkUserRecord } from '@lota-sdk/shared
|
|
2
|
-
import { sdkUserRecordSchema, sdkUserSchema } from '@lota-sdk/shared
|
|
1
|
+
import type { SdkUser, SdkUserRecord } from '@lota-sdk/shared'
|
|
2
|
+
import { sdkUserRecordSchema, sdkUserSchema } from '@lota-sdk/shared'
|
|
3
3
|
|
|
4
4
|
import { BaseService } from '../db/base.service'
|
|
5
5
|
import { ensureRecordId, recordIdToString } from '../db/record-id'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { toTimestamp, withCreatedAtMetadata } from '@lota-sdk/shared
|
|
2
|
-
import {
|
|
3
|
-
import type { ChatMessage } from '@lota-sdk/shared/schemas/chat-message'
|
|
1
|
+
import { parseRowMetadata, toTimestamp, withCreatedAtMetadata } from '@lota-sdk/shared'
|
|
2
|
+
import type { ChatMessage } from '@lota-sdk/shared'
|
|
4
3
|
import { RecordId, surql } from 'surrealdb'
|
|
5
4
|
import { z } from 'zod'
|
|
6
5
|
|