@crewx/sdk 0.9.0-rc.9 → 0.9.0-rc.91
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/README.md +1 -1
- package/dist/account/auth-client.d.ts +61 -0
- package/dist/account/auth-json-v2.d.ts +1 -0
- package/dist/account/auth-json.d.ts +30 -0
- package/dist/account/config.d.ts +8 -0
- package/dist/account/errors.d.ts +24 -0
- package/dist/account/index.d.ts +10 -0
- package/dist/account/index.js +1 -0
- package/dist/account/session-manager.d.ts +47 -0
- package/dist/activity-log/builder.d.ts +55 -6
- package/dist/config/canonicalize-agent-options.d.ts +17 -0
- package/dist/config/global-settings.d.ts +33 -0
- package/dist/config/migrate-grok-mode.d.ts +6 -0
- package/dist/config/model-compat.d.ts +31 -0
- package/dist/config/models.generated.d.ts +37 -0
- package/dist/config/models.remote.d.ts +1 -0
- package/dist/config/overdrive.d.ts +7 -0
- package/dist/config/pricing.d.ts +8 -5
- package/dist/config/pricing.generated.d.ts +4 -0
- package/dist/config/pricing.types.d.ts +4 -10
- package/dist/config/timeout.config.d.ts +3 -0
- package/dist/config/wi-boards.d.ts +19 -0
- package/dist/context-budget/continuity.d.ts +61 -0
- package/dist/context-budget/index.d.ts +140 -0
- package/dist/conversation/index.d.ts +1 -1
- package/dist/conversation/sqlite-provider.d.ts +5 -1
- package/dist/conversation/to-template-messages.d.ts +7 -0
- package/dist/conversation/types.d.ts +43 -0
- package/dist/desktop/command-runner.d.ts +4 -0
- package/dist/desktop/default-adapters.d.ts +4 -0
- package/dist/desktop/global-install.d.ts +19 -0
- package/dist/desktop/index.d.ts +2 -0
- package/dist/desktop/index.js +3 -0
- package/dist/desktop/install.d.ts +5 -0
- package/dist/desktop/lnk.d.ts +22 -0
- package/dist/desktop/manifest.d.ts +21 -0
- package/dist/desktop/types.d.ts +67 -0
- package/dist/desktop/version.d.ts +1 -0
- package/dist/desktop/windows-paths.d.ts +21 -0
- package/dist/desktop/wrapper.d.ts +18 -0
- package/dist/esm/account/index.js +1 -0
- package/dist/esm/desktop/index.js +3 -0
- package/dist/esm/index.js +354 -99
- package/dist/esm/plugins/index.js +213 -103
- package/dist/esm/publish/index.js +1 -0
- package/dist/esm/repository/index.js +200 -94
- package/dist/esm/testing/index.js +1 -1
- package/dist/events/types.d.ts +4 -0
- package/dist/facade/Crewx.d.ts +40 -2
- package/dist/highlight/thread-highlight-prompt.d.ts +2 -0
- package/dist/highlight/thread-highlighter.d.ts +326 -0
- package/dist/index.browser.d.ts +11 -1
- package/dist/index.browser.js +6 -2
- package/dist/index.d.ts +73 -11
- package/dist/index.js +354 -99
- package/dist/internal/console-decoder.d.ts +38 -0
- package/dist/internal/windows-spawn.d.ts +10 -0
- package/dist/layout/types.d.ts +17 -1
- package/dist/local-server/base-url.d.ts +18 -0
- package/dist/local-server/index.d.ts +8 -0
- package/dist/local-server/opencode.d.ts +8 -0
- package/dist/local-server/probe.d.ts +3 -0
- package/dist/local-server/runtime.d.ts +26 -0
- package/dist/local-server/types.d.ts +43 -0
- package/dist/migrations/0008_careful_black_bird.sql +17 -0
- package/dist/migrations/0009_hot_dark_phoenix.sql +1 -0
- package/dist/migrations/0010_analyze_stats.sql +6 -0
- package/dist/migrations/0011_far_black_tarantula.sql +1 -0
- package/dist/migrations/0012_blue_turbo.sql +23 -0
- package/dist/migrations/0013_hesitant_adam_destine.sql +15 -0
- package/dist/migrations/0014_organic_mongu.sql +73 -0
- package/dist/migrations/0015_panoramic_gorilla_man.sql +71 -0
- package/dist/migrations/0016_fuzzy_hemingway.sql +14 -0
- package/dist/migrations/0017_project_stage_sdk_migration.sql +29 -0
- package/dist/migrations/0018_bored_jackal.sql +33 -0
- package/dist/migrations/0019_backfill_task_thread_ids.sql +74 -0
- package/dist/migrations/0020_useful_iron_lad.sql +55 -0
- package/dist/migrations/0021_dashing_peter_quill.sql +51 -0
- package/dist/migrations/0022_wandering_bucky.sql +1 -0
- package/dist/migrations/0023_red_payback.sql +1 -0
- package/dist/migrations/meta/0008_snapshot.json +1327 -0
- package/dist/migrations/meta/0009_snapshot.json +1335 -0
- package/dist/migrations/meta/0010_snapshot.json +1335 -0
- package/dist/migrations/meta/0011_snapshot.json +1342 -0
- package/dist/migrations/meta/0012_snapshot.json +1494 -0
- package/dist/migrations/meta/0013_snapshot.json +1592 -0
- package/dist/migrations/meta/0014_snapshot.json +1975 -0
- package/dist/migrations/meta/0015_snapshot.json +2315 -0
- package/dist/migrations/meta/0016_snapshot.json +2419 -0
- package/dist/migrations/meta/0017_snapshot.json +2419 -0
- package/dist/migrations/meta/0018_snapshot.json +2570 -0
- package/dist/migrations/meta/0020_snapshot.json +2895 -0
- package/dist/migrations/meta/0021_snapshot.json +3031 -0
- package/dist/migrations/meta/0022_snapshot.json +3039 -0
- package/dist/migrations/meta/0023_snapshot.json +3047 -0
- package/dist/migrations/meta/_journal.json +112 -0
- package/dist/paths.d.ts +1 -0
- package/dist/plugin/types.d.ts +1 -0
- package/dist/plugins/index.js +213 -103
- package/dist/plugins/sqlite-tracing.d.ts +23 -0
- package/dist/provider/acp/connection.d.ts +6 -0
- package/dist/provider/acp/meta.d.ts +11 -0
- package/dist/provider/bridge.d.ts +6 -0
- package/dist/provider/classify-task-error.d.ts +2 -0
- package/dist/provider/cli/adapter.types.d.ts +8 -1
- package/dist/provider/cli/adapters/agent-call.util.d.ts +1 -1
- package/dist/provider/cli/adapters/cli-knob.util.d.ts +7 -0
- package/dist/provider/cli/adapters/grok.d.ts +2 -0
- package/dist/provider/cli/adapters/index.d.ts +1 -0
- package/dist/provider/cli/index.d.ts +1 -1
- package/dist/provider/cli/meta.d.ts +5 -0
- package/dist/provider/cli/protocol-envelope.d.ts +2 -0
- package/dist/provider/errors.d.ts +1 -0
- package/dist/provider/idle-watchdog.d.ts +19 -0
- package/dist/provider/models.d.ts +17 -12
- package/dist/provider/order.d.ts +1 -1
- package/dist/provider/parse-usage.d.ts +6 -0
- package/dist/provider/provider-selection.d.ts +8 -0
- package/dist/provider/redact-technical-message.d.ts +1 -0
- package/dist/provider/task-error.types.d.ts +16 -0
- package/dist/publish/constants.d.ts +6 -0
- package/dist/publish/index.d.ts +26 -0
- package/dist/publish/index.js +1 -0
- package/dist/publish/manifest.d.ts +17 -0
- package/dist/publish/marketplace-api.constants.d.ts +1 -0
- package/dist/publish/pack.d.ts +2 -0
- package/dist/publish/scan.d.ts +9 -0
- package/dist/publish/secrets.d.ts +6 -0
- package/dist/publish/upload.d.ts +18 -0
- package/dist/remote/execution-profile.d.ts +9 -0
- package/dist/remote/index.d.ts +1 -0
- package/dist/remote/types.d.ts +28 -0
- package/dist/repository/agent-suggestion.repository.d.ts +34 -0
- package/dist/repository/common-code.repository.d.ts +45 -0
- package/dist/repository/db.d.ts +8 -0
- package/dist/repository/index.d.ts +28 -4
- package/dist/repository/index.js +200 -94
- package/dist/repository/notification.repository.d.ts +58 -0
- package/dist/repository/project.repository.d.ts +90 -0
- package/dist/repository/request-log.repository.d.ts +1 -0
- package/dist/repository/task-log-migration.d.ts +74 -0
- package/dist/repository/task-log.repository.d.ts +44 -0
- package/dist/repository/task.repository.d.ts +120 -0
- package/dist/repository/thread-history.repository.d.ts +193 -0
- package/dist/repository/thread-title-common-code-migration.d.ts +13 -0
- package/dist/repository/thread-title.types.d.ts +29 -0
- package/dist/repository/thread.repository.d.ts +21 -2
- package/dist/repository/usage-report.repository.d.ts +27 -0
- package/dist/repository/workspace.repository.d.ts +3 -0
- package/dist/schema/agent-suggestions.d.ts +199 -0
- package/dist/schema/common-codes.d.ts +216 -0
- package/dist/schema/index.d.ts +9 -0
- package/dist/schema/notifications.d.ts +303 -0
- package/dist/schema/projects.d.ts +610 -0
- package/dist/schema/task-log-events.d.ts +119 -0
- package/dist/schema/tasks.d.ts +53 -0
- package/dist/schema/thread-history.d.ts +734 -0
- package/dist/schema/threads.d.ts +2 -0
- package/dist/schema/ui-action-receipts.d.ts +303 -0
- package/dist/schema/ui-instances.d.ts +267 -0
- package/dist/schema/usage-reports.d.ts +252 -0
- package/dist/schema/workspaces.d.ts +17 -0
- package/dist/task-log/anchor-child-tasks.d.ts +7 -0
- package/dist/task-log/delegation-trailer.d.ts +34 -0
- package/dist/testing/index.js +1 -1
- package/dist/types/index.d.ts +1536 -3
- package/dist/types/task-log.types.d.ts +2 -0
- package/dist/ui-card/index.d.ts +2 -0
- package/dist/ui-card/legacy-card-parser.d.ts +11 -0
- package/dist/ui-instance/definition.d.ts +6 -0
- package/dist/ui-instance/errors.d.ts +17 -0
- package/dist/ui-instance/index.d.ts +6 -0
- package/dist/ui-instance/json.d.ts +5 -0
- package/dist/ui-instance/runtime.d.ts +13 -0
- package/dist/ui-instance/store.d.ts +65 -0
- package/dist/ui-instance/types.d.ts +200 -0
- package/dist/ui-plugin/index.d.ts +3 -0
- package/dist/ui-plugin/manifest.d.ts +3 -0
- package/dist/ui-plugin/types.d.ts +76 -0
- package/dist/ui-plugin/validator.d.ts +9 -0
- package/dist/utils/crewx-executable.d.ts +54 -0
- package/dist/utils/crewx-home.d.ts +1 -0
- package/dist/utils/env-defaults.d.ts +2 -0
- package/dist/utils/id.d.ts +1 -1
- package/dist/utils/timestamp.d.ts +1 -0
- package/dist/wi/create.d.ts +48 -0
- package/dist/wi/select.d.ts +20 -0
- package/package.json +25 -2
- package/templates/agents/default.yaml +244 -120
- package/templates/documents/crewx-manual.md +138 -138
- package/templates/workflows/wi-default-flow.yaml +65 -0
- package/templates/workflows/wi-plan-flow.yaml +140 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BaseSqliteRepository } from './base-sqlite-repository.js';
|
|
2
|
+
import { notifications, notification_reads } from '../schema/index.js';
|
|
3
|
+
export declare const DEFAULT_NOTIFICATION_CAP = 500;
|
|
4
|
+
export type NotificationRow = typeof notifications.$inferSelect;
|
|
5
|
+
export type NewNotification = typeof notifications.$inferInsert;
|
|
6
|
+
export type NotificationReadRow = typeof notification_reads.$inferSelect;
|
|
7
|
+
export type NotificationLevel = 'info' | 'warning' | 'critical';
|
|
8
|
+
export type NotificationSource = 'agent' | 'system';
|
|
9
|
+
export interface CreateNotificationInput {
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
agentId?: string | null;
|
|
12
|
+
taskId?: string | null;
|
|
13
|
+
threadId?: string | null;
|
|
14
|
+
source?: NotificationSource;
|
|
15
|
+
level?: NotificationLevel;
|
|
16
|
+
title: string;
|
|
17
|
+
body?: string | null;
|
|
18
|
+
targetUserId?: string | null;
|
|
19
|
+
metadata?: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface NotificationListItem extends NotificationRow {
|
|
22
|
+
read: boolean;
|
|
23
|
+
read_at: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface ListNotificationsParams {
|
|
26
|
+
workspaceId: string;
|
|
27
|
+
userId: string;
|
|
28
|
+
limit?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface UserScope {
|
|
31
|
+
workspaceId: string;
|
|
32
|
+
userId: string;
|
|
33
|
+
}
|
|
34
|
+
export interface MarkReadParams {
|
|
35
|
+
notificationId: string;
|
|
36
|
+
workspaceId: string;
|
|
37
|
+
userId: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const DEFAULT_LIST_LIMIT = 50;
|
|
40
|
+
export declare class NotificationRepository extends BaseSqliteRepository {
|
|
41
|
+
private readonly dbPath?;
|
|
42
|
+
private readonly cap;
|
|
43
|
+
constructor(opts?: {
|
|
44
|
+
dbPath?: string;
|
|
45
|
+
dbRoot?: string;
|
|
46
|
+
cap?: number;
|
|
47
|
+
});
|
|
48
|
+
resolveDbPath(): string;
|
|
49
|
+
private openHandle;
|
|
50
|
+
create(input: CreateNotificationInput): {
|
|
51
|
+
id: string;
|
|
52
|
+
};
|
|
53
|
+
private enforceCap;
|
|
54
|
+
list(params: ListNotificationsParams): NotificationListItem[];
|
|
55
|
+
unreadCount(params: UserScope): number;
|
|
56
|
+
markRead(params: MarkReadParams): boolean;
|
|
57
|
+
markAllRead(params: UserScope): number;
|
|
58
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { BaseSqliteRepository } from './base-sqlite-repository.js';
|
|
2
|
+
import type { Project as ProjectLedgerRow, ProjectCriterion as ProjectCriterionRow, ProjectEvent as ProjectEventRow } from '../schema/index.js';
|
|
3
|
+
export type ProjectScene = 'planning' | 'plan_review' | 'running' | 'human_wait' | 'limit_wait' | 'failed_stop' | 'analyzing_feedback' | 'replanned' | 'awaiting_review' | 'accepted';
|
|
4
|
+
export type CriterionVerifyStatus = 'pending' | 'verifying' | 'passed' | 'failed';
|
|
5
|
+
export type ProjectActorType = 'user' | 'project_manager' | 'system';
|
|
6
|
+
export type ProjectEventType = 'created' | 'plan_proposed' | 'plan_approved' | 'decision_requested' | 'decision_answered' | 'replanned' | 'stage_advanced' | 'criterion_verified' | 'scene_changed' | 'result_submitted' | 'accepted';
|
|
7
|
+
export type ProjectEvidenceKind = 'task' | 'wi' | 'url';
|
|
8
|
+
export interface ProjectStage {
|
|
9
|
+
key: string;
|
|
10
|
+
labelOverride: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_PROJECT_STAGE_KEYS: readonly ["outcome_plan", "contract_check", "feature_link", "use_verify", "result_review"];
|
|
13
|
+
export declare const DEFAULT_PROJECT_STAGES: readonly ProjectStage[];
|
|
14
|
+
export interface ProjectEvidence {
|
|
15
|
+
kind: ProjectEvidenceKind;
|
|
16
|
+
ref: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ProjectActorInput {
|
|
20
|
+
actorType?: ProjectActorType;
|
|
21
|
+
actorId?: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface CreateProjectInput {
|
|
24
|
+
workspaceId: string;
|
|
25
|
+
name: string;
|
|
26
|
+
outcome: string;
|
|
27
|
+
dueDate?: string | null;
|
|
28
|
+
stages?: readonly ProjectStage[];
|
|
29
|
+
criteria: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
export interface ListProjectsOptions {
|
|
32
|
+
includeArchived?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface ListProjectEventsOptions {
|
|
35
|
+
afterSeq?: number;
|
|
36
|
+
limit?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface AppendProjectEventInput extends ProjectActorInput {
|
|
39
|
+
projectId: string;
|
|
40
|
+
type: ProjectEventType;
|
|
41
|
+
title: string;
|
|
42
|
+
summary?: string | null;
|
|
43
|
+
payload?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
export interface SetCriterionVerifyInput extends ProjectActorInput {
|
|
46
|
+
projectId?: string;
|
|
47
|
+
criterionId: string;
|
|
48
|
+
verifyStatus?: CriterionVerifyStatus;
|
|
49
|
+
status?: CriterionVerifyStatus;
|
|
50
|
+
}
|
|
51
|
+
export interface SetCriterionEvidenceInput extends ProjectActorInput {
|
|
52
|
+
projectId?: string;
|
|
53
|
+
criterionId: string;
|
|
54
|
+
evidence: readonly ProjectEvidence[];
|
|
55
|
+
}
|
|
56
|
+
export interface AcceptProjectInput extends ProjectActorInput {
|
|
57
|
+
remainingRisks: unknown;
|
|
58
|
+
nextPlan: unknown;
|
|
59
|
+
lessons: unknown;
|
|
60
|
+
evidenceRefs: unknown;
|
|
61
|
+
}
|
|
62
|
+
export interface ProjectDetail extends ProjectLedgerRow {
|
|
63
|
+
stages: ProjectStage[];
|
|
64
|
+
criteria: ProjectCriterionRow[];
|
|
65
|
+
}
|
|
66
|
+
export declare class ProjectRepository extends BaseSqliteRepository {
|
|
67
|
+
private readonly dbPath?;
|
|
68
|
+
constructor(opts?: {
|
|
69
|
+
dbPath?: string;
|
|
70
|
+
dbRoot?: string;
|
|
71
|
+
});
|
|
72
|
+
resolveDbPath(): string;
|
|
73
|
+
private openHandle;
|
|
74
|
+
private getDetailFromHandle;
|
|
75
|
+
private getDetailOrThrow;
|
|
76
|
+
createProject(input: CreateProjectInput): ProjectDetail;
|
|
77
|
+
getProject(id: string): ProjectDetail | undefined;
|
|
78
|
+
listProjectsByWorkspace(workspaceId: string, options?: ListProjectsOptions): ProjectDetail[];
|
|
79
|
+
archiveProject(id: string): ProjectDetail;
|
|
80
|
+
setScene(id: string, scene: ProjectScene, actor?: ProjectActorInput): ProjectDetail;
|
|
81
|
+
setStageIndex(id: string, index: number, actor?: ProjectActorInput): ProjectDetail;
|
|
82
|
+
setCriterionVerify(input: SetCriterionVerifyInput): ProjectCriterionRow;
|
|
83
|
+
setCriterionVerify(projectId: string, criterionId: string, status: CriterionVerifyStatus, actor?: ProjectActorInput): ProjectCriterionRow;
|
|
84
|
+
setCriterionEvidence(input: SetCriterionEvidenceInput): ProjectCriterionRow;
|
|
85
|
+
setCriterionEvidence(projectId: string, criterionId: string, evidence: readonly ProjectEvidence[], actor?: ProjectActorInput): ProjectCriterionRow;
|
|
86
|
+
appendEvent(input: AppendProjectEventInput): ProjectEventRow;
|
|
87
|
+
appendEvent(projectId: string, input: Omit<AppendProjectEventInput, 'projectId'>): ProjectEventRow;
|
|
88
|
+
listEvents(projectId: string, options?: ListProjectEventsOptions): ProjectEventRow[];
|
|
89
|
+
acceptProject(id: string, input: AcceptProjectInput): ProjectDetail;
|
|
90
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export type TaskLogMigrationMode = 'dry-run' | 'apply' | 'verify';
|
|
2
|
+
export declare const TASK_LOG_MIGRATION_TERMINAL_STATUSES: readonly ["success", "failed", "completed"];
|
|
3
|
+
export declare const TASK_LOG_MIGRATION_MIN_FREE_SPACE_BYTES: number;
|
|
4
|
+
export declare const TASK_LOG_MIGRATION_EVENT_ROW_BYTES = 256;
|
|
5
|
+
export type TaskLogVerificationIssueKind = 'malformed-blob' | 'mixed-source' | 'seq-gap' | 'duplicate-seq' | 'orphan-event' | 'count-mismatch' | 'source-invariant' | 'invalid-event';
|
|
6
|
+
export type TaskLogMigrationFailureKind = 'malformed' | 'mixed-source' | 'metadata' | 'invalid-source';
|
|
7
|
+
export interface TaskLogMigrationOptions {
|
|
8
|
+
mode: TaskLogMigrationMode;
|
|
9
|
+
dbPath?: string;
|
|
10
|
+
batchTasks?: number;
|
|
11
|
+
backupPath?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TaskLogMigrationFailure {
|
|
14
|
+
taskId: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
kind?: TaskLogMigrationFailureKind;
|
|
17
|
+
}
|
|
18
|
+
export interface TaskLogVerificationIssue {
|
|
19
|
+
taskId: string | null;
|
|
20
|
+
kind: TaskLogVerificationIssueKind;
|
|
21
|
+
reason: string;
|
|
22
|
+
expected?: number;
|
|
23
|
+
actual?: number;
|
|
24
|
+
seq?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface TaskLogVerificationReport {
|
|
27
|
+
checkedTasks: number;
|
|
28
|
+
eventSourceTasks: number;
|
|
29
|
+
blobSourceTasks: number;
|
|
30
|
+
eventCount: number;
|
|
31
|
+
orphanEventCount: number;
|
|
32
|
+
failedTasks: number;
|
|
33
|
+
issues: TaskLogVerificationIssue[];
|
|
34
|
+
}
|
|
35
|
+
export interface TaskLogMigrationReport {
|
|
36
|
+
mode: TaskLogMigrationMode;
|
|
37
|
+
ok: boolean;
|
|
38
|
+
dbPath: string;
|
|
39
|
+
backupPath?: string;
|
|
40
|
+
backupMethod?: 'sqlite-online-backup';
|
|
41
|
+
blockedReason?: string;
|
|
42
|
+
activeTaskCount: number;
|
|
43
|
+
taskCount: number;
|
|
44
|
+
candidateTaskCount: number;
|
|
45
|
+
eligibleTaskCount: number;
|
|
46
|
+
statusCounts: Record<string, number>;
|
|
47
|
+
deferredTaskCount: number;
|
|
48
|
+
deferredStatusCounts: Record<string, number>;
|
|
49
|
+
entryCount: number;
|
|
50
|
+
sourceBytes: number;
|
|
51
|
+
estimatedFreeSpaceBytes: number;
|
|
52
|
+
requiredFreeSpaceBytes: number;
|
|
53
|
+
availableFreeSpaceBytes: number;
|
|
54
|
+
minimumFreeSpaceReserveBytes: number;
|
|
55
|
+
freeSpaceGatePassed: boolean;
|
|
56
|
+
migratedTasks: number;
|
|
57
|
+
migratedEntries: number;
|
|
58
|
+
skippedTasks: number;
|
|
59
|
+
failedTasks: number;
|
|
60
|
+
malformedRows: TaskLogMigrationFailure[];
|
|
61
|
+
failures: TaskLogMigrationFailure[];
|
|
62
|
+
logicalSourceBytesRemoved: number;
|
|
63
|
+
warnings: string[];
|
|
64
|
+
remainingTaskCount: number;
|
|
65
|
+
verification?: TaskLogVerificationReport;
|
|
66
|
+
}
|
|
67
|
+
export declare function resolveTaskLogMigrationDbPath(dbPath?: string): string;
|
|
68
|
+
export declare function hasSufficientTaskLogMigrationFreeSpace(availableFreeSpaceBytes: number, estimatedFreeSpaceBytes: number): boolean;
|
|
69
|
+
export interface TaskLogWalCheckpointConnection {
|
|
70
|
+
pragma(pragma: string): unknown;
|
|
71
|
+
}
|
|
72
|
+
export declare function tryCheckpointTaskLogWal(db: TaskLogWalCheckpointConnection): string | undefined;
|
|
73
|
+
export declare function runTaskLogMigration(options: TaskLogMigrationOptions): Promise<TaskLogMigrationReport>;
|
|
74
|
+
export declare function taskLogBackupName(backupPath: string): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseSqliteRepository } from './base-sqlite-repository.js';
|
|
2
|
+
export type TaskLogStorage = 'blob' | 'events';
|
|
3
|
+
export interface TaskLogEntry {
|
|
4
|
+
timestamp: string;
|
|
5
|
+
level: string;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export type RawTaskLogEntry = TaskLogEntry;
|
|
9
|
+
export type TaskLogRawEntry = TaskLogEntry;
|
|
10
|
+
export interface TaskLogState {
|
|
11
|
+
taskId: string;
|
|
12
|
+
source: TaskLogStorage;
|
|
13
|
+
revision: number;
|
|
14
|
+
lastSeq: number;
|
|
15
|
+
}
|
|
16
|
+
export interface TaskLogReadResult extends TaskLogState {
|
|
17
|
+
entries: TaskLogEntry[];
|
|
18
|
+
}
|
|
19
|
+
export interface TaskLogRepositoryContract {
|
|
20
|
+
appendLog(taskId: string, entry: TaskLogEntry): TaskLogState;
|
|
21
|
+
appendLogs(taskId: string, entries: readonly TaskLogEntry[]): TaskLogState;
|
|
22
|
+
readLogs(taskId: string): TaskLogReadResult | undefined;
|
|
23
|
+
readLogsTail(taskId: string, limit: number): TaskLogReadResult | undefined;
|
|
24
|
+
getLogState(taskId: string): TaskLogState | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare class TaskLogRepository extends BaseSqliteRepository implements TaskLogRepositoryContract {
|
|
27
|
+
private readonly dbPath?;
|
|
28
|
+
constructor(opts?: {
|
|
29
|
+
dbPath?: string;
|
|
30
|
+
dbRoot?: string;
|
|
31
|
+
});
|
|
32
|
+
resolveDbPath(): string;
|
|
33
|
+
private openHandle;
|
|
34
|
+
private findStateRow;
|
|
35
|
+
private findStateRowInTransaction;
|
|
36
|
+
private requireStateRowInTransaction;
|
|
37
|
+
appendLog(taskId: string, entry: TaskLogEntry): TaskLogState;
|
|
38
|
+
appendLogs(taskId: string, entries: readonly TaskLogEntry[]): TaskLogState;
|
|
39
|
+
getLogState(taskId: string): TaskLogState | undefined;
|
|
40
|
+
readLogs(taskId: string): TaskLogReadResult | undefined;
|
|
41
|
+
readLogsTail(taskId: string, limit: number): TaskLogReadResult | undefined;
|
|
42
|
+
readTail(taskId: string, limit: number): TaskLogReadResult | undefined;
|
|
43
|
+
private readLogsInternal;
|
|
44
|
+
}
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
import { BaseSqliteRepository } from './base-sqlite-repository.js';
|
|
2
2
|
import { tasks } from '../schema/index.js';
|
|
3
|
+
import type { TaskLogEntry, TaskLogReadResult, TaskLogState } from './task-log.repository.js';
|
|
3
4
|
export type TaskRow = typeof tasks.$inferSelect;
|
|
4
5
|
export type NewTask = typeof tasks.$inferInsert;
|
|
6
|
+
export type TaskListRow = Pick<TaskRow, 'id' | 'thread_id' | 'agent_id' | 'status' | 'parent_task_id' | 'started_at' | 'completed_at' | 'duration_ms' | 'input_tokens' | 'output_tokens' | 'cost_usd' | 'error'>;
|
|
7
|
+
export type TaskActivityLogRow = Pick<TaskRow, 'id' | 'thread_id' | 'agent_id' | 'parent_task_id' | 'started_at' | 'completed_at'>;
|
|
8
|
+
export type FindTasksByThreadOptions = {
|
|
9
|
+
projection: 'activity-log';
|
|
10
|
+
};
|
|
11
|
+
export interface WorkflowCardRow {
|
|
12
|
+
taskId: string;
|
|
13
|
+
workflowRunId?: string;
|
|
14
|
+
raw?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface WorkflowParentTaskRow {
|
|
17
|
+
id: string;
|
|
18
|
+
agent_id: string;
|
|
19
|
+
thread_id: string | null;
|
|
20
|
+
workspace_id: string | null;
|
|
21
|
+
platform: string | null;
|
|
22
|
+
status: string;
|
|
23
|
+
error: string | null;
|
|
24
|
+
completed_at: string | null;
|
|
25
|
+
duration_ms: number | null;
|
|
26
|
+
started_at: string;
|
|
27
|
+
metadata: string | null;
|
|
28
|
+
}
|
|
5
29
|
export interface AgentUsageRow {
|
|
6
30
|
agentId: string;
|
|
7
31
|
workspaceId: string | null;
|
|
@@ -32,8 +56,56 @@ export interface ProviderUsageRow {
|
|
|
32
56
|
activeDurationMs: number;
|
|
33
57
|
lastActiveAt: string | null;
|
|
34
58
|
}
|
|
59
|
+
export interface ModelUsageRow {
|
|
60
|
+
model: string;
|
|
61
|
+
provider: string;
|
|
62
|
+
totalTasks: number;
|
|
63
|
+
inputTokens: number;
|
|
64
|
+
outputTokens: number;
|
|
65
|
+
cachedInputTokens: number;
|
|
66
|
+
costUsd: number;
|
|
67
|
+
totalTokens: number;
|
|
68
|
+
activeDurationMs: number;
|
|
69
|
+
lastActiveAt: string | null;
|
|
70
|
+
}
|
|
71
|
+
export interface ReportTaskRow {
|
|
72
|
+
threadId: string | null;
|
|
73
|
+
agentId: string;
|
|
74
|
+
startedAt: string;
|
|
75
|
+
status: string;
|
|
76
|
+
error: string | null;
|
|
77
|
+
exitCode: number | null;
|
|
78
|
+
}
|
|
79
|
+
export interface DelegationEdge {
|
|
80
|
+
callerAgentId: string | null;
|
|
81
|
+
agentId: string;
|
|
82
|
+
taskCount: number;
|
|
83
|
+
totalTokens: number;
|
|
84
|
+
outputTokens: number;
|
|
85
|
+
}
|
|
86
|
+
export interface DelegationMatrixResult {
|
|
87
|
+
edges: DelegationEdge[];
|
|
88
|
+
truncated: boolean;
|
|
89
|
+
}
|
|
90
|
+
export type TaskEvidenceRow = Pick<TaskRow, 'id' | 'agent_id' | 'status' | 'prompt' | 'started_at' | 'completed_at' | 'thread_id'>;
|
|
91
|
+
export interface ThreadChainTurn {
|
|
92
|
+
id: string;
|
|
93
|
+
agentId: string;
|
|
94
|
+
status: string;
|
|
95
|
+
prompt: string;
|
|
96
|
+
startedAt: string;
|
|
97
|
+
completedAt: string | null;
|
|
98
|
+
}
|
|
99
|
+
export interface ThreadChain {
|
|
100
|
+
threadId: string;
|
|
101
|
+
targetAgentTurnCount: number;
|
|
102
|
+
turns: ThreadChainTurn[];
|
|
103
|
+
}
|
|
104
|
+
export declare const PID_NULL_REAP_GRACE_MS: number;
|
|
35
105
|
export declare class TaskRepository extends BaseSqliteRepository {
|
|
36
106
|
private readonly dbPath?;
|
|
107
|
+
private readonly taskLogRepository;
|
|
108
|
+
private readonly pidNullObservedSince;
|
|
37
109
|
constructor(opts?: {
|
|
38
110
|
dbPath?: string;
|
|
39
111
|
dbRoot?: string;
|
|
@@ -54,6 +126,7 @@ export declare class TaskRepository extends BaseSqliteRepository {
|
|
|
54
126
|
command?: string | null;
|
|
55
127
|
metadata?: string | null;
|
|
56
128
|
workspaceId?: string | null;
|
|
129
|
+
projectId?: string | null;
|
|
57
130
|
platform?: string | null;
|
|
58
131
|
crewxVersion?: string | null;
|
|
59
132
|
threadId?: string | null;
|
|
@@ -61,6 +134,7 @@ export declare class TaskRepository extends BaseSqliteRepository {
|
|
|
61
134
|
renderedPrompt?: string | null;
|
|
62
135
|
codingAgentCommand?: string | null;
|
|
63
136
|
}): void;
|
|
137
|
+
listTasksByProjectId(projectId: string): TaskRow[];
|
|
64
138
|
finishTask(opts: {
|
|
65
139
|
id: string;
|
|
66
140
|
status: string;
|
|
@@ -75,12 +149,17 @@ export declare class TaskRepository extends BaseSqliteRepository {
|
|
|
75
149
|
costUsd?: number;
|
|
76
150
|
model?: string | null;
|
|
77
151
|
runEpoch?: number | null;
|
|
152
|
+
partialResultRecovered?: boolean;
|
|
78
153
|
}): void;
|
|
79
154
|
appendLog(taskId: string, entry: {
|
|
80
155
|
timestamp: string;
|
|
81
156
|
level: string;
|
|
82
157
|
message: string;
|
|
83
158
|
}): void;
|
|
159
|
+
appendLogs(taskId: string, entries: readonly TaskLogEntry[]): void;
|
|
160
|
+
readLogs(taskId: string): TaskLogReadResult | undefined;
|
|
161
|
+
readLogsTail(taskId: string, limit: number): TaskLogReadResult | undefined;
|
|
162
|
+
getLogState(taskId: string): TaskLogState | undefined;
|
|
84
163
|
getRunningTasks(): TaskRow[];
|
|
85
164
|
getAllTasks(): TaskRow[];
|
|
86
165
|
getTask(id: string): TaskRow | undefined;
|
|
@@ -89,6 +168,7 @@ export declare class TaskRepository extends BaseSqliteRepository {
|
|
|
89
168
|
pid?: number;
|
|
90
169
|
};
|
|
91
170
|
reapOrphanedTasks(): number;
|
|
171
|
+
reapRunningWorkflowTasks(graceMs?: number): number;
|
|
92
172
|
findTaskStatus(taskId: string, workspaceId?: string): TaskRow | undefined;
|
|
93
173
|
findChildTasks(parentTaskId: string, workspaceId?: string): TaskRow[];
|
|
94
174
|
getWorkspaceUsageSummary(workspaceId?: string): Array<{
|
|
@@ -103,7 +183,12 @@ export declare class TaskRepository extends BaseSqliteRepository {
|
|
|
103
183
|
outputTokens: number;
|
|
104
184
|
costUsd: number;
|
|
105
185
|
};
|
|
186
|
+
findTasksByThread(threadId: string, workspaceId: string | undefined, options: FindTasksByThreadOptions): TaskActivityLogRow[];
|
|
106
187
|
findTasksByThread(threadId: string, workspaceId?: string): TaskRow[];
|
|
188
|
+
private parseWorkflowCardMetadata;
|
|
189
|
+
private extractThreadIdFromCommand;
|
|
190
|
+
findRunningWorkflowParentTasks(): WorkflowParentTaskRow[];
|
|
191
|
+
batchFetchWorkflowCards(threadIds: string[], workspaceId?: string): Map<string, WorkflowCardRow>;
|
|
107
192
|
findAllTasks(params: {
|
|
108
193
|
workspaceId?: string;
|
|
109
194
|
agentId?: string;
|
|
@@ -124,7 +209,42 @@ export declare class TaskRepository extends BaseSqliteRepository {
|
|
|
124
209
|
getAgentUsage(from: string, to: string, workspace?: string): AgentUsageRow[];
|
|
125
210
|
getAgentUsageTrendRaw(from: string, to: string, workspace?: string): TrendRow[];
|
|
126
211
|
findTaskForStop(taskId: string, workspaceId: string): TaskRow | undefined;
|
|
212
|
+
findLatestTaskByMetadata(opts: {
|
|
213
|
+
agentId: string;
|
|
214
|
+
workspaceId: string;
|
|
215
|
+
metaKey: string;
|
|
216
|
+
metaValue: string;
|
|
217
|
+
}): {
|
|
218
|
+
id: string;
|
|
219
|
+
thread_id: string | null;
|
|
220
|
+
status: string;
|
|
221
|
+
result: string | null;
|
|
222
|
+
error: string | null;
|
|
223
|
+
started_at: string;
|
|
224
|
+
completed_at: string | null;
|
|
225
|
+
metadata: string | null;
|
|
226
|
+
} | null;
|
|
127
227
|
markTaskFailed(taskId: string, error: string, workspaceId?: string): void;
|
|
128
228
|
findTasksByPromptHint(hint: string, workspaceId?: string): TaskRow[];
|
|
129
229
|
getProviderUsage(from: string, to: string, workspace?: string): ProviderUsageRow[];
|
|
230
|
+
getModelUsage(from: string, to: string, workspace?: string): ModelUsageRow[];
|
|
231
|
+
getTasksForReport(from: string, to: string, workspace?: string): ReportTaskRow[];
|
|
232
|
+
getDelegationMatrix(from: string, to: string, workspace?: string): DelegationMatrixResult;
|
|
233
|
+
findTaskEvidence(params: {
|
|
234
|
+
workspaceId?: string;
|
|
235
|
+
agents?: string[];
|
|
236
|
+
statuses?: string[];
|
|
237
|
+
from?: string;
|
|
238
|
+
to?: string;
|
|
239
|
+
limit?: number;
|
|
240
|
+
order?: 'ASC' | 'DESC';
|
|
241
|
+
}): TaskEvidenceRow[];
|
|
242
|
+
findThreadChains(params: {
|
|
243
|
+
targetAgentId: string;
|
|
244
|
+
workspaceId?: string;
|
|
245
|
+
from?: string;
|
|
246
|
+
to?: string;
|
|
247
|
+
maxThreads?: number;
|
|
248
|
+
maxTurnsPerThread?: number;
|
|
249
|
+
}): ThreadChain[];
|
|
130
250
|
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { BaseSqliteRepository } from './base-sqlite-repository.js';
|
|
2
|
+
import { RepositoryError } from './errors.js';
|
|
3
|
+
import type { ThreadActorType, ThreadEvent, ThreadHighlight, ThreadHighlightKind, ThreadHighlightRun, ThreadHighlightSource } from '../schema/index.js';
|
|
4
|
+
import type { ThreadPriority, ThreadState } from './thread-title.types.js';
|
|
5
|
+
export interface ThreadActorInput {
|
|
6
|
+
actorType?: ThreadActorType;
|
|
7
|
+
actorId?: string | null;
|
|
8
|
+
actor?: {
|
|
9
|
+
actorType?: ThreadActorType;
|
|
10
|
+
actorId?: string | null;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface ThreadSnapshotMutationInput extends ThreadActorInput {
|
|
14
|
+
threadId: string;
|
|
15
|
+
workspaceId?: string | null;
|
|
16
|
+
title?: string | null;
|
|
17
|
+
priority?: ThreadPriority | null;
|
|
18
|
+
state?: ThreadState | null;
|
|
19
|
+
taskId?: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface ThreadSnapshot {
|
|
22
|
+
threadId: string;
|
|
23
|
+
workspaceId: string | null;
|
|
24
|
+
title: string | null;
|
|
25
|
+
priority: ThreadPriority | null;
|
|
26
|
+
state: ThreadState | null;
|
|
27
|
+
metadata: string | null;
|
|
28
|
+
titleLocked: boolean;
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ThreadTimelineOptions {
|
|
32
|
+
beforeSeq?: number;
|
|
33
|
+
afterSeq?: number;
|
|
34
|
+
limit?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ThreadTimelineQuery extends ThreadTimelineOptions {
|
|
37
|
+
threadId: string;
|
|
38
|
+
workspaceId: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ThreadTimeline {
|
|
41
|
+
items: ThreadEvent[];
|
|
42
|
+
latestSeq: number;
|
|
43
|
+
hasMoreOlder: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface CreateThreadHighlightInput extends ThreadActorInput {
|
|
46
|
+
threadId: string;
|
|
47
|
+
workspaceId: string;
|
|
48
|
+
source?: ThreadHighlightSource;
|
|
49
|
+
kind: ThreadHighlightKind;
|
|
50
|
+
text: string;
|
|
51
|
+
taskId?: string;
|
|
52
|
+
coversFromTaskId?: string;
|
|
53
|
+
coversToTaskId?: string;
|
|
54
|
+
fromTaskId?: string;
|
|
55
|
+
toTaskId?: string;
|
|
56
|
+
agentId?: string | null;
|
|
57
|
+
sourceTaskId?: string | null;
|
|
58
|
+
detectorVersion?: string | null;
|
|
59
|
+
contentFingerprint?: string | null;
|
|
60
|
+
idempotencyKey?: string;
|
|
61
|
+
id?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface UpdateThreadHighlightInput extends ThreadActorInput {
|
|
64
|
+
threadId: string;
|
|
65
|
+
workspaceId: string;
|
|
66
|
+
highlightId: string;
|
|
67
|
+
expectedRevision: number;
|
|
68
|
+
text?: string;
|
|
69
|
+
kind?: ThreadHighlightKind;
|
|
70
|
+
coversFromTaskId?: string;
|
|
71
|
+
coversToTaskId?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface DismissThreadHighlightInput extends ThreadActorInput {
|
|
74
|
+
threadId: string;
|
|
75
|
+
workspaceId: string;
|
|
76
|
+
highlightId: string;
|
|
77
|
+
expectedRevision: number;
|
|
78
|
+
}
|
|
79
|
+
export interface ListActiveHighlightsOptions {
|
|
80
|
+
taskId?: string;
|
|
81
|
+
coversFromTaskId?: string;
|
|
82
|
+
coversToTaskId?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface ThreadHighlightEligibleTurn {
|
|
85
|
+
taskId: string;
|
|
86
|
+
prompt: string;
|
|
87
|
+
result: string;
|
|
88
|
+
status: string;
|
|
89
|
+
startedAt: string;
|
|
90
|
+
completedAt: string | null;
|
|
91
|
+
}
|
|
92
|
+
export interface CreateThreadHighlightRegenerationRunInput extends ThreadActorInput {
|
|
93
|
+
threadId: string;
|
|
94
|
+
workspaceId: string;
|
|
95
|
+
requestId: string;
|
|
96
|
+
detectorVersion: string;
|
|
97
|
+
runId?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface CreateThreadHighlightRegenerationRunResult {
|
|
100
|
+
run: ThreadHighlightRun;
|
|
101
|
+
created: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface FailThreadHighlightRegenerationRunInput extends ThreadActorInput {
|
|
104
|
+
runId: string;
|
|
105
|
+
workspaceId?: string;
|
|
106
|
+
errorCode: string;
|
|
107
|
+
}
|
|
108
|
+
export interface ThreadHighlightRegenerationCandidate {
|
|
109
|
+
kind: ThreadHighlightKind;
|
|
110
|
+
text: string;
|
|
111
|
+
anchorTaskId: string;
|
|
112
|
+
coversFromTaskId: string;
|
|
113
|
+
coversToTaskId: string;
|
|
114
|
+
contentFingerprint?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface CompleteThreadHighlightRegenerationInput extends ThreadActorInput {
|
|
117
|
+
runId: string;
|
|
118
|
+
threadId: string;
|
|
119
|
+
workspaceId: string;
|
|
120
|
+
detectorVersion: string;
|
|
121
|
+
agentId?: string | null;
|
|
122
|
+
candidates: readonly ThreadHighlightRegenerationCandidate[];
|
|
123
|
+
}
|
|
124
|
+
export interface CompleteThreadHighlightRegenerationResult {
|
|
125
|
+
run: ThreadHighlightRun;
|
|
126
|
+
deletedCount: number;
|
|
127
|
+
createdCount: number;
|
|
128
|
+
previousAutoCount: number;
|
|
129
|
+
newAutoCount: number;
|
|
130
|
+
}
|
|
131
|
+
export declare const THREAD_HIGHLIGHT_DELETION_REASON_REGENERATION_REPLACED: "regeneration_replaced";
|
|
132
|
+
export type ThreadHighlightDeletionReason = typeof THREAD_HIGHLIGHT_DELETION_REASON_REGENERATION_REPLACED;
|
|
133
|
+
export declare const THREAD_HIGHLIGHT_REGENERATION_NO_ELIGIBLE_TURNS: "THREAD_HIGHLIGHT_REGENERATION_NO_ELIGIBLE_TURNS";
|
|
134
|
+
export declare const THREAD_HIGHLIGHT_REGENERATION_INTERRUPTED: "THREAD_HIGHLIGHT_REGENERATION_INTERRUPTED";
|
|
135
|
+
export declare const THREAD_HIGHLIGHT_REGENERATION_DETECTION_FAILED: "THREAD_HIGHLIGHT_REGENERATION_DETECTION_FAILED";
|
|
136
|
+
export declare const THREAD_HIGHLIGHT_REGENERATION_COMMIT_FAILED: "THREAD_HIGHLIGHT_REGENERATION_COMMIT_FAILED";
|
|
137
|
+
export type ThreadHighlightRegenerationErrorCode = typeof THREAD_HIGHLIGHT_REGENERATION_NO_ELIGIBLE_TURNS | typeof THREAD_HIGHLIGHT_REGENERATION_INTERRUPTED | typeof THREAD_HIGHLIGHT_REGENERATION_DETECTION_FAILED | typeof THREAD_HIGHLIGHT_REGENERATION_COMMIT_FAILED | string;
|
|
138
|
+
export declare class ThreadHistoryConflictError extends RepositoryError {
|
|
139
|
+
readonly threadId: string;
|
|
140
|
+
readonly highlightId: string;
|
|
141
|
+
readonly expectedRevision: number;
|
|
142
|
+
readonly currentRevision: number;
|
|
143
|
+
constructor(threadId: string, highlightId: string, expectedRevision: number, currentRevision: number);
|
|
144
|
+
}
|
|
145
|
+
export declare class ThreadHighlightConflictError extends ThreadHistoryConflictError {
|
|
146
|
+
}
|
|
147
|
+
export declare class ThreadHighlightRegenerationConflictError extends RepositoryError {
|
|
148
|
+
readonly stableCode: "THREAD_HIGHLIGHT_REGENERATION_IN_PROGRESS";
|
|
149
|
+
readonly run: ThreadHighlightRun;
|
|
150
|
+
constructor(run: ThreadHighlightRun);
|
|
151
|
+
}
|
|
152
|
+
export declare class ThreadHistoryRepository extends BaseSqliteRepository {
|
|
153
|
+
private readonly dbPath?;
|
|
154
|
+
constructor(opts?: {
|
|
155
|
+
dbPath?: string;
|
|
156
|
+
dbRoot?: string;
|
|
157
|
+
});
|
|
158
|
+
resolveDbPath(): string;
|
|
159
|
+
private openHandle;
|
|
160
|
+
private findThread;
|
|
161
|
+
private findRegenerationRun;
|
|
162
|
+
resolveWorkspaceId(threadId: string): string | null;
|
|
163
|
+
getSnapshot(threadId: string, workspaceId?: string | null): ThreadSnapshot | null;
|
|
164
|
+
updateSnapshot(input: ThreadSnapshotMutationInput): ThreadSnapshot;
|
|
165
|
+
mutateSnapshot(input: ThreadSnapshotMutationInput): ThreadSnapshot;
|
|
166
|
+
updateThreadSnapshot(input: ThreadSnapshotMutationInput): ThreadSnapshot;
|
|
167
|
+
getLatestSeq(threadId: string, workspaceId?: string | null): number | null;
|
|
168
|
+
listCompletedThreadHighlightTurns(threadId: string, workspaceId: string): ThreadHighlightEligibleTurn[] | null;
|
|
169
|
+
createHighlightRegenerationRun(input: CreateThreadHighlightRegenerationRunInput): CreateThreadHighlightRegenerationRunResult;
|
|
170
|
+
beginHighlightRegenerationRun(input: CreateThreadHighlightRegenerationRunInput): CreateThreadHighlightRegenerationRunResult;
|
|
171
|
+
queueHighlightRegenerationRun(input: CreateThreadHighlightRegenerationRunInput): CreateThreadHighlightRegenerationRunResult;
|
|
172
|
+
getHighlightRegenerationRun(runId: string, workspaceId?: string): ThreadHighlightRun | null;
|
|
173
|
+
getHighlightRegenerationRunByRequest(threadId: string, workspaceId: string, requestId: string): ThreadHighlightRun | null;
|
|
174
|
+
findHighlightRegenerationRun(threadId: string, workspaceId: string, requestId: string): ThreadHighlightRun | null;
|
|
175
|
+
startHighlightRegenerationRun(runId: string, workspaceId?: string): ThreadHighlightRun;
|
|
176
|
+
startHighlightRegeneration(runId: string, workspaceId?: string): ThreadHighlightRun;
|
|
177
|
+
failHighlightRegenerationRun(input: FailThreadHighlightRegenerationRunInput): ThreadHighlightRun;
|
|
178
|
+
failHighlightRegeneration(input: FailThreadHighlightRegenerationRunInput): ThreadHighlightRun;
|
|
179
|
+
recoverInterruptedHighlightRegenerationRuns(errorCode?: string): number;
|
|
180
|
+
completeHighlightRegenerationRun(input: CompleteThreadHighlightRegenerationInput): CompleteThreadHighlightRegenerationResult;
|
|
181
|
+
completeHighlightRegeneration(input: CompleteThreadHighlightRegenerationInput): CompleteThreadHighlightRegenerationResult;
|
|
182
|
+
replaceAutoHighlightsAtomically(input: CompleteThreadHighlightRegenerationInput): CompleteThreadHighlightRegenerationResult;
|
|
183
|
+
listTimeline(query: ThreadTimelineQuery): ThreadTimeline | null;
|
|
184
|
+
listTimeline(threadId: string, workspaceId: string, options?: ThreadTimelineOptions): ThreadTimeline | null;
|
|
185
|
+
listEvents(threadId: string, workspaceId: string, options?: ThreadTimelineOptions): ThreadTimeline | null;
|
|
186
|
+
getTimeline(threadId: string, workspaceId: string, options?: ThreadTimelineOptions): ThreadTimeline | null;
|
|
187
|
+
createHighlight(input: CreateThreadHighlightInput): ThreadHighlight;
|
|
188
|
+
updateHighlight(input: UpdateThreadHighlightInput): ThreadHighlight;
|
|
189
|
+
dismissHighlight(input: DismissThreadHighlightInput): ThreadHighlight;
|
|
190
|
+
listActiveHighlights(threadId: string, workspaceId: string, options?: ListActiveHighlightsOptions): ThreadHighlight[] | null;
|
|
191
|
+
listHighlights(threadId: string, workspaceId: string, options?: ListActiveHighlightsOptions): ThreadHighlight[] | null;
|
|
192
|
+
getActiveHighlights(threadId: string, workspaceId: string, options?: ListActiveHighlightsOptions): ThreadHighlight[] | null;
|
|
193
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ThreadTitleCommonCodeMigrationOptions {
|
|
2
|
+
dbPath?: string;
|
|
3
|
+
dbRoot?: string;
|
|
4
|
+
configuredLabels?: readonly string[];
|
|
5
|
+
}
|
|
6
|
+
export interface ThreadTitleCommonCodeMigrationResult {
|
|
7
|
+
migratedRows: number;
|
|
8
|
+
createdCodes: number;
|
|
9
|
+
remainingCustomReferences: number;
|
|
10
|
+
orphanReferences: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function migrateLegacyThreadTitleCommonCodes(options?: ThreadTitleCommonCodeMigrationOptions): ThreadTitleCommonCodeMigrationResult;
|
|
13
|
+
export declare const migrateThreadTitleCommonCodes: typeof migrateLegacyThreadTitleCommonCodes;
|