@crewx/sdk 0.8.8-rc.4 → 0.8.8-rc.40

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.
@@ -41,7 +41,9 @@ export declare class ThreadRepository extends BaseSqliteRepository {
41
41
  saveUserMessage(threadId: string, text: string, opts?: {
42
42
  platform?: string;
43
43
  model?: string;
44
- }): void;
44
+ }): {
45
+ firstMessage: boolean;
46
+ };
45
47
  saveAssistantMessage(threadId: string, text: string, opts?: {
46
48
  platform?: string;
47
49
  model?: string;
@@ -0,0 +1,197 @@
1
+ export declare const chromexAuditLog: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2
+ name: "chromex_audit_log";
3
+ schema: undefined;
4
+ columns: {
5
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6
+ name: "id";
7
+ tableName: "chromex_audit_log";
8
+ dataType: "number";
9
+ columnType: "SQLiteInteger";
10
+ data: number;
11
+ driverParam: number;
12
+ notNull: true;
13
+ hasDefault: true;
14
+ isPrimaryKey: true;
15
+ isAutoincrement: false;
16
+ hasRuntimeDefault: false;
17
+ enumValues: undefined;
18
+ baseColumn: never;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }, {}, {}>;
22
+ timestamp: import("drizzle-orm/sqlite-core").SQLiteColumn<{
23
+ name: "timestamp";
24
+ tableName: "chromex_audit_log";
25
+ dataType: "string";
26
+ columnType: "SQLiteText";
27
+ data: string;
28
+ driverParam: string;
29
+ notNull: true;
30
+ hasDefault: true;
31
+ isPrimaryKey: false;
32
+ isAutoincrement: false;
33
+ hasRuntimeDefault: false;
34
+ enumValues: [string, ...string[]];
35
+ baseColumn: never;
36
+ identity: undefined;
37
+ generated: undefined;
38
+ }, {}, {
39
+ length: number | undefined;
40
+ }>;
41
+ agent_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
42
+ name: "agent_id";
43
+ tableName: "chromex_audit_log";
44
+ dataType: "string";
45
+ columnType: "SQLiteText";
46
+ data: string;
47
+ driverParam: string;
48
+ notNull: true;
49
+ hasDefault: false;
50
+ isPrimaryKey: false;
51
+ isAutoincrement: false;
52
+ hasRuntimeDefault: false;
53
+ enumValues: [string, ...string[]];
54
+ baseColumn: never;
55
+ identity: undefined;
56
+ generated: undefined;
57
+ }, {}, {
58
+ length: number | undefined;
59
+ }>;
60
+ action: import("drizzle-orm/sqlite-core").SQLiteColumn<{
61
+ name: "action";
62
+ tableName: "chromex_audit_log";
63
+ dataType: "string";
64
+ columnType: "SQLiteText";
65
+ data: string;
66
+ driverParam: string;
67
+ notNull: true;
68
+ hasDefault: false;
69
+ isPrimaryKey: false;
70
+ isAutoincrement: false;
71
+ hasRuntimeDefault: false;
72
+ enumValues: [string, ...string[]];
73
+ baseColumn: never;
74
+ identity: undefined;
75
+ generated: undefined;
76
+ }, {}, {
77
+ length: number | undefined;
78
+ }>;
79
+ jti: import("drizzle-orm/sqlite-core").SQLiteColumn<{
80
+ name: "jti";
81
+ tableName: "chromex_audit_log";
82
+ dataType: "string";
83
+ columnType: "SQLiteText";
84
+ data: string;
85
+ driverParam: string;
86
+ notNull: false;
87
+ hasDefault: false;
88
+ isPrimaryKey: false;
89
+ isAutoincrement: false;
90
+ hasRuntimeDefault: false;
91
+ enumValues: [string, ...string[]];
92
+ baseColumn: never;
93
+ identity: undefined;
94
+ generated: undefined;
95
+ }, {}, {
96
+ length: number | undefined;
97
+ }>;
98
+ scope: import("drizzle-orm/sqlite-core").SQLiteColumn<{
99
+ name: "scope";
100
+ tableName: "chromex_audit_log";
101
+ dataType: "string";
102
+ columnType: "SQLiteText";
103
+ data: string;
104
+ driverParam: string;
105
+ notNull: false;
106
+ hasDefault: false;
107
+ isPrimaryKey: false;
108
+ isAutoincrement: false;
109
+ hasRuntimeDefault: false;
110
+ enumValues: [string, ...string[]];
111
+ baseColumn: never;
112
+ identity: undefined;
113
+ generated: undefined;
114
+ }, {}, {
115
+ length: number | undefined;
116
+ }>;
117
+ tab_url: import("drizzle-orm/sqlite-core").SQLiteColumn<{
118
+ name: "tab_url";
119
+ tableName: "chromex_audit_log";
120
+ dataType: "string";
121
+ columnType: "SQLiteText";
122
+ data: string;
123
+ driverParam: string;
124
+ notNull: false;
125
+ hasDefault: false;
126
+ isPrimaryKey: false;
127
+ isAutoincrement: false;
128
+ hasRuntimeDefault: false;
129
+ enumValues: [string, ...string[]];
130
+ baseColumn: never;
131
+ identity: undefined;
132
+ generated: undefined;
133
+ }, {}, {
134
+ length: number | undefined;
135
+ }>;
136
+ tool_name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
137
+ name: "tool_name";
138
+ tableName: "chromex_audit_log";
139
+ dataType: "string";
140
+ columnType: "SQLiteText";
141
+ data: string;
142
+ driverParam: string;
143
+ notNull: false;
144
+ hasDefault: false;
145
+ isPrimaryKey: false;
146
+ isAutoincrement: false;
147
+ hasRuntimeDefault: false;
148
+ enumValues: [string, ...string[]];
149
+ baseColumn: never;
150
+ identity: undefined;
151
+ generated: undefined;
152
+ }, {}, {
153
+ length: number | undefined;
154
+ }>;
155
+ result: import("drizzle-orm/sqlite-core").SQLiteColumn<{
156
+ name: "result";
157
+ tableName: "chromex_audit_log";
158
+ dataType: "string";
159
+ columnType: "SQLiteText";
160
+ data: string;
161
+ driverParam: string;
162
+ notNull: false;
163
+ hasDefault: false;
164
+ isPrimaryKey: false;
165
+ isAutoincrement: false;
166
+ hasRuntimeDefault: false;
167
+ enumValues: [string, ...string[]];
168
+ baseColumn: never;
169
+ identity: undefined;
170
+ generated: undefined;
171
+ }, {}, {
172
+ length: number | undefined;
173
+ }>;
174
+ detail: import("drizzle-orm/sqlite-core").SQLiteColumn<{
175
+ name: "detail";
176
+ tableName: "chromex_audit_log";
177
+ dataType: "string";
178
+ columnType: "SQLiteText";
179
+ data: string;
180
+ driverParam: string;
181
+ notNull: false;
182
+ hasDefault: false;
183
+ isPrimaryKey: false;
184
+ isAutoincrement: false;
185
+ hasRuntimeDefault: false;
186
+ enumValues: [string, ...string[]];
187
+ baseColumn: never;
188
+ identity: undefined;
189
+ generated: undefined;
190
+ }, {}, {
191
+ length: number | undefined;
192
+ }>;
193
+ };
194
+ dialect: "sqlite";
195
+ }>;
196
+ export type ChromexAuditLog = typeof chromexAuditLog.$inferSelect;
197
+ export type NewChromexAuditLog = typeof chromexAuditLog.$inferInsert;
@@ -4,5 +4,8 @@ export interface FormatConversationBlockContext {
4
4
  messagesCount: number;
5
5
  agentIds: string[];
6
6
  primaryAgentId: string;
7
+ currentAgentId: string;
8
+ threadId: string;
9
+ now: string;
7
10
  }
