@askexenow/exe-os 0.8.58 → 0.8.59

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/bin/cli.js CHANGED
@@ -13238,6 +13238,21 @@ var init_session_kill_telemetry = __esm({
13238
13238
  });
13239
13239
 
13240
13240
  // src/lib/tasks-crud.ts
13241
+ var tasks_crud_exports = {};
13242
+ __export(tasks_crud_exports, {
13243
+ TASK_ALREADY_CLAIMED_PREFIX: () => TASK_ALREADY_CLAIMED_PREFIX,
13244
+ checkStaleCompletion: () => checkStaleCompletion,
13245
+ createTaskCore: () => createTaskCore,
13246
+ deleteTaskCore: () => deleteTaskCore,
13247
+ ensureArchitectureDoc: () => ensureArchitectureDoc,
13248
+ ensureGitignoreExe: () => ensureGitignoreExe,
13249
+ extractParentFromContext: () => extractParentFromContext,
13250
+ listTasks: () => listTasks,
13251
+ resolveTask: () => resolveTask,
13252
+ slugify: () => slugify,
13253
+ updateTaskStatus: () => updateTaskStatus,
13254
+ writeCheckpoint: () => writeCheckpoint
13255
+ });
13241
13256
  import crypto6 from "crypto";
13242
13257
  import path19 from "path";
13243
13258
  import { execSync as execSync8 } from "child_process";
