@crewx/sdk 0.9.0-rc.95 → 0.9.0-rc.97

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.
@@ -202,6 +202,7 @@ export declare class TaskRepository extends BaseSqliteRepository {
202
202
  }): boolean;
203
203
  adoptPendingTask(id: string): boolean;
204
204
  failPendingTask(id: string, error: string, completedAt?: string): boolean;
205
+ stopPendingTask(id: string, error?: string, completedAt?: string): boolean;
205
206
  listTasksByProjectId(projectId: string): TaskRow[];
206
207
  finishTask(opts: {
207
208
  id: string;
@@ -114,6 +114,25 @@ export declare const ui_instances: import("drizzle-orm/sqlite-core").SQLiteTable
114
114
  }, {}, {
115
115
  length: number | undefined;
116
116
  }>;
117
+ app_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
118
+ name: "app_id";
119
+ tableName: "ui_instances";
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
+ }>;
117
136
  anchor_task_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
118
137
  name: "anchor_task_id";
119
138
  tableName: "ui_instances";
@@ -1,4 +1,5 @@
1
1
  import type { Platform } from '../conversation/types';
2
+ import type { McpAppStateDescriptor } from '../mcp-app/types';
2
3
  import { z } from 'zod';
3
4
  export declare const AgentInlineSchema: z.ZodObject<{
4
5
  model: z.ZodOptional<z.ZodString>;
@@ -740,14 +741,14 @@ export declare const WiBoardSchema: z.ZodObject<{
740
741
  description: z.ZodOptional<z.ZodString>;
741
742
  goal_id: z.ZodOptional<z.ZodString>;
742
743
  }, "strip", z.ZodTypeAny, {
743
- id: string;
744
744
  name: string;
745
+ id: string;
745
746
  workflow_id: string;
746
747
  description?: string | undefined;
747
748
  goal_id?: string | undefined;
748
749
  }, {
749
- id: string;
750
750
  name: string;
751
+ id: string;
751
752
  workflow_id: string;
752
753
  description?: string | undefined;
753
754
  goal_id?: string | undefined;
@@ -2840,6 +2841,7 @@ export interface QueryOptions {
2840
2841
  platform?: Platform;
2841
2842
  messages?: import('../conversation/types').TemplateMessage[];
2842
2843
  uiProjections?: readonly import('../ui-instance/types').UiAgentContextProjection[];
2844
+ mcpAppProjections?: readonly McpAppStateDescriptor[];
2843
2845
  vars?: Record<string, unknown>;
2844
2846
  cwd?: string;
2845
2847
  resumeSessionId?: string;
@@ -2886,6 +2888,7 @@ export interface ExecuteOptions {
2886
2888
  platform?: Platform;
2887
2889
  messages?: import('../conversation/types').TemplateMessage[];
2888
2890
  uiProjections?: readonly import('../ui-instance/types').UiAgentContextProjection[];
2891
+ mcpAppProjections?: readonly McpAppStateDescriptor[];
2889
2892
  vars?: Record<string, unknown>;
2890
2893
  cwd?: string;
2891
2894
  resumeSessionId?: string;
@@ -1,7 +1,8 @@
1
- export type { ActionReceipt, ActionReceiptOutcome, CreateUiInstanceInput, JsonObject, JsonPrimitive, JsonValue, UiActionHandlerContext, UiActionHandlerRegistration, UiActionHandlerResult, UiActionEnvelope, UiActor, UiDefinition, UiDefinitionAction, UiDefinitionInput, UiDefinitionRef, UiProjectionPolicy, UiExecutionContext, UiAuthenticatedActor, UiAuthenticatedExecutionContext, UiAuthenticatedGrantPolicy, UiServerRuntimeFacade, UiServerRuntimeOptions, UiAgentContextProjection, UiExternalActionHandlerRegistration, UiInstance, UiInstanceStatus, UiLocalGrantPolicy, UiRuntimeFacade, UiRuntimeOptions, UiStateActionHandlerRegistration, } from './types.js';
1
+ export type { ActionReceipt, ActionReceiptOutcome, CreateUiInstanceInput, JsonObject, JsonPrimitive, JsonValue, UiActionHandlerContext, UiActionHandlerRegistration, UiActionHandlerResult, UiActionEnvelope, UiActionConfirmation, UiActor, UiDefinition, UiDefinitionAction, UiDefinitionInput, UiDefinitionRef, UiProjectionPolicy, UiExecutionContext, UiAuthenticatedActor, UiAuthenticatedExecutionContext, UiAuthenticatedGrantPolicy, UiServerRuntimeFacade, UiServerRuntimeOptions, UiAgentContextProjection, UiExternalActionHandlerRegistration, UiInstance, UiInstanceStatus, UiLocalGrantPolicy, UiRuntimeFacade, UiRuntimeOptions, UiStateActionHandlerRegistration, } from './types.js';
2
2
  export { resolveUiEffectiveCapabilities } from './types.js';
3
3
  export { UiRuntimeError } from './errors.js';
4
4
  export type { UiRuntimeErrorCode } from './errors.js';
5
+ export { projectSafeJsonObject } from './json.js';
5
6
  export { hashUiDefinition } from './definition.js';
6
7
  export { UiInstanceStore, openUiInstanceReadStore } from './store.js';
7
8
  export type { UiAuditSnapshotInput, UiInstanceReadStore } from './store.js';
@@ -8,7 +8,7 @@ export interface ReservationInput {
8
8
  requestId: string;
9
9
  actionId: string;
10
10
  actor: UiActor;
11
- source: 'cli' | 'ui_host' | 'system';
11
+ source: 'cli' | 'ui_host' | 'system' | 'mcp';
12
12
  expectedRevision: number;
13
13
  input: JsonObject;
14
14
  now: number;
@@ -38,6 +38,7 @@ export interface UiAuditSnapshotInput {
38
38
  }
39
39
  export interface UiInstanceReadStore {
40
40
  get(instanceId: string): UiInstance | null;
41
+ listByThread(workspaceId: string, threadId: string): UiInstance[];
41
42
  close(): void;
42
43
  }
43
44
  export declare function openUiInstanceReadStore(dbPath?: string): UiInstanceReadStore;
@@ -54,6 +55,7 @@ export declare class UiInstanceStore {
54
55
  definitionHash: string;
55
56
  workspaceId: string;
56
57
  threadId: string;
58
+ appId?: string | null;
57
59
  anchorTaskId: string | null;
58
60
  domainRef: JsonObject;
59
61
  state: JsonObject;
@@ -61,6 +63,21 @@ export declare class UiInstanceStore {
61
63
  now: number;
62
64
  }): UiInstance;
63
65
  get(instanceId: string): UiInstance | null;
66
+ open(input: {
67
+ id?: string;
68
+ appId: string;
69
+ definitionId: string;
70
+ definitionVersion: number;
71
+ definitionHash: string;
72
+ workspaceId: string;
73
+ threadId: string;
74
+ anchorTaskId?: string | null;
75
+ domainRef: JsonObject;
76
+ state: JsonObject;
77
+ grants: readonly string[];
78
+ now: number;
79
+ }): UiInstance;
80
+ listByThread(workspaceId: string, threadId: string): UiInstance[];
64
81
  updateAuditSnapshot(input: UiAuditSnapshotInput): UiInstance | null;
65
82
  getReceipt(instanceId: string, requestId: string): ActionReceipt | null;
66
83
  runStateOnly(reservation: ReservationInput, handler: StateHandlerExecution['handle']): ActionReceipt;
@@ -73,6 +90,8 @@ export declare class UiInstanceStore {
73
90
  state: JsonObject;
74
91
  result: JsonObject | null;
75
92
  errorCode: string | null;
93
+ apply?: () => ReturnType<StateHandlerExecution['handle']>;
94
+ restoreRevisionOnFailure?: boolean;
76
95
  now: number;
77
96
  }): ActionReceipt;
78
97
  }
@@ -9,9 +9,11 @@ export interface UiDefinitionRef {
9
9
  version: number;
10
10
  hash: string;
11
11
  }
12
+ export type UiActionConfirmation = 'none' | 'native';
12
13
  export interface UiDefinitionAction {
13
14
  readonly capabilities: readonly string[];
14
15
  readonly inputKeys?: readonly string[];
16
+ readonly confirmation?: UiActionConfirmation;
15
17
  readonly resultProjection?: UiProjectionPolicy;
16
18
  }
17
19
  export interface UiProjectionPolicy {
@@ -41,6 +43,7 @@ export interface UiInstance {
41
43
  definition: UiDefinitionRef;
42
44
  workspaceId: string;
43
45
  threadId: string;
46
+ appId: string | null;
44
47
  anchorTaskId: string | null;
45
48
  domainRef: JsonObject;
46
49
  state: JsonObject;
@@ -63,9 +66,12 @@ export type UiActor = {
63
66
  } | {
64
67
  kind: 'authenticated';
65
68
  id: string;
69
+ } | {
70
+ kind: 'agent';
71
+ id: string;
66
72
  };
67
73
  export interface UiExecutionContext {
68
- source: 'cli' | 'ui_host' | 'system';
74
+ source: 'cli' | 'ui_host' | 'system' | 'mcp';
69
75
  workspaceId: string;
70
76
  actor: UiActor;
71
77
  }
@@ -86,7 +92,7 @@ export interface ActionReceipt {
86
92
  requestId: string;
87
93
  actionId: string;
88
94
  actor: UiActor;
89
- source: 'cli' | 'ui_host' | 'system';
95
+ source: 'cli' | 'ui_host' | 'system' | 'mcp';
90
96
  expectedRevision: number;
91
97
  beforeRevision: number;
92
98
  afterRevision: number | null;
@@ -114,7 +120,7 @@ export interface UiLocalGrantPolicy {
114
120
  export interface UiActionHandlerContext {
115
121
  instance: UiInstance;
116
122
  actor: UiActor;
117
- source: 'cli' | 'ui_host' | 'system';
123
+ source: 'cli' | 'ui_host' | 'system' | 'mcp';
118
124
  input: JsonObject;
119
125
  requestId: string;
120
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/sdk",
3
- "version": "0.9.0-rc.95",
3
+ "version": "0.9.0-rc.97",
4
4
  "license": "UNLICENSED",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"
@@ -143,10 +143,11 @@ layouts:
143
143
  Delegation procedure:
144
144
  1. Inside an agent process, `crewx q` and `crewx x` immediately return a
145
145
  receipt (task ID). A receipt means accepted, not completed.
146
- 2. Recover the result by repeatedly calling `crewx result <id> --wait=N`
147
- with N ≤ 300 from the foreground. Exit 124 means the work is still in
148
- progress, so call it again. Read the terminal status before judging the
149
- outcome.
146
+ 2. Recover the result by calling `crewx result <id>` with the next wait value
147
+ printed in the command's action guidance. That value increases automatically
148
+ as the task runs longer. Exit 124 means the work is still in progress, so
149
+ follow the next action guidance again. Read the terminal status before
150
+ judging the outcome.
150
151
  3. Do not use `&`, `nohup`, or another background execution method. The
151
152
  runner owns the work, so it continues after your turn ends.
152
153
  4. Add `--wait` when a short call should run synchronously and is expected