@ziggs-ai/api-client 0.37.8 → 0.37.10

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.
@@ -178,7 +178,7 @@ const BRIEFS = {
178
178
  },
179
179
  // Tasks
180
180
  ziggs_task_create: {
181
- does: 'Creates a task under an active agreement, or a work graph under a root task. plan sets its checklist.',
181
+ does: 'Creates a task under an active agreement, or a job with its children in one call. plan sets its checklist.',
182
182
  changes: 'creates the tasks and notifies their assignees',
183
183
  },
184
184
  ziggs_task_get: {
@@ -200,7 +200,7 @@ const BRIEFS = {
200
200
  changes: 'closes the task, proving nobody read or paid; the same idempotencyKey is a no-op',
201
201
  },
202
202
  ziggs_task_cancel: {
203
- does: 'Cancels one task. Cancelling a held graph’s root withdraws the graph.',
203
+ does: 'Cancels one task. Cancelling a job cancels its live children.',
204
204
  changes: 'the task is cancelled',
205
205
  },
206
206
  ziggs_task_acknowledge_control: {
@@ -72,14 +72,14 @@ export const cancelTaskCapability = {
72
72
  names: { sdk: 'task_cancel', mcp: 'ziggs_task_cancel' },
73
73
  title: 'Cancel a task',
74
74
  descriptions: {
75
- sdk: 'Cancel one task (PATCH /tasks/:id/cancel). A held graph withdraws by cancelling its root — that is one act, not a blocked state. Cancel ends this task; it does not amend a live hire.',
75
+ sdk: 'Cancel one task (PATCH /tasks/:id/cancel). Cancelling a job cancels its live children — that is one act, not a blocked state. Cancel ends this task; it does not amend a live hire.',
76
76
  },
77
77
  annotation: 'destructive',
78
78
  params: {
79
79
  taskId: {
80
80
  type: 'string',
81
81
  required: true,
82
- description: 'The task to cancel. For a held graph, pass the root.',
82
+ description: 'The task to cancel. To withdraw a whole job, pass the job.',
83
83
  },
84
84
  },
85
85
  needsAgentId: true,
@@ -41,21 +41,28 @@ export declare function acknowledgeTaskControl(taskId: string, requestId: string
41
41
  * subcontract inputs rather than teaching those routes to keep one.
42
42
  */
43
43
  export type PlanReviewTiming = 'with_proposal' | 'before_execution';
44
- export interface CreateTaskGraphNodeData {
45
- nodeId: string;
44
+ /**
45
+ * One child created with its parent, all or none. `name` only lets siblings
46
+ * name each other in `waitsOn`; it is not stored, and the create answers with
47
+ * the task id each name became.
48
+ */
49
+ export interface CreateTaskChildData {
50
+ name: string;
46
51
  agreementId: string;
47
52
  description: string;
48
53
  title?: string;
49
54
  assigneeId?: string;
55
+ /** Names of sibling children in the same create that must finish first. */
50
56
  waitsOn?: string[];
51
57
  joinKind?: 'all' | 'any';
52
- /** A yes/no question over the steps this one waits on; it runs only on yes. */
58
+ /** A yes/no question over the children this one waits on; it runs only on yes. */
53
59
  runIf?: string;
54
- }
55
- export interface CreateTaskGraphData {
56
- nodes: CreateTaskGraphNodeData[];
57
60
  inputArtifactIds?: string[];
58
- review?: 'before_execution';
61
+ }
62
+ /** What a create with children answers for each one. */
63
+ export interface CreatedTaskChild {
64
+ name: string;
65
+ taskId: string;
59
66
  }
60
67
  export interface CreateTaskData {
61
68
  description: string;
@@ -89,8 +96,20 @@ export interface CreateTaskData {
89
96
  * the shape in its own control flow where nothing else can see it.
90
97
  */
91
98
  waitsOn?: string[];
92
- /** Atomically declare a native work graph beneath the returned root task. */
93
- graph?: CreateTaskGraphData;
99
+ /**
100
+ * How the task closes, fixed at create. `children` (the default when
101
+ * `children` is given) makes it a job that closes when its children close:
102
+ * completed when every child no sibling waits on completed or was skipped.
103
+ * `result` (the default otherwise) closes by its own result.
104
+ */
105
+ closesBy?: 'result' | 'children';
106
+ /**
107
+ * Children created with this task in one call, all or none. The job's
108
+ * `inputArtifactIds` go to the children that wait on nothing, and
109
+ * `planReviewTiming: before_execution` holds every child until this task's
110
+ * plan is acknowledged.
111
+ */
112
+ children?: CreateTaskChildData[];
94
113
  /**
95
114
  * When the answer stops being useful, ISO 8601. At the deadline
96
115
  * the holder posts what it has and where it is stuck, and stops. A deadline
@@ -115,7 +134,9 @@ export interface CreateTaskCheckBackData {
115
134
  /** Total reminders allowed per person asked, after the first ask. */
116
135
  maxReminders: number;
117
136
  }
118
- export declare function createTask(taskData: CreateTaskData, creds: Creds): Promise<Task>;
137
+ export declare function createTask(taskData: CreateTaskData, creds: Creds): Promise<Task & {
138
+ children?: CreatedTaskChild[];
139
+ }>;
119
140
  export declare function getTask(taskId: string, creds: Creds): Promise<Task>;
120
141
  export interface UpdateTaskStateData {
121
142
  result?: unknown;
@@ -212,7 +233,9 @@ export declare class TaskClient {
212
233
  constructor(operatorKey: string, agentId?: string);
213
234
  requestControl(taskId: string, request: Parameters<typeof requestTaskControl>[1]): Promise<TaskWriteConfirm>;
214
235
  acknowledgeControl(taskId: string, requestId: string, supported?: boolean): Promise<TaskWriteConfirm>;
215
- createTask(data: CreateTaskData): Promise<Task>;
236
+ createTask(data: CreateTaskData): Promise<Task & {
237
+ children?: CreatedTaskChild[];
238
+ }>;
216
239
  getTask(taskId: string): Promise<Task>;
217
240
  updateTaskState(taskId: string, state: TaskState, data?: UpdateTaskStateData): Promise<TaskWriteConfirm>;
218
241
  getActiveTasksForAgent(agentId: string): Promise<Task[]>;
@@ -112,7 +112,10 @@ export async function createTask(taskData, creds) {
112
112
  const task = extractTask(data);
113
113
  if (!task)
114
114
  throw new Error('Invalid response: task data not found');
115
- return task;
115
+ const children = data?.children;
116
+ return Array.isArray(children)
117
+ ? { ...task, children: children }
118
+ : task;
116
119
  }
117
120
  export async function getTask(taskId, creds) {
118
121
  if (!taskId)
package/dist/types.d.ts CHANGED
@@ -103,17 +103,16 @@ export interface Task {
103
103
  */
104
104
  heldByDeps?: boolean;
105
105
  joinKind?: 'all' | 'any';
106
- graph?: {
107
- nodes: Array<{
108
- nodeId: string;
109
- taskId: string;
110
- }>;
111
- review?: 'before_execution';
112
- } | null;
113
- graphNodeId?: string | null;
114
- heldByGraphReview?: boolean;
115
106
  /**
116
- * A graph step that runs only if a yes/no question holds over the steps it
107
+ * How the task closes, fixed at create. `children` makes it a job: never
108
+ * handed out, it closes when its children (the tasks naming it as their
109
+ * parent) close.
110
+ */
111
+ closesBy?: 'result' | 'children';
112
+ /** True while the task waits for its parent's plan to be acknowledged. */
113
+ heldByParentReview?: boolean;
114
+ /**
115
+ * A child that runs only if a yes/no question holds over the steps it
117
116
  * waits on. Once asked: `run`, `skipped` (closed cancelled without running),
118
117
  * `held` (waiting for the buyer to acknowledge its plan) or `buyer_run`.
119
118
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.37.8",
3
+ "version": "0.37.10",
4
4
  "description": "HTTP and WebSocket client for the Ziggs backend API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -41,6 +41,10 @@
41
41
  "dist",
42
42
  "README.md"
43
43
  ],
44
+ "homepage": "https://ziggsai.com/docs",
45
+ "bugs": {
46
+ "url": "https://ziggsai.com/support"
47
+ },
44
48
  "publishConfig": {
45
49
  "access": "public",
46
50
  "registry": "https://registry.npmjs.org/"