@@ -13854,7 +13869,6 @@ var init_tasks_review = __esm({
13854
13869
  init_config();
13855
13870
  init_employees();
13856
13871
  init_notifications();
13857
- init_tasks_crud();
13858
13872
  init_tmux_routing();
13859
13873
  init_session_key();
13860
13874
  init_state_bus();
@@ -19515,6 +19529,7 @@ var init_orchestrator = __esm({
19515
19529
  init_task_router();
19516
19530
  init_tmux_routing();
19517
19531
  init_task_scope();
19532
+ init_tasks_crud();
19518
19533
  STALE_THRESHOLD_MS = 2 * 60 * 60 * 1e3;
19519
19534
  MultiAgentOrchestrator = class {
19520
19535
  config;
@@ -19551,6 +19566,26 @@ ${task.context}`,
19551
19566
  targetEmployee = routed.employee;
19552
19567
  routingScore = routed.score;
19553
19568
  }
19569
+ try {
19570
+ await createTaskCore({
19571
+ title: task.title,
19572
+ assignedTo: targetEmployee.name,
19573
+ assignedBy: "exe",
19574
+ projectName: task.projectName,
19575
+ priority: task.priority,
19576
+ context: task.context,
19577
+ baseDir: this.config.projectDir,
19578
+ skipDispatch: true
19579
+ });
19580
+ } catch (err) {
19581
+ return {
19582
+ employee: targetEmployee.name,
19583
+ sessionName: "",
19584
+ status: "failed",
19585
+ routingScore,
19586
+ error: `Task creation failed: ${err instanceof Error ? err.message : String(err)}`
19587
+ };
19588
+ }
19554
19589
  const result = ensureEmployee(
19555
19590
  targetEmployee.name,
19556
19591
  this.config.exeSession,
@@ -19838,7 +19873,17 @@ function useOrchestrator(enabled = true) {
19838
19873
  const spawnSession = useCallback5(
19839
19874
  async (agentId) => {
19840
19875
  try {
19876
+ const { createTaskCore: createTaskCore2 } = await Promise.resolve().then(() => (init_tasks_crud(), tasks_crud_exports));
19841
19877
  const { ensureEmployee: ensureEmployee2 } = await Promise.resolve().then(() => (init_tmux_routing(), tmux_routing_exports));
19878
+ await createTaskCore2({
19879
+ title: `Session launched for ${agentId} (TUI)`,
19880
+ assignedTo: agentId,
19881
+ assignedBy: "exe",
19882
+ projectName: "exe-os",
19883
+ priority: "p2",
19884
+ context: "Session spawned from TUI Sessions view. Agent will pick up any queued tasks via intercom.",
19885
+ skipDispatch: true
19886
+ });
19842
19887
  return ensureEmployee2(agentId, exeSessionRef.current, process.cwd());
19843
19888
  } catch {
19844
19889
  return null;
@@ -3642,7 +3642,6 @@ var init_tasks_review = __esm({
3642
3642
  init_config();
3643
3643
  init_employees();
3644
3644
  init_notifications();
3645
- init_tasks_crud();
3646
3645
  init_tmux_routing();
3647
3646
  init_session_key();
3648
3647
  init_state_bus();
@@ -5716,6 +5715,9 @@ import { readFileSync as readFileSync12, writeFileSync as writeFileSync8, exists
5716
5715
  import crypto8 from "crypto";
5717
5716
  import path19 from "path";
5718
5717
  import { homedir } from "os";
5718
+ function sqlSafe(v) {
5719
+ return v === void 0 ? null : v;
5720
+ }
5719
5721
  function logError(msg) {
5720
5722
  try {
5721
5723
  const logPath = path19.join(homedir(), ".exe-os", "workers.log");
@@ -5886,18 +5888,18 @@ async function cloudSync(config) {
5886
5888
  author_device_id, scope)
5887
5889
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
5888
5890
  args: [
5889
- rec.id ?? null,
5890
- rec.agent_id ?? null,
5891
- rec.agent_role ?? null,
5892
- rec.session_id ?? null,
5893
- rec.timestamp ?? null,
5894
- rec.tool_name ?? null,
5895
- rec.project_name ?? null,
5896
- rec.has_error ?? 0,
5897
- rec.raw_text ?? "",
5898
- rec.version ?? 0,
5899
- rec.author_device_id ?? null,
5900
- rec.scope ?? "business"
5891
+ sqlSafe(rec.id),
5892
+ sqlSafe(rec.agent_id),
5893
+ sqlSafe(rec.agent_role),
5894
+ sqlSafe(rec.session_id),
5895
+ sqlSafe(rec.timestamp),
5896
+ sqlSafe(rec.tool_name),
5897
+ sqlSafe(rec.project_name),
5898
+ sqlSafe(rec.has_error ?? 0),
5899
+ sqlSafe(rec.raw_text ?? ""),
5900
+ sqlSafe(rec.version ?? 0),
5901
+ sqlSafe(rec.author_device_id),
5902
+ sqlSafe(rec.scope ?? "business")
5901
5903
  ]
5902
5904
  }));
5903
5905
  await client.batch(stmts, "write");
@@ -6318,14 +6320,14 @@ async function cloudPullGlobalProcedures(config) {
6318
6320
  updated_at = excluded.updated_at
6319
6321
  WHERE excluded.updated_at > global_procedures.updated_at`,
6320
6322
  args: [
6321
- p.id ?? null,
6322
- p.title ?? null,
6323
- p.content ?? null,
6324
- p.priority ?? "p0",
6325
- p.domain ?? null,
6326
- p.active ?? 1,
6327
- p.created_at ?? null,
6328
- p.updated_at ?? null
6323
+ sqlSafe(p.id),
6324
+ sqlSafe(p.title),
6325
+ sqlSafe(p.content),
6326
+ sqlSafe(p.priority ?? "p0"),
6327
+ sqlSafe(p.domain),
6328
+ sqlSafe(p.active ?? 1),
6329
+ sqlSafe(p.created_at),
6330
+ sqlSafe(p.updated_at)
6329
6331
  ]
6330
6332
  }));
6331
6333
  await client.batch(stmts, "write");
@@ -6355,7 +6357,7 @@ async function cloudPullBehaviors(config) {
6355
6357
  const existing = await client.execute({
6356
6358
  sql: `SELECT COUNT(*) as cnt FROM behaviors
6357
6359
  WHERE agent_id = ? AND content = ?`,
6358
- args: [behavior.agent_id ?? null, behavior.content ?? null]
6360
+ args: [sqlSafe(behavior.agent_id), sqlSafe(behavior.content)]
6359
6361
  });
6360
6362
  if (Number(existing.rows[0]?.cnt) > 0) continue;
6361
6363
  await client.execute({
@@ -6363,15 +6365,15 @@ async function cloudPullBehaviors(config) {
6363
6365
  (id, agent_id, project_name, domain, content, active, priority, created_at, updated_at)
6364
6366
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
6365
6367
  args: [
6366
- behavior.id ?? null,
6367
- behavior.agent_id ?? null,
6368
- behavior.project_name ?? null,
6369
- behavior.domain ?? null,
6370
- behavior.content ?? null,
6371
- behavior.active ?? 1,
6372
- behavior.priority ?? "p1",
6373
- behavior.created_at ?? null,
6374
- behavior.updated_at ?? null
6368
+ sqlSafe(behavior.id),
6369
+ sqlSafe(behavior.agent_id),
6370
+ sqlSafe(behavior.project_name),
6371
+ sqlSafe(behavior.domain),
6372
+ sqlSafe(behavior.content),
6373
+ sqlSafe(behavior.active ?? 1),
6374
+ sqlSafe(behavior.priority ?? "p1"),
6375
+ sqlSafe(behavior.created_at),
6376
+ sqlSafe(behavior.updated_at)
6375
6377
  ]
6376
6378
  });
6377
6379
  pulled++;
@@ -6419,7 +6421,7 @@ async function cloudPullGraphRAG(config) {
6419
6421
  const stmts = blob.entities.map((e) => ({
6420
6422
  sql: `INSERT OR IGNORE INTO entities (id, name, type, first_seen, last_seen, properties)
6421
6423
  VALUES (?, ?, ?, ?, ?, ?)`,
6422
- args: [e.id, e.name, e.type, e.first_seen, e.last_seen, e.properties ?? "{}"]
6424
+ args: [sqlSafe(e.id), sqlSafe(e.name), sqlSafe(e.type), sqlSafe(e.first_seen), sqlSafe(e.last_seen), sqlSafe(e.properties ?? "{}")]
6423
6425
  }));
6424
6426
  await client.batch(stmts, "write");
6425
6427
  pulled += stmts.length;
@@ -6430,15 +6432,15 @@ async function cloudPullGraphRAG(config) {
6430
6432
  (id, source_entity_id, target_entity_id, type, weight, timestamp, properties, confidence, confidence_label)
6431
6433
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
6432
6434
  args: [
6433
- r.id,
6434
- r.source_entity_id,
6435
- r.target_entity_id,
6436
- r.type,
6437
- r.weight ?? 1,
6438
- r.timestamp,
6439
- r.properties ?? "{}",
6440
- r.confidence ?? 1,
6441
- r.confidence_label ?? "extracted"
6435
+ sqlSafe(r.id),
6436
+ sqlSafe(r.source_entity_id),
6437
+ sqlSafe(r.target_entity_id),
6438
+ sqlSafe(r.type),
6439
+ sqlSafe(r.weight ?? 1),
6440
+ sqlSafe(r.timestamp),
6441
+ sqlSafe(r.properties ?? "{}"),
6442
+ sqlSafe(r.confidence ?? 1),
6443
+ sqlSafe(r.confidence_label ?? "extracted")
6442
6444
  ]
6443
6445
  }));
6444
6446
  await client.batch(stmts, "write");
@@ -6447,7 +6449,7 @@ async function cloudPullGraphRAG(config) {
6447
6449
  if (blob.entity_aliases.length > 0) {
6448
6450
  const stmts = blob.entity_aliases.map((a) => ({
6449
6451
  sql: `INSERT OR IGNORE INTO entity_aliases (alias, canonical_entity_id) VALUES (?, ?)`,
6450
- args: [a.alias, a.canonical_entity_id]
6452
+ args: [sqlSafe(a.alias), sqlSafe(a.canonical_entity_id)]
6451
6453
  }));
6452
6454
  await client.batch(stmts, "write");
6453
6455
  pulled += stmts.length;
@@ -6455,7 +6457,7 @@ async function cloudPullGraphRAG(config) {
6455
6457
  if (blob.entity_memories.length > 0) {
6456
6458
  const stmts = blob.entity_memories.map((em) => ({
6457
6459
  sql: `INSERT OR IGNORE INTO entity_memories (entity_id, memory_id) VALUES (?, ?)`,
6458
- args: [em.entity_id, em.memory_id]
6460
+ args: [sqlSafe(em.entity_id), sqlSafe(em.memory_id)]
6459
6461
  }));
6460
6462
  await client.batch(stmts, "write");
6461
6463
  pulled += stmts.length;
@@ -6463,7 +6465,7 @@ async function cloudPullGraphRAG(config) {
6463
6465
  if (blob.relationship_memories.length > 0) {
6464
6466
  const stmts = blob.relationship_memories.map((rm) => ({
6465
6467
  sql: `INSERT OR IGNORE INTO relationship_memories (relationship_id, memory_id) VALUES (?, ?)`,
6466
- args: [rm.relationship_id, rm.memory_id]
6468
+ args: [sqlSafe(rm.relationship_id), sqlSafe(rm.memory_id)]
6467
6469
  }));
6468
6470
  await client.batch(stmts, "write");
6469
6471
  pulled += stmts.length;
@@ -6472,7 +6474,7 @@ async function cloudPullGraphRAG(config) {
6472
6474
  const stmts = blob.hyperedges.map((h) => ({
6473
6475
  sql: `INSERT OR IGNORE INTO hyperedges (id, label, relation, confidence, timestamp)
6474
6476
  VALUES (?, ?, ?, ?, ?)`,
6475
- args: [h.id, h.label, h.relation, h.confidence ?? 1, h.timestamp]
6477
+ args: [sqlSafe(h.id), sqlSafe(h.label), sqlSafe(h.relation), sqlSafe(h.confidence ?? 1), sqlSafe(h.timestamp)]
6476
6478
  }));
6477
6479
  await client.batch(stmts, "write");
6478
6480
  pulled += stmts.length;
@@ -6480,7 +6482,7 @@ async function cloudPullGraphRAG(config) {
6480
6482
  if (blob.hyperedge_nodes.length > 0) {
6481
6483
  const stmts = blob.hyperedge_nodes.map((hn) => ({
6482
6484
  sql: `INSERT OR IGNORE INTO hyperedge_nodes (hyperedge_id, entity_id) VALUES (?, ?)`,
6483
- args: [hn.hyperedge_id, hn.entity_id]
6485
+ args: [sqlSafe(hn.hyperedge_id), sqlSafe(hn.entity_id)]
6484
6486
  }));
6485
6487
  await client.batch(stmts, "write");
6486
6488
  pulled += stmts.length;
@@ -6512,22 +6514,22 @@ async function cloudPullTasks(config) {
6512
6514
  blocked_by, parent_task_id, budget_tokens, budget_fallback_model, tokens_used, tokens_warned_at)
6513
6515
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
6514
6516
  args: [
6515
- t.id ?? null,
6516
- t.title ?? null,
6517
- t.assigned_to ?? null,
6518
- t.assigned_by ?? null,
6519
- t.project_name ?? null,
6520
- t.priority ?? "p1",
6521
- t.status ?? "open",
6522
- t.task_file ?? null,
6523
- t.created_at ?? null,
6524
- t.updated_at ?? null,
6525
- t.blocked_by ?? null,
6526
- t.parent_task_id ?? null,
6527
- t.budget_tokens ?? null,
6528
- t.budget_fallback_model ?? null,
6529
- t.tokens_used ?? 0,
6530
- t.tokens_warned_at ?? null
6517
+ sqlSafe(t.id),
6518
+ sqlSafe(t.title),
6519
+ sqlSafe(t.assigned_to),
6520
+ sqlSafe(t.assigned_by),
6521
+ sqlSafe(t.project_name),
6522
+ sqlSafe(t.priority ?? "p1"),
6523
+ sqlSafe(t.status ?? "open"),
6524
+ sqlSafe(t.task_file),
6525
+ sqlSafe(t.created_at),
6526
+ sqlSafe(t.updated_at),
6527
+ sqlSafe(t.blocked_by),
6528
+ sqlSafe(t.parent_task_id),
6529
+ sqlSafe(t.budget_tokens),
6530
+ sqlSafe(t.budget_fallback_model),
6531
+ sqlSafe(t.tokens_used ?? 0),
6532
+ sqlSafe(t.tokens_warned_at)
6531
6533
  ]
6532
6534
  }));
6533
6535
  await client.batch(stmts, "write");
@@ -6559,24 +6561,24 @@ async function cloudPullConversations(config) {
6559
6561
  content_metadata, agent_response, agent_name, timestamp, ingested_at)
6560
6562
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
6561
6563
  args: [
6562
- c.id ?? null,
6563
- c.platform ?? null,
6564
- c.external_id ?? null,
6565
- c.sender_id ?? null,
6566
- c.sender_name ?? null,
6567
- c.sender_phone ?? null,
6568
- c.sender_email ?? null,
6569
- c.recipient_id ?? null,
6570
- c.channel_id ?? null,
6571
- c.thread_id ?? null,
6572
- c.reply_to_id ?? null,
6573
- c.content_text ?? null,
6574
- c.content_media ?? null,
6575
- c.content_metadata ?? null,
6576
- c.agent_response ?? null,
6577
- c.agent_name ?? null,
6578
- c.timestamp ?? null,
6579
- c.ingested_at ?? null
6564
+ sqlSafe(c.id),
6565
+ sqlSafe(c.platform),
6566
+ sqlSafe(c.external_id),
6567
+ sqlSafe(c.sender_id),
6568
+ sqlSafe(c.sender_name),
6569
+ sqlSafe(c.sender_phone),
6570
+ sqlSafe(c.sender_email),
6571
+ sqlSafe(c.recipient_id),
6572
+ sqlSafe(c.channel_id),
6573
+ sqlSafe(c.thread_id),
6574
+ sqlSafe(c.reply_to_id),
6575
+ sqlSafe(c.content_text),
6576
+ sqlSafe(c.content_media),
6577
+ sqlSafe(c.content_metadata),
6578
+ sqlSafe(c.agent_response),
6579
+ sqlSafe(c.agent_name),
6580
+ sqlSafe(c.timestamp),
6581
+ sqlSafe(c.ingested_at)
6580
6582
  ]
6581
6583
  }));
6582
6584
  await client.batch(stmts, "write");
@@ -6613,7 +6615,7 @@ async function cloudPullDocuments(config) {
6613
6615
  const stmts = blob.workspaces.map((w) => ({
6614
6616
  sql: `INSERT OR IGNORE INTO workspaces (id, slug, name, owner_agent_id, created_at, metadata)
6615
6617
  VALUES (?, ?, ?, ?, ?, ?)`,
6616
- args: [w.id, w.slug, w.name, w.owner_agent_id ?? null, w.created_at, w.metadata ?? null]
6618
+ args: [sqlSafe(w.id), sqlSafe(w.slug), sqlSafe(w.name), sqlSafe(w.owner_agent_id), sqlSafe(w.created_at), sqlSafe(w.metadata)]
6617
6619
  }));
6618
6620
  await client.batch(stmts, "write");
6619
6621
  pulled += stmts.length;
@@ -6624,14 +6626,14 @@ async function cloudPullDocuments(config) {
6624
6626
  (id, workspace_id, filename, mime, source_type, user_id, uploaded_at, metadata)
6625
6627
  VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
6626
6628
  args: [
6627
- d.id,
6628
- d.workspace_id,
6629
- d.filename,
6630
- d.mime ?? null,
6631
- d.source_type ?? null,
6632
- d.user_id ?? null,
6633
- d.uploaded_at,
6634
- d.metadata ?? null
6629
+ sqlSafe(d.id),
6630
+ sqlSafe(d.workspace_id),
6631
+ sqlSafe(d.filename),
6632
+ sqlSafe(d.mime),
6633
+ sqlSafe(d.source_type),
6634
+ sqlSafe(d.user_id),
6635
+ sqlSafe(d.uploaded_at),
6636
+ sqlSafe(d.metadata)
6635
6637
  ]
6636
6638
  }));
6637
6639
  await client.batch(stmts, "write");