@crewx/sdk 0.9.0-rc.74 → 0.9.0-rc.76
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/dist/context-budget/continuity.d.ts +53 -0
- package/dist/context-budget/index.d.ts +35 -1
- package/dist/conversation/sqlite-provider.d.ts +4 -1
- package/dist/conversation/types.d.ts +28 -0
- package/dist/esm/index.js +169 -161
- package/dist/esm/plugins/index.js +124 -121
- package/dist/esm/repository/index.js +122 -119
- package/dist/facade/Crewx.d.ts +6 -2
- package/dist/highlight/thread-highlighter.d.ts +155 -0
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.js +4 -4
- package/dist/index.d.ts +13 -2
- package/dist/index.js +170 -162
- package/dist/layout/types.d.ts +15 -1
- package/dist/migrations/0020_useful_iron_lad.sql +55 -0
- package/dist/migrations/meta/0020_snapshot.json +2895 -0
- package/dist/migrations/meta/_journal.json +8 -1
- package/dist/plugins/index.js +124 -121
- package/dist/plugins/sqlite-tracing.d.ts +22 -0
- package/dist/repository/index.d.ts +4 -0
- package/dist/repository/index.js +122 -119
- package/dist/repository/request-log.repository.d.ts +1 -0
- package/dist/repository/thread-history.repository.d.ts +117 -0
- package/dist/repository/thread-title.types.d.ts +29 -0
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/thread-history.d.ts +518 -0
- package/dist/types/index.d.ts +1092 -0
- package/dist/utils/id.d.ts +1 -1
- package/package.json +1 -1
- package/templates/agents/default.yaml +33 -0
package/dist/layout/types.d.ts
CHANGED
|
@@ -25,6 +25,13 @@ export interface LayoutDefinition {
|
|
|
25
25
|
template: string;
|
|
26
26
|
propsSchema: Record<string, PropSchema>;
|
|
27
27
|
defaultProps: Record<string, any>;
|
|
28
|
+
capabilities?: LayoutCapabilities;
|
|
29
|
+
}
|
|
30
|
+
export interface LayoutCapabilities {
|
|
31
|
+
semanticContinuity?: boolean;
|
|
32
|
+
continuity?: boolean;
|
|
33
|
+
continuitySlot?: string;
|
|
34
|
+
slot?: string;
|
|
28
35
|
}
|
|
29
36
|
export interface CustomLayoutDefinition {
|
|
30
37
|
template: string;
|
|
@@ -32,10 +39,15 @@ export interface CustomLayoutDefinition {
|
|
|
32
39
|
version?: string;
|
|
33
40
|
propsSchema?: Record<string, any>;
|
|
34
41
|
defaultProps?: Record<string, any>;
|
|
42
|
+
capabilities?: LayoutCapabilities;
|
|
35
43
|
}
|
|
36
44
|
export type InlineLayoutSpec = string | {
|
|
37
45
|
id: string;
|
|
38
46
|
props?: Record<string, any>;
|
|
47
|
+
capabilities?: LayoutCapabilities;
|
|
48
|
+
} | {
|
|
49
|
+
template: string;
|
|
50
|
+
capabilities?: LayoutCapabilities;
|
|
39
51
|
};
|
|
40
52
|
export interface ValidationResult {
|
|
41
53
|
valid: boolean;
|
|
@@ -97,6 +109,7 @@ export interface RenderContext {
|
|
|
97
109
|
[key: string]: any;
|
|
98
110
|
};
|
|
99
111
|
context?: Record<string, any>;
|
|
112
|
+
semanticContinuity?: import('../conversation/types.js').SemanticContinuityContext;
|
|
100
113
|
contextOptions?: {
|
|
101
114
|
goals: boolean | string | string[];
|
|
102
115
|
daily: boolean;
|
|
@@ -109,7 +122,8 @@ export interface RawLayoutYaml {
|
|
|
109
122
|
description?: string;
|
|
110
123
|
propsSchema?: Record<string, any>;
|
|
111
124
|
template?: string;
|
|
112
|
-
layouts?: Record<string,
|
|
125
|
+
layouts?: Record<string, any>;
|
|
126
|
+
capabilities?: LayoutCapabilities;
|
|
113
127
|
}
|
|
114
128
|
export declare class LayoutLoadError extends Error {
|
|
115
129
|
readonly layoutId?: string | undefined;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS `thread_events` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`thread_id` text NOT NULL,
|
|
4
|
+
`seq` integer NOT NULL,
|
|
5
|
+
`type` text NOT NULL,
|
|
6
|
+
`actor_type` text NOT NULL,
|
|
7
|
+
`payload_json` text NOT NULL,
|
|
8
|
+
`created_at` text NOT NULL,
|
|
9
|
+
`actor_id` text,
|
|
10
|
+
`task_id` text,
|
|
11
|
+
`highlight_id` text,
|
|
12
|
+
FOREIGN KEY (`thread_id`) REFERENCES `threads`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
13
|
+
CONSTRAINT "thread_events_type_ck" CHECK("thread_events"."type" IN ('thread.snapshot.imported', 'thread.title.changed', 'thread.priority.changed', 'thread.state.changed', 'thread.highlight.created', 'thread.highlight.updated', 'thread.highlight.deleted')),
|
|
14
|
+
CONSTRAINT "thread_events_actor_type_ck" CHECK("thread_events"."actor_type" IN ('user', 'agent', 'system')),
|
|
15
|
+
CONSTRAINT "thread_events_payload_json_ck" CHECK(json_valid("thread_events"."payload_json") AND json_type("thread_events"."payload_json") = 'object')
|
|
16
|
+
);
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
CREATE INDEX IF NOT EXISTS `idx_thread_events_thread_seq` ON `thread_events` (`thread_id`,`seq`);--> statement-breakpoint
|
|
19
|
+
CREATE INDEX IF NOT EXISTS `idx_thread_events_thread_created` ON `thread_events` (`thread_id`,`created_at`);--> statement-breakpoint
|
|
20
|
+
CREATE UNIQUE INDEX IF NOT EXISTS `thread_events_thread_seq_uq` ON `thread_events` (`thread_id`,`seq`);--> statement-breakpoint
|
|
21
|
+
CREATE TABLE IF NOT EXISTS `thread_highlights` (
|
|
22
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
23
|
+
`thread_id` text NOT NULL,
|
|
24
|
+
`source` text NOT NULL,
|
|
25
|
+
`kind` text NOT NULL,
|
|
26
|
+
`status` text DEFAULT 'active' NOT NULL,
|
|
27
|
+
`text` text,
|
|
28
|
+
`covers_from_task_id` text NOT NULL,
|
|
29
|
+
`covers_to_task_id` text NOT NULL,
|
|
30
|
+
`revision` integer DEFAULT 0 NOT NULL,
|
|
31
|
+
`created_at` text NOT NULL,
|
|
32
|
+
`updated_at` text NOT NULL,
|
|
33
|
+
`agent_id` text,
|
|
34
|
+
`source_task_id` text,
|
|
35
|
+
`detector_version` text,
|
|
36
|
+
`content_fingerprint` text,
|
|
37
|
+
`dismissed_at` text,
|
|
38
|
+
FOREIGN KEY (`thread_id`) REFERENCES `threads`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
39
|
+
CONSTRAINT "thread_highlights_source_ck" CHECK("thread_highlights"."source" IN ('auto', 'manual')),
|
|
40
|
+
CONSTRAINT "thread_highlights_kind_ck" CHECK("thread_highlights"."kind" IN ('decision', 'judgment', 'issue', 'result', 'pivot')),
|
|
41
|
+
CONSTRAINT "thread_highlights_status_ck" CHECK("thread_highlights"."status" IN ('active', 'dismissed')),
|
|
42
|
+
CONSTRAINT "thread_highlights_active_text_ck" CHECK("thread_highlights"."status" = 'dismissed' OR ("thread_highlights"."text" IS NOT NULL AND length("thread_highlights"."text") > 0)),
|
|
43
|
+
CONSTRAINT "thread_highlights_covers_ck" CHECK(length("thread_highlights"."covers_from_task_id") > 0 AND length("thread_highlights"."covers_to_task_id") > 0),
|
|
44
|
+
CONSTRAINT "thread_highlights_auto_key_ck" CHECK("thread_highlights"."source" = 'manual' OR ("thread_highlights"."source" = 'auto' AND "thread_highlights"."source_task_id" IS NOT NULL AND "thread_highlights"."detector_version" IS NOT NULL AND "thread_highlights"."content_fingerprint" IS NOT NULL AND length("thread_highlights"."source_task_id") > 0 AND length("thread_highlights"."detector_version") > 0 AND length("thread_highlights"."content_fingerprint") > 0))
|
|
45
|
+
);
|
|
46
|
+
--> statement-breakpoint
|
|
47
|
+
CREATE INDEX IF NOT EXISTS `idx_thread_highlights_thread_status_created` ON `thread_highlights` (`thread_id`,`status`,`created_at`);--> statement-breakpoint
|
|
48
|
+
CREATE INDEX IF NOT EXISTS `idx_thread_highlights_thread_covers` ON `thread_highlights` (`thread_id`,`covers_from_task_id`,`covers_to_task_id`);--> statement-breakpoint
|
|
49
|
+
CREATE UNIQUE INDEX IF NOT EXISTS `thread_highlights_auto_idempotency_uq` ON `thread_highlights` (`thread_id`,`source_task_id`,`detector_version`,`content_fingerprint`) WHERE "thread_highlights"."source" = 'auto';
|
|
50
|
+
--> statement-breakpoint
|
|
51
|
+
CREATE TRIGGER IF NOT EXISTS thread_events_no_update
|
|
52
|
+
BEFORE UPDATE ON thread_events
|
|
53
|
+
BEGIN
|
|
54
|
+
SELECT RAISE(ABORT, 'thread_events is append-only');
|
|
55
|
+
END;
|