@crewx/sdk 0.9.0-rc.174 → 0.9.0-rc.175

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.
Files changed (46) hide show
  1. package/dist/desktop/index.js +3 -3
  2. package/dist/esm/desktop/index.js +3 -3
  3. package/dist/esm/index.js +388 -259
  4. package/dist/esm/plugins/index.js +95 -91
  5. package/dist/esm/process/index.js +1 -1
  6. package/dist/esm/publish/index.js +2 -2
  7. package/dist/esm/repository/index.js +334 -201
  8. package/dist/esm/skills/index.js +2 -2
  9. package/dist/index.browser.js +1 -1
  10. package/dist/index.d.ts +9 -0
  11. package/dist/index.js +377 -248
  12. package/dist/lifecycle/task-stop.d.ts +27 -1
  13. package/dist/lifecycle/update-admission.d.ts +1 -1
  14. package/dist/mcp-app/types.d.ts +1 -1
  15. package/dist/migrations/0042_breezy_blue_shield.sql +31 -0
  16. package/dist/migrations/0043_nervous_darkstar.sql +1 -0
  17. package/dist/migrations/0044_military_galactus.sql +8 -0
  18. package/dist/migrations/0045_task_pid_started_at.sql +1 -0
  19. package/dist/migrations/meta/0042_snapshot.json +4383 -0
  20. package/dist/migrations/meta/0043_snapshot.json +4390 -0
  21. package/dist/migrations/meta/0044_snapshot.json +4435 -0
  22. package/dist/migrations/meta/0045_snapshot.json +4442 -0
  23. package/dist/migrations/meta/_journal.json +28 -0
  24. package/dist/plugins/index.js +99 -95
  25. package/dist/process/index.d.ts +2 -2
  26. package/dist/process/index.js +1 -1
  27. package/dist/process/process-control.d.ts +14 -0
  28. package/dist/publish/index.js +2 -2
  29. package/dist/repository/db.d.ts +1 -0
  30. package/dist/repository/index.d.ts +7 -0
  31. package/dist/repository/index.js +292 -159
  32. package/dist/repository/run-columns.d.ts +10 -0
  33. package/dist/repository/run-history.repository.d.ts +112 -0
  34. package/dist/repository/schedule-run.repository.d.ts +103 -0
  35. package/dist/repository/task.repository.d.ts +13 -2
  36. package/dist/repository/workflow-anchor-kinds.d.ts +4 -0
  37. package/dist/schema/index.d.ts +2 -0
  38. package/dist/schema/run-column-backfill.d.ts +81 -0
  39. package/dist/schema/schedule-runs.d.ts +451 -0
  40. package/dist/schema/tasks.d.ts +114 -0
  41. package/dist/skills/index.js +2 -2
  42. package/dist/ui-plugin/html-viewer-document-policy.d.ts +23 -0
  43. package/dist/ui-plugin/index.d.ts +2 -0
  44. package/dist/ui-plugin/types.d.ts +1 -0
  45. package/dist/utils/id.d.ts +1 -1
  46. package/package.json +1 -1
@@ -1,9 +1,34 @@
1
1
  import type { FinalizeTaskForHostShutdownOptions, FinalizeTaskForHostShutdownOutcome, FinalizeTaskStopOptions, TaskRepository, TaskRow, TaskStopOrigin, TaskStopRequestResult } from '../repository/task.repository.js';
2
- import { checkProcessOwnershipAsync as defaultCheckProcessOwnershipAsync, terminateProcessTree as defaultTerminateProcessTree, type ProcessControlOptions } from '../process/process-control.js';
2
+ import { checkProcessOwnershipAsync as defaultCheckProcessOwnershipAsync, readProcessIdentityAsync as defaultReadProcessIdentityAsync, terminateProcessTree as defaultTerminateProcessTree, type ProcessControlOptions, type ProcessOwnership } from '../process/process-control.js';
3
3
  export declare const TASK_STOP_DEFAULT_GRACE_MS = 5000;
4
4
  export declare const TASK_STOP_DEFAULT_POLL_MS = 250;
5
5
  export declare function resolveTaskStopMethod(requestedAt: string | null | undefined, completedAt?: string | number, graceMs?: number): 'cooperative' | 'forced';
6
6
  export declare const TASK_STOP_OWNED_PROCESS_MARKERS: readonly ["crewx", "claude", "codex", "opencode", "grok", "node"];
7
+ export interface RecordedTaskProcess {
8
+ pid: number;
9
+ startedAt: string | null | undefined;
10
+ }
11
+ export interface RecordedProcessOwnershipOptions {
12
+ ownershipMarkers?: readonly string[];
13
+ processControl?: StopTaskProcessControl;
14
+ processControlOptions?: ProcessControlOptions;
15
+ }
16
+ export declare function recordedTaskProcesses(row: Pick<TaskRow, 'pid' | 'pid_started_at' | 'metadata'>): RecordedTaskProcess[];
17
+ export type RecordedProcessJudgement = {
18
+ verdict: 'owned';
19
+ } | {
20
+ verdict: 'reused';
21
+ reason: string;
22
+ } | {
23
+ verdict: 'unproven';
24
+ ownership: ProcessOwnership;
25
+ reason: string;
26
+ };
27
+ export interface RecordedProcessJudgementOptions extends RecordedProcessOwnershipOptions {
28
+ legacyStartBoundaryMs?: number;
29
+ }
30
+ export declare function judgeRecordedProcess(target: RecordedTaskProcess, options?: RecordedProcessJudgementOptions): Promise<RecordedProcessJudgement>;
31
+ export declare function checkRecordedProcessOwnership(target: RecordedTaskProcess, options?: RecordedProcessOwnershipOptions): Promise<ProcessOwnership>;
7
32
  export type StopTaskStatus = 'stopped' | 'not_running' | 'already_requested' | 'ownership_unverified' | 'failed';
