@crewx/cli 0.9.0-rc.120 → 0.9.0-rc.121

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.
@@ -64,7 +64,7 @@ export type AssignedTaskAdoption = {
64
64
  */
65
65
  export declare function adoptAssignedTask(taskRepo: Pick<TaskRepository, 'adoptPendingTask'>, taskId: string, detachedRunner: boolean): AssignedTaskAdoption;
66
66
  /** Read the actor persisted on the receipt after the runner adopts it. */
67
- export declare function readAssignedTaskActor(taskRepo: Pick<TaskRepository, 'getTask'>, taskId: string): TaskActor | undefined;
67
+ export declare function readAssignedTaskActor(taskRepo: Pick<TaskRepository, 'getTask'>, taskId: string): TaskActor;
68
68
  export interface DetachedMiddleHop {
69
69
  taskId: string;
70
70
  logPath: string;
@@ -22,6 +22,7 @@ const fs_1 = require("fs");
22
22
  const path_1 = require("path");
23
23
  const os_1 = require("os");
24
24
  const sdk_1 = require("@crewx/sdk");
25
+ const node_1 = require("@crewx/sdk/node");
25
26
  const repository_1 = require("@crewx/sdk/repository");
26
27
  const parse_agent_message_1 = require("./parse-agent-message");
27
28
  const parse_common_flags_1 = require("./parse-common-flags");
@@ -37,10 +38,20 @@ function resolveCliTaskActor(metadata, agentId = process.env['CREWX_AGENT_ID'])
37
38
  const scheduleId = nonEmptyString(metadata.schedule_id);
38
39
  if (scheduleId)
39
40
  return { actorKind: 'system', actorId: `cron:${scheduleId}` };
41
+ const workflow = metadata.workflow;
42
+ const workflowMetadata = workflow !== null && typeof workflow === 'object' && !Array.isArray(workflow)
43
+ ? workflow
44
+ : undefined;
45
+ const workflowExecId = nonEmptyString(workflowMetadata?.exec_id);
46
+ if (workflowExecId)
47
+ return { actorKind: 'system', actorId: `workflow:${workflowExecId}` };
40
48
  const normalizedAgentId = nonEmptyString(agentId);
41
49
  if (normalizedAgentId)
42
50
  return { actorKind: 'agent', actorId: normalizedAgentId };
43
- return { actorKind: 'human', actorId: null };
51
+ if (process.stdin.isTTY === true || process.stderr.isTTY === true) {
52
+ return { actorKind: 'human', actorId: (0, node_1.getLocalActorId)() };
53
+ }
54
+ return { actorKind: 'unknown', actorId: null };
44
55
  }
45
56
  /**
46
57
  * Resolve the actor at the receipt boundary while the caller's environment is
@@ -322,8 +333,9 @@ function adoptAssignedTask(taskRepo, taskId, detachedRunner) {
322
333
  function readAssignedTaskActor(taskRepo, taskId) {
323
334
  const task = taskRepo.getTask(taskId);
324
335
  const actorKind = task?.actor_kind;
325
- if (actorKind === null || actorKind === undefined)
326
- return undefined;
336
+ if (actorKind === null || actorKind === undefined) {
337
+ return { actorKind: 'unknown', actorId: null };
338
+ }
327
339
  if (actorKind === 'human' || actorKind === 'agent' || actorKind === 'system' || actorKind === 'unknown') {
328
340
  return { actorKind, actorId: task?.actor_id ?? null };
329
341
  }
@@ -206,7 +206,7 @@ async function handleExecute(args, command = 'execute', emitState = (0, emit_tra
206
206
  overdrive: overdrive || undefined,
207
207
  threadId: thread,
208
208
  taskId: selfTaskId,
209
- actor: assignedTaskId === undefined ? actor : taskActor,
209
+ actor: selfTaskId === undefined ? actor : taskActor,
210
210
  metadata: Object.keys(parsedMetadata).length > 0 ? parsedMetadata : undefined,
211
211
  vars: Object.keys(vars).length > 0 ? vars : undefined,
212
212
  trace: inheritedTrace,
@@ -203,7 +203,7 @@ async function handleQuery(args, command = 'query', emitState = (0, emit_trailer
203
203
  overdrive: overdrive || undefined,
204
204
  threadId: thread,
205
205
  taskId: selfTaskId,
206
- actor: assignedTaskId === undefined ? actor : taskActor,
206
+ actor: selfTaskId === undefined ? actor : taskActor,
207
207
  metadata: Object.keys(parsedMetadata).length > 0 ? parsedMetadata : undefined,
208
208
  vars: Object.keys(vars).length > 0 ? vars : undefined,
209
209
  trace: inheritedTrace,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/cli",
3
- "version": "0.9.0-rc.120",
3
+ "version": "0.9.0-rc.121",
4
4
  "license": "UNLICENSED",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"
@@ -25,20 +25,20 @@
25
25
  "better-sqlite3": "*",
26
26
  "dotenv": "17.2.3",
27
27
  "isomorphic-git": "1.37.1",
28
- "@crewx/sdk": "0.9.0-rc.120",
29
- "@crewx/knowledge-core": "0.1.17-rc.130",
30
- "@crewx/memory": "0.1.23-rc.137",
31
- "@crewx/doc": "0.1.9-rc.113",
32
- "@crewx/search": "0.1.10-rc.116",
33
- "@crewx/wbs": "0.1.10-rc.146",
34
- "@crewx/workflow": "0.3.22-rc.166",
35
- "@crewx/wi": "0.1.10-rc.140",
36
- "@crewx/skill": "0.1.20-rc.14",
37
- "@crewx/chromex": "0.1.0-rc.153",
38
- "@crewx/cron": "0.1.10-rc.155",
39
- "@crewx/notify": "0.1.0-rc.91",
40
- "@crewx/app": "0.1.0-rc.1",
41
- "@crewx/shared": "0.0.6-rc.35"
28
+ "@crewx/sdk": "0.9.0-rc.121",
29
+ "@crewx/knowledge-core": "0.1.17-rc.131",
30
+ "@crewx/memory": "0.1.23-rc.138",
31
+ "@crewx/search": "0.1.10-rc.117",
32
+ "@crewx/doc": "0.1.9-rc.114",
33
+ "@crewx/wbs": "0.1.10-rc.147",
34
+ "@crewx/workflow": "0.3.22-rc.167",
35
+ "@crewx/skill": "0.1.20-rc.15",
36
+ "@crewx/cron": "0.1.10-rc.156",
37
+ "@crewx/notify": "0.1.0-rc.92",
38
+ "@crewx/wi": "0.1.10-rc.141",
39
+ "@crewx/app": "0.1.0-rc.2",
40
+ "@crewx/chromex": "0.1.0-rc.154",
41
+ "@crewx/shared": "0.0.6-rc.36"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/better-sqlite3": "*",