8
- export declare function formatConversationHelper(this: any, messages: any, platform: any, options?: any): string;
11
+ export declare function formatConversationHelper(this: any, ...args: any[]): string;
@@ -0,0 +1,2 @@
1
+ export declare function toIsoWithOffset(date: Date): string;
2
+ export declare function formatRelativeTime(deltaMs: number): string;
@@ -1275,6 +1275,11 @@ export declare const CrewxProjectConfigSchema: z.ZodObject<{
1275
1275
  documents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1276
1276
  }, z.ZodUnknown, "strip">>;
1277
1277
  export type CrewxProjectConfig = z.infer<typeof CrewxProjectConfigSchema>;
1278
+ export interface TraceContext {
1279
+ parentTaskId: string | null;
1280
+ rootTraceId: string;
1281
+ callerAgentId: string | null;
1282
+ }
1278
1283
  export interface CrewxOptions {
1279
1284
  workspaceRoot?: string;
1280
1285
  platform?: Platform;
@@ -1296,10 +1301,12 @@ export interface QueryOptions {
1296
1301
  context?: string;
1297
1302
  metadata?: Record<string, unknown>;
1298
1303
  threadId?: string;
1304
+ taskId?: string;
1299
1305
  platform?: Platform;
1300
1306
  messages?: import('../conversation/types').TemplateMessage[];
1301
1307
  vars?: Record<string, unknown>;
1302
1308
  cwd?: string;
1309
+ trace?: TraceContext;
1303
1310
  }
1304
1311
  export interface QueryResult {
1305
1312
  ok: boolean;
@@ -1330,10 +1337,12 @@ export interface ExecuteOptions {
1330
1337
  context?: string;
1331
1338
  metadata?: Record<string, unknown>;
1332
1339
  threadId?: string;
1340
+ taskId?: string;
1333
1341
  platform?: Platform;
1334
1342
  messages?: import('../conversation/types').TemplateMessage[];
1335
1343
  vars?: Record<string, unknown>;
1336
1344
  cwd?: string;
1345
+ trace?: TraceContext;
1337
1346
  }
1338
1347
  export interface ExecuteResult {
1339
1348
  ok: boolean;
@@ -1347,5 +1356,6 @@ export interface ExecuteResult {
1347
1356
  provider: string;
1348
1357
  model?: string;
1349
1358
  durationMs: number;
1359
+ taskId?: string;
1350
1360
  };
1351
1361
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/sdk",
3
- "version": "0.8.8-rc.4",
3
+ "version": "0.8.8-rc.40",
4
4
  "license": "UNLICENSED",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"
@@ -83,7 +83,7 @@
83
83
  "@ai-sdk/anthropic": "1.0.8",
84
84
  "@ai-sdk/google": "1.0.10",
85
85
  "@ai-sdk/openai": "1.0.11",
86
- "better-sqlite3": "12.0.0"
86
+ "better-sqlite3": ">=12.0.0"
87
87
  },
88
88
  "peerDependenciesMeta": {
89
89
  "@agentclientprotocol/claude-agent-acp": {
@@ -83,16 +83,22 @@ layouts:
83
83
 
84
84
  {{#if agent.optionsByMode.query}}
85
85
  <cli_options mode="query">
86
- {{#each agent.optionsByMode.query}}
87
- <item>{{#if @key}}provider="{{@key}}" {{/if}}{{{this}}}</item>
86
+ {{#each agent.optionsByMode.query.named}}
87
+ <item>provider="{{@key}}" {{{this}}}</item>
88
+ {{/each}}
89
+ {{#each agent.optionsByMode.query.rawArgs}}
90
+ <item>{{{this}}}</item>
88
91
  {{/each}}
89
92
  </cli_options>
90
93
  {{/if}}
91
94
 
92
95
  {{#if agent.optionsByMode.execute}}
93
96
  <cli_options mode="execute">
94
- {{#each agent.optionsByMode.execute}}
95
- <item>{{#if @key}}provider="{{@key}}" {{/if}}{{{this}}}</item>
97
+ {{#each agent.optionsByMode.execute.named}}
98
+ <item>provider="{{@key}}" {{{this}}}</item>
99
+ {{/each}}
100
+ {{#each agent.optionsByMode.execute.rawArgs}}
101
+ <item>{{{this}}}</item>
96
102
  {{/each}}
97
103
  </cli_options>
98
104
  {{/if}}
@@ -298,8 +304,15 @@ layouts:
298
304
 
299
305
  {{#if props.showConversationHistory}}
300
306
  {{#if messages.length}}
307
+ {{#if thread_id}}
308
+ <conversation_context thread_id="{{thread_id}}" agent_id="{{agent.id}}" now="{{now}}">
309
+ To review your previous work in this conversation:
310
+ crewx dreaming --thread={{thread_id}} --agent={{agent.id}} --continue
311
+ </conversation_context>
312
+
313
+ {{/if}}
301
314
  <conversation_history platform="{{platform}}">
302
- {{#formatConversation messages platform}}
315
+ {{#formatConversation messages platform agent.id thread_id}}
303
316
  {{#if primaryAgentId}}
304
317
  Primary agent: @{{primaryAgentId}}
305
318
  {{/if}}
@@ -313,15 +326,17 @@ layouts:
313
326
  {{/if}}
314
327
  {{#each messages}}
315
328
  {{#if isAssistant}}
316
- **{{#if metadata.slack}}{{#with metadata.slack}}{{#if bot_username}}{{bot_username}}{{else}}Assistant{{/if}}{{#if bot_user_id}} (<@{{bot_user_id}}>){{/if}}{{/with}}{{else}}Assistant{{/if}}{{#if metadata.agent_id}} (@{{metadata.agent_id}}){{/if}}**
329
+ <message role="assistant"{{#if metadata.agent_id}} agent="{{metadata.agent_id}}"{{/if}}{{#if ../currentAgentId}}{{#if (eq metadata.agent_id ../currentAgentId)}}{{#if metadata.task_id}} task_id="{{metadata.task_id}}"{{/if}}{{/if}}{{/if}}{{#if created_at}} created_at="{{created_at}}"{{/if}}{{#if relative_time}} relative_time="{{relative_time}}"{{/if}}{{#if metadata.slack}}{{#with metadata.slack}}{{#if bot_username}} name="{{bot_username}}"{{/if}}{{#if bot_user_id}} slack_user="{{bot_user_id}}"{{/if}}{{/with}}{{/if}}>
317
330
  {{else}}
318
- **{{#if metadata.slack}}{{#with metadata.slack}}{{#if user_profile.display_name}}{{user_profile.display_name}}{{else if username}}{{username}}{{else if user_id}}User{{/if}}{{#if user_id}} (<@{{user_id}}>){{/if}}{{/with}}{{else}}User{{/if}}**
319
- {{/if}}: {{{escapeHandlebars text}}}
331
+ <message role="user"{{#if created_at}} created_at="{{created_at}}"{{/if}}{{#if relative_time}} relative_time="{{relative_time}}"{{/if}}{{#if metadata.slack}}{{#with metadata.slack}}{{#if user_profile.display_name}} name="{{user_profile.display_name}}"{{else if username}} name="{{username}}"{{/if}}{{#if user_id}} slack_user="{{user_id}}"{{/if}}{{/with}}{{/if}}>
332
+ {{/if}}
333
+ {{{escapeHandlebars text}}}
320
334
  {{#if files}}
321
335
  {{#each files}}
322
336
  📎 {{name}}{{#if size}} ({{formatFileSize size}}){{/if}}{{#if localPath}} - Local: {{localPath}}{{/if}}
323
337
  {{/each}}
324
338
  {{/if}}
339
+ </message>
325
340
  {{/each}}
326
341
  {{/formatConversation}}
327
342