8
33
  export interface StopTaskResult {
9
34
  status: StopTaskStatus;
@@ -14,6 +39,7 @@ export interface StopTaskResult {
14
39
  }
15
40
  export interface StopTaskProcessControl {
16
41
  checkProcessOwnershipAsync?: typeof defaultCheckProcessOwnershipAsync;
42
+ readProcessIdentityAsync?: typeof defaultReadProcessIdentityAsync;
17
43
  terminateProcessTree?: typeof defaultTerminateProcessTree;
18
44
  }
19
45
  export interface StopTaskOptions {
@@ -29,7 +29,7 @@ export interface UpdateAdmissionReservationEntry {
29
29
  scheduleId: string;
30
30
  corrupt: boolean;
31
31
  }
32
- export declare function reserveUpdateAdmission(taskId: string, scheduleId: string, timeoutMs: number): boolean;
32
+ export declare function reserveUpdateAdmission(taskId: string, scheduleId: string, timeoutMs: number, runId?: string): boolean;
33
33
  export declare function releaseUpdateAdmissionReservation(taskId: string): void;
34
34
  export declare function readUpdateAdmissionReservations(): UpdateAdmissionReservationEntry[];
35
35
  export type DurableTaskAdmission = {
@@ -7,7 +7,7 @@ export declare const MCP_APP_RESOURCE_MIME_TYPE: "text/html;profile=mcp-app";
7
7
  export declare const MCP_APP_RESOURCE_URI_PREFIX = "ui://crewx/";
8
8
  export type McpAppToolVisibility = 'model' | 'app';
9
9
  export type McpAppTone = 'blue' | 'violet' | 'emerald' | 'amber' | 'rose' | 'sky' | 'slate' | 'indigo';
10
- export declare const MCP_APP_HOST_TOOL_ALLOWLIST: readonly ["crewx_app_terminal_connect", "crewx_app_html_viewer_open"];
10
+ export declare const MCP_APP_HOST_TOOL_ALLOWLIST: readonly ["crewx_app_terminal_connect", "crewx_app_html_viewer_open", "crewx_app_browser"];
11
11
  export type McpAppHostToolName = typeof MCP_APP_HOST_TOOL_ALLOWLIST[number];
12
12
  export declare const MCP_CORE_TOOL_NAMES: readonly ["crewx_listWorkspaces", "crewx_queryAgent", "crewx_executeAgent", "crewx_getTaskResult", "crewx_listTasks", "crewx_listAgents", "callBrowser", "openTab", "listTabs", "closeTab"];
13
13
  export type McpCoreToolName = typeof MCP_CORE_TOOL_NAMES[number];
@@ -0,0 +1,31 @@
1
+ CREATE TABLE IF NOT EXISTS `schedule_runs` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `schedule_id` text NOT NULL,
4
+ `workspace_id` text NOT NULL,
5
+ `mode` text NOT NULL,
6
+ `trigger` text NOT NULL,
7
+ `occurrence_key` text,
8
+ `task_id` text,
9
+ `app_id` text,
10
+ `schedule_name` text,
11
+ `builtin_id` text,
12
+ `command` text,
13
+ `high_frequency` integer DEFAULT 0 NOT NULL,
14
+ `status` text NOT NULL,
15
+ `error_code` text,
16
+ `exit_code` integer,
17
+ `signal` text,
18
+ `started_at` text NOT NULL,
19
+ `finished_at` text,
20
+ `duration_ms` integer,
21
+ `pid` integer,
22
+ `host_pid` integer,
23
+ `output_tail` text,
24
+ `output_bytes` integer,
25
+ `output_truncated` integer DEFAULT 0 NOT NULL
26
+ );
27
+ --> statement-breakpoint
28
+ CREATE INDEX IF NOT EXISTS `idx_schedule_runs_workspace_started` ON `schedule_runs` (`workspace_id`,"started_at" DESC);--> statement-breakpoint
29
+ CREATE INDEX IF NOT EXISTS `idx_schedule_runs_schedule_started` ON `schedule_runs` (`schedule_id`,"started_at" DESC);--> statement-breakpoint
30
+ CREATE INDEX IF NOT EXISTS `idx_schedule_runs_task_id` ON `schedule_runs` (`task_id`);--> statement-breakpoint
31
+ CREATE INDEX IF NOT EXISTS `idx_schedule_runs_running` ON `schedule_runs` (`workspace_id`,`started_at`) WHERE "schedule_runs"."status" = 'running';
@@ -0,0 +1 @@
1
+ ALTER TABLE `tasks` ADD `workflow_run_id` text;
@@ -0,0 +1,8 @@
1
+ CREATE TABLE IF NOT EXISTS `run_column_backfill` (
2
+ `name` text PRIMARY KEY NOT NULL,
3
+ `cursor` integer,
4
+ `anchor_id` text,
5
+ `completed_at` text
6
+ );
7
+ --> statement-breakpoint
8
+ ALTER TABLE `tasks` ADD `schedule_id` text;
@@ -0,0 +1 @@
1
+ ALTER TABLE `tasks` ADD `pid_started_at` text;