@arbidocs/sdk 0.4.15 → 0.4.18

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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { q as ConfigStore, n as CliConfig, o as CliCredentials, C as ChatSession, ac as SkippedFile, al as UploadResult, k as AuthHeaders, ah as UploadBatchResult, ak as UploadOptions, ai as UploadDirectOptions, aj as UploadDirectResult, aa as SUPPORTED_EXTENSIONS, w as DmCryptoContext } from './browser-B53im_GV.cjs';
2
- export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArbiSessionExpiredError, i as ArtifactEvent, j as AuthContext, l as AuthenticatedClient, m as CitationSummary, p as CommandDescriptor, r as ConnectOptions, D as DOC_TERMINAL_STATUSES, x as DocNameMap, y as DocumentListFields, z as DocumentListOrder, B as DocumentWaiter, E as DocumentWaiterOptions, I as FormattedWsMessage, L as ListAllOptions, K as ListPaginatedOptions, M as MessageLevel, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Y as ResolvedRecipient, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ae as TokenBudgetContext, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as account, au as agentconfig, av as assistant, aw as authenticatedFetch, ax as buildDocNameMap, ay as buildRetrievalChunkTool, az as buildRetrievalFullContextTool, aA as buildRetrievalTocTool, aB as connectWebSocket, aC as connectWithReconnect, aD as consumeSSEStream, aE as contacts, aF as conversations, aG as countCitations, aH as createAuthenticatedClient, aI as createDocumentWaiter, aJ as dm, aK as doctags, aL as documents, aM as facts, aN as files, aO as filterSkills, aP as formatAgentStepLabel, aQ as formatFileSize, aR as formatItemLabel, aS as formatStreamSummary, aT as formatUserName, aU as formatWorkspaceChoices, aV as formatWsMessage, aW as generateEncryptedWorkspaceKey, aX as generateNewWorkspaceKey, aY as getErrorCode, aZ as getErrorMessage, a_ as getRawWorkspaceKey, a$ as health, b0 as parseSSEEvents, b1 as parseSlashCommand, b2 as parseSlashTokenInProgress, b3 as performPasswordLogin, b4 as performSigningKeyLogin, b5 as performSsoDeviceFlowLogin, b6 as profile, b7 as projects, b8 as requireData, b9 as requireOk, ba as resolveAuth, bb as resolveCitations, bc as resolveWorkspace, bd as responses, be as selectWorkspace, bf as selectWorkspaceById, bg as sessions, bh as settings, bi as streamSSE, bj as stripCitationMarkdown, bk as summarizeCitations, bl as tags, bm as tasks, bn as workspaces } from './browser-B53im_GV.cjs';
1
+ import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, al as SkippedFile, av as UploadResult, m as AuthHeaders, ar as UploadBatchResult, au as UploadOptions, as as UploadDirectOptions, at as UploadDirectResult, aj as SUPPORTED_EXTENSIONS, E as DmCryptoContext } from './browser-DY8mQOdF.cjs';
2
+ export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, y as CreateWorkRequest, z as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, F as DocNameMap, G as DocumentListFields, H as DocumentListOrder, I as DocumentWaiter, J as DocumentWaiterOptions, N as FormattedWsMessage, O as ListAllOptions, Q as ListPaginatedOptions, R as MessageLevel, S as MessageMetadataPayload, T as MessageQueuedEvent, U as OutputTokensDetails, V as ParsedSlashCommand, W as PendingAuthResponse, X as PlanWorkRequest, Z as ProjectInvoicesResponse, _ as ProjectUsageResponse, $ as QueryOptions, a0 as ReconnectOptions, a1 as ReconnectableWsConnection, a2 as RequestApprovalRequest, a3 as ResolvedCitation, a4 as ResolvedRecipient, a5 as ResponseCompletedEvent, a6 as ResponseContentPartAddedEvent, a7 as ResponseCreatedEvent, a8 as ResponseFailedEvent, a9 as ResponseOutputItemAddedEvent, aa as ResponseOutputItemDoneEvent, ab as ResponseOutputTextDeltaEvent, ac as ResponseOutputTextDoneEvent, ad as ResponseUsage, ae as ReviewWorkRequest, af as SSEEvent, ag as SSEStreamCallbacks, ah as SSEStreamResult, ai as SSEStreamStartData, ak as SkillSummary, am as TaskPlan, an as TokenBudgetContext, ao as UpdateConversationRequest, aq as UpdateWorkflowRequest, aw as UserDailyUsageResponse, ax as UserInfo, ay as UserInputRequestEvent, az as UserMessageEvent, aA as WebSocketAuthError, aB as WorkStatus, aC as WorkflowAuthMode, aD as WorkflowResponse, aE as WorkflowRunResponse, aF as WorkspaceContext, aG as WsConnection, aH as account, aI as agentconfig, aJ as assistant, aK as authenticatedFetch, aL as buildDocNameMap, aM as buildRetrievalChunkTool, aN as buildRetrievalFullContextTool, aO as buildRetrievalTocTool, aP as connectWebSocket, aQ as connectWithReconnect, aR as consumeSSEStream, aS as contacts, aT as conversations, aU as countCitations, aV as createAuthenticatedClient, aW as createDocumentWaiter, aX as dm, aY as doctags, aZ as documents, a_ as facts, a$ as files, b0 as filterSkills, b1 as formatAgentStepLabel, b2 as formatFileSize, b3 as formatItemLabel, b4 as formatStreamSummary, b5 as formatUserName, b6 as formatWorkspaceChoices, b7 as formatWsMessage, b8 as generateEncryptedWorkspaceKey, b9 as generateNewWorkspaceKey, ba as getErrorCode, bb as getErrorMessage, bc as getRawWorkspaceKey, bd as health, be as parseSSEEvents, bf as parseSlashCommand, bg as parseSlashTokenInProgress, bh as performPasswordLogin, bi as performSigningKeyLogin, bj as performSsoDeviceFlowLogin, bk as profile, bl as projects, bm as requireData, bn as requireOk, bo as resolveAuth, bp as resolveCitations, bq as resolveWorkspace, br as responses, bs as selectWorkspace, bt as selectWorkspaceById, bu as sessions, bv as settings, bw as streamSSE, bx as stripCitationMarkdown, by as summarizeCitations, bz as tags, bA as work, bB as workflows, bC as workspaces } from './browser-DY8mQOdF.cjs';
3
3
  import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client';
4
4
  export { LoginProfile } from '@arbidocs/client';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { q as ConfigStore, n as CliConfig, o as CliCredentials, C as ChatSession, ac as SkippedFile, al as UploadResult, k as AuthHeaders, ah as UploadBatchResult, ak as UploadOptions, ai as UploadDirectOptions, aj as UploadDirectResult, aa as SUPPORTED_EXTENSIONS, w as DmCryptoContext } from './browser-B53im_GV.js';
2
- export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArbiSessionExpiredError, i as ArtifactEvent, j as AuthContext, l as AuthenticatedClient, m as CitationSummary, p as CommandDescriptor, r as ConnectOptions, D as DOC_TERMINAL_STATUSES, x as DocNameMap, y as DocumentListFields, z as DocumentListOrder, B as DocumentWaiter, E as DocumentWaiterOptions, I as FormattedWsMessage, L as ListAllOptions, K as ListPaginatedOptions, M as MessageLevel, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Y as ResolvedRecipient, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ae as TokenBudgetContext, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as account, au as agentconfig, av as assistant, aw as authenticatedFetch, ax as buildDocNameMap, ay as buildRetrievalChunkTool, az as buildRetrievalFullContextTool, aA as buildRetrievalTocTool, aB as connectWebSocket, aC as connectWithReconnect, aD as consumeSSEStream, aE as contacts, aF as conversations, aG as countCitations, aH as createAuthenticatedClient, aI as createDocumentWaiter, aJ as dm, aK as doctags, aL as documents, aM as facts, aN as files, aO as filterSkills, aP as formatAgentStepLabel, aQ as formatFileSize, aR as formatItemLabel, aS as formatStreamSummary, aT as formatUserName, aU as formatWorkspaceChoices, aV as formatWsMessage, aW as generateEncryptedWorkspaceKey, aX as generateNewWorkspaceKey, aY as getErrorCode, aZ as getErrorMessage, a_ as getRawWorkspaceKey, a$ as health, b0 as parseSSEEvents, b1 as parseSlashCommand, b2 as parseSlashTokenInProgress, b3 as performPasswordLogin, b4 as performSigningKeyLogin, b5 as performSsoDeviceFlowLogin, b6 as profile, b7 as projects, b8 as requireData, b9 as requireOk, ba as resolveAuth, bb as resolveCitations, bc as resolveWorkspace, bd as responses, be as selectWorkspace, bf as selectWorkspaceById, bg as sessions, bh as settings, bi as streamSSE, bj as stripCitationMarkdown, bk as summarizeCitations, bl as tags, bm as tasks, bn as workspaces } from './browser-B53im_GV.js';
1
+ import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, al as SkippedFile, av as UploadResult, m as AuthHeaders, ar as UploadBatchResult, au as UploadOptions, as as UploadDirectOptions, at as UploadDirectResult, aj as SUPPORTED_EXTENSIONS, E as DmCryptoContext } from './browser-DY8mQOdF.js';
2
+ export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, y as CreateWorkRequest, z as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, F as DocNameMap, G as DocumentListFields, H as DocumentListOrder, I as DocumentWaiter, J as DocumentWaiterOptions, N as FormattedWsMessage, O as ListAllOptions, Q as ListPaginatedOptions, R as MessageLevel, S as MessageMetadataPayload, T as MessageQueuedEvent, U as OutputTokensDetails, V as ParsedSlashCommand, W as PendingAuthResponse, X as PlanWorkRequest, Z as ProjectInvoicesResponse, _ as ProjectUsageResponse, $ as QueryOptions, a0 as ReconnectOptions, a1 as ReconnectableWsConnection, a2 as RequestApprovalRequest, a3 as ResolvedCitation, a4 as ResolvedRecipient, a5 as ResponseCompletedEvent, a6 as ResponseContentPartAddedEvent, a7 as ResponseCreatedEvent, a8 as ResponseFailedEvent, a9 as ResponseOutputItemAddedEvent, aa as ResponseOutputItemDoneEvent, ab as ResponseOutputTextDeltaEvent, ac as ResponseOutputTextDoneEvent, ad as ResponseUsage, ae as ReviewWorkRequest, af as SSEEvent, ag as SSEStreamCallbacks, ah as SSEStreamResult, ai as SSEStreamStartData, ak as SkillSummary, am as TaskPlan, an as TokenBudgetContext, ao as UpdateConversationRequest, aq as UpdateWorkflowRequest, aw as UserDailyUsageResponse, ax as UserInfo, ay as UserInputRequestEvent, az as UserMessageEvent, aA as WebSocketAuthError, aB as WorkStatus, aC as WorkflowAuthMode, aD as WorkflowResponse, aE as WorkflowRunResponse, aF as WorkspaceContext, aG as WsConnection, aH as account, aI as agentconfig, aJ as assistant, aK as authenticatedFetch, aL as buildDocNameMap, aM as buildRetrievalChunkTool, aN as buildRetrievalFullContextTool, aO as buildRetrievalTocTool, aP as connectWebSocket, aQ as connectWithReconnect, aR as consumeSSEStream, aS as contacts, aT as conversations, aU as countCitations, aV as createAuthenticatedClient, aW as createDocumentWaiter, aX as dm, aY as doctags, aZ as documents, a_ as facts, a$ as files, b0 as filterSkills, b1 as formatAgentStepLabel, b2 as formatFileSize, b3 as formatItemLabel, b4 as formatStreamSummary, b5 as formatUserName, b6 as formatWorkspaceChoices, b7 as formatWsMessage, b8 as generateEncryptedWorkspaceKey, b9 as generateNewWorkspaceKey, ba as getErrorCode, bb as getErrorMessage, bc as getRawWorkspaceKey, bd as health, be as parseSSEEvents, bf as parseSlashCommand, bg as parseSlashTokenInProgress, bh as performPasswordLogin, bi as performSigningKeyLogin, bj as performSsoDeviceFlowLogin, bk as profile, bl as projects, bm as requireData, bn as requireOk, bo as resolveAuth, bp as resolveCitations, bq as resolveWorkspace, br as responses, bs as selectWorkspace, bt as selectWorkspaceById, bu as sessions, bv as settings, bw as streamSSE, bx as stripCitationMarkdown, by as summarizeCitations, bz as tags, bA as work, bB as workflows, bC as workspaces } from './browser-DY8mQOdF.js';
3
3
  import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client';
4
4
  export { LoginProfile } from '@arbidocs/client';
5
5
 
package/dist/index.js CHANGED
@@ -3493,12 +3493,26 @@ var ArbiSessionExpiredError = class extends ArbiError {
3493
3493
  this.name = "ArbiSessionExpiredError";
3494
3494
  }
3495
3495
  };
3496
+ function detailText(detail) {
3497
+ if (!Array.isArray(detail)) return detail || void 0;
3498
+ const messages = detail.map((d2) => d2?.msg).filter((m2) => Boolean(m2));
3499
+ return messages.length ? messages.join("; ") : void 0;
3500
+ }
3501
+ function apiErrorDetail(apiError) {
3502
+ if (typeof apiError === "string") return apiError || void 0;
3503
+ if (!apiError || typeof apiError !== "object") return void 0;
3504
+ const body = apiError;
3505
+ return detailText(body.detail) || (typeof body.message === "string" ? body.message : void 0);
3506
+ }
3496
3507
  var ArbiApiError = class extends ArbiError {
3497
3508
  apiError;
3509
+ /** Why the server refused, in its words (e.g. "run_at must be in the future"), when it said. */
3510
+ detail;
3498
3511
  constructor(message, apiError) {
3499
3512
  super(message);
3500
3513
  this.name = "ArbiApiError";
3501
3514
  this.apiError = apiError;
3515
+ this.detail = apiErrorDetail(apiError);
3502
3516
  }
3503
3517
  };
3504
3518
  function requireData(result, message) {
@@ -3559,7 +3573,7 @@ async function extractErrorMessage(res) {
3559
3573
  if (text) {
3560
3574
  try {
3561
3575
  const json = JSON.parse(text);
3562
- bodyDetail = json.detail || json.message || json.error || void 0;
3576
+ bodyDetail = detailText(json.detail) || json.message || json.error || void 0;
3563
3577
  } catch {
3564
3578
  if (text.length < 200) bodyDetail = text;
3565
3579
  }
@@ -5328,8 +5342,8 @@ __export(conversations_exports, {
5328
5342
  getMessage: () => getMessage,
5329
5343
  importConversations: () => importConversations,
5330
5344
  listConversations: () => listConversations,
5331
- shareConversation: () => shareConversation,
5332
- updateConversationTitle: () => updateConversationTitle
5345
+ postConversationMessage: () => postConversationMessage,
5346
+ updateConversationAssistantMode: () => updateConversationAssistantMode
5333
5347
  });
5334
5348
  async function listConversations(arbi) {
5335
5349
  return requireData(await arbi.fetch.GET("/v1/conversation/list"), "Failed to fetch conversations");
@@ -5361,23 +5375,6 @@ async function deleteConversation(arbi, conversationId) {
5361
5375
  "Failed to delete conversation"
5362
5376
  );
5363
5377
  }
5364
- async function shareConversation(arbi, conversationId) {
5365
- return requireData(
5366
- await arbi.fetch.POST("/v1/conversation/{conversation_ext_id}/share", {
5367
- params: { path: { conversation_ext_id: conversationId } }
5368
- }),
5369
- "Failed to share conversation"
5370
- );
5371
- }
5372
- async function updateConversationTitle(arbi, conversationId, title) {
5373
- return requireData(
5374
- await arbi.fetch.PATCH("/v1/conversation/{conversation_ext_id}/title", {
5375
- params: { path: { conversation_ext_id: conversationId } },
5376
- body: { title }
5377
- }),
5378
- "Failed to update title"
5379
- );
5380
- }
5381
5378
  async function getMessage(arbi, messageId) {
5382
5379
  return requireData(
5383
5380
  await arbi.fetch.GET("/v1/conversation/message/{message_ext_id}", {
@@ -5394,6 +5391,21 @@ async function deleteMessage(arbi, messageId) {
5394
5391
  "Failed to delete message"
5395
5392
  );
5396
5393
  }
5394
+ async function postConversationMessage(arbi, body) {
5395
+ return requireData(
5396
+ await arbi.fetch.POST("/v1/conversation/message", { body }),
5397
+ "Failed to post message"
5398
+ );
5399
+ }
5400
+ async function updateConversationAssistantMode(arbi, conversationId, assistantMode) {
5401
+ return requireData(
5402
+ await arbi.fetch.PATCH("/v1/conversation/{conversation_ext_id}/assistant-mode", {
5403
+ params: { path: { conversation_ext_id: conversationId } },
5404
+ body: { assistant_mode: assistantMode }
5405
+ }),
5406
+ "Failed to update assistant mode"
5407
+ );
5408
+ }
5397
5409
 
5398
5410
  // src/operations/assistant.ts
5399
5411
  var assistant_exports = {};
@@ -5471,7 +5483,7 @@ async function retrieve(options) {
5471
5483
  return data;
5472
5484
  }
5473
5485
  async function queryAssistant(options) {
5474
- const { workspaceId, question, docIds, previousResponseId, model, signal, ...auth } = options;
5486
+ const { workspaceId, question, docIds, previousResponseId, model, mentions, signal, ...auth } = options;
5475
5487
  const body = {
5476
5488
  input: question,
5477
5489
  workspace_ext_id: workspaceId,
@@ -5483,7 +5495,8 @@ async function queryAssistant(options) {
5483
5495
  retrieval_full_context: buildRetrievalFullContextTool([])
5484
5496
  },
5485
5497
  ...previousResponseId ? { previous_response_id: previousResponseId } : {},
5486
- ...model ? { model } : {}
5498
+ ...model ? { model } : {},
5499
+ ...mentions && mentions.length > 0 ? { mentions } : {}
5487
5500
  };
5488
5501
  return authenticatedFetch({
5489
5502
  ...auth,
@@ -6185,54 +6198,121 @@ async function getUserUsageToday(arbi) {
6185
6198
  return requireData(await arbi.fetch.GET("/v1/user/me/usage/today"), "Failed to fetch today usage");
6186
6199
  }
6187
6200
 
6188
- // src/operations/tasks.ts
6189
- var tasks_exports = {};
6190
- __export(tasks_exports, {
6191
- createTask: () => createTask,
6192
- deleteTask: () => deleteTask,
6193
- getTask: () => getTask,
6194
- listTaskRuns: () => listTaskRuns,
6195
- listTasks: () => listTasks,
6196
- runTask: () => runTask,
6197
- updateTask: () => updateTask
6201
+ // src/operations/work.ts
6202
+ var work_exports = {};
6203
+ __export(work_exports, {
6204
+ createWork: () => createWork,
6205
+ getActivity: () => getActivity,
6206
+ getPendingAuth: () => getPendingAuth,
6207
+ planWork: () => planWork,
6208
+ requestApproval: () => requestApproval,
6209
+ reviewConversation: () => reviewConversation,
6210
+ runConversation: () => runConversation,
6211
+ updateConversation: () => updateConversation
6198
6212
  });
6199
- async function listTasks(arbi) {
6200
- return requireData(await arbi.fetch.GET("/v1/tasks"), "Failed to list tasks");
6213
+ var byId = (conversationId) => ({
6214
+ params: { path: { conversation_ext_id: conversationId } }
6215
+ });
6216
+ async function updateConversation(arbi, conversationId, body) {
6217
+ return requireData(
6218
+ await arbi.fetch.PATCH("/v1/conversation/{conversation_ext_id}", {
6219
+ ...byId(conversationId),
6220
+ body
6221
+ }),
6222
+ "Failed to update conversation"
6223
+ );
6201
6224
  }
6202
- async function createTask(arbi, body) {
6203
- return requireData(await arbi.fetch.POST("/v1/tasks", { body }), "Failed to create task");
6225
+ async function createWork(arbi, body) {
6226
+ return requireData(
6227
+ await arbi.fetch.POST("/v1/conversation/work", { body }),
6228
+ "Failed to create task"
6229
+ );
6204
6230
  }
6205
- async function getTask(arbi, taskId) {
6231
+ async function runConversation(arbi, conversationId) {
6206
6232
  return requireData(
6207
- await arbi.fetch.GET("/v1/tasks/{task_id}", { params: { path: { task_id: taskId } } }),
6208
- "Failed to get task"
6233
+ await arbi.fetch.POST("/v1/conversation/{conversation_ext_id}/run", byId(conversationId)),
6234
+ "Failed to run task"
6209
6235
  );
6210
6236
  }
6211
- async function updateTask(arbi, taskId, body) {
6237
+ async function reviewConversation(arbi, conversationId, body) {
6212
6238
  return requireData(
6213
- await arbi.fetch.PATCH("/v1/tasks/{task_id}", {
6214
- params: { path: { task_id: taskId } },
6239
+ await arbi.fetch.POST("/v1/conversation/{conversation_ext_id}/review", {
6240
+ ...byId(conversationId),
6215
6241
  body
6216
6242
  }),
6217
- "Failed to update task"
6243
+ "Failed to review task"
6218
6244
  );
6219
6245
  }
6220
- async function deleteTask(arbi, taskId) {
6221
- const { error } = await arbi.fetch.DELETE("/v1/tasks/{task_id}", {
6222
- params: { path: { task_id: taskId } }
6223
- });
6224
- if (error) throw new Error("Failed to delete task");
6246
+ async function requestApproval(arbi, conversationId, body) {
6247
+ return requireData(
6248
+ await arbi.fetch.POST("/v1/conversation/{conversation_ext_id}/request-approval", {
6249
+ ...byId(conversationId),
6250
+ body
6251
+ }),
6252
+ "Failed to request approval"
6253
+ );
6225
6254
  }
6226
- async function runTask(arbi, taskId) {
6255
+ async function getPendingAuth(arbi, conversationId) {
6227
6256
  return requireData(
6228
- await arbi.fetch.POST("/v1/tasks/{task_id}/run", { params: { path: { task_id: taskId } } }),
6229
- "Failed to run task"
6257
+ await arbi.fetch.GET(
6258
+ "/v1/conversation/{conversation_ext_id}/pending-auth",
6259
+ byId(conversationId)
6260
+ ),
6261
+ "Failed to read the pending access request"
6230
6262
  );
6231
6263
  }
6232
- async function listTaskRuns(arbi, taskId) {
6264
+ async function getActivity(arbi, conversationId) {
6233
6265
  return requireData(
6234
- await arbi.fetch.GET("/v1/tasks/{task_id}/runs", { params: { path: { task_id: taskId } } }),
6235
- "Failed to list task runs"
6266
+ await arbi.fetch.GET("/v1/conversation/{conversation_ext_id}/activity", byId(conversationId)),
6267
+ "Failed to read the task activity"
6268
+ );
6269
+ }
6270
+ async function planWork(arbi, body) {
6271
+ return requireData(
6272
+ await arbi.fetch.POST("/v1/conversation/work/plan", { body }),
6273
+ "Failed to draft a plan"
6274
+ );
6275
+ }
6276
+
6277
+ // src/operations/workflows.ts
6278
+ var workflows_exports = {};
6279
+ __export(workflows_exports, {
6280
+ createWorkflow: () => createWorkflow,
6281
+ deleteWorkflow: () => deleteWorkflow,
6282
+ getWorkflow: () => getWorkflow,
6283
+ listWorkflows: () => listWorkflows,
6284
+ runWorkflow: () => runWorkflow,
6285
+ updateWorkflow: () => updateWorkflow
6286
+ });
6287
+ var byId2 = (workflowId) => ({ params: { path: { workflow_id: workflowId } } });
6288
+ async function listWorkflows(arbi) {
6289
+ return requireData(await arbi.fetch.GET("/v1/workflow"), "Failed to list workflows");
6290
+ }
6291
+ async function createWorkflow(arbi, body) {
6292
+ return requireData(await arbi.fetch.POST("/v1/workflow", { body }), "Failed to create workflow");
6293
+ }
6294
+ async function getWorkflow(arbi, workflowId) {
6295
+ return requireData(
6296
+ await arbi.fetch.GET("/v1/workflow/{workflow_id}", byId2(workflowId)),
6297
+ "Failed to get workflow"
6298
+ );
6299
+ }
6300
+ async function updateWorkflow(arbi, workflowId, body) {
6301
+ return requireData(
6302
+ await arbi.fetch.PATCH("/v1/workflow/{workflow_id}", { ...byId2(workflowId), body }),
6303
+ "Failed to update workflow"
6304
+ );
6305
+ }
6306
+ async function deleteWorkflow(arbi, workflowId) {
6307
+ requireOk(
6308
+ await arbi.fetch.DELETE("/v1/workflow/{workflow_id}", byId2(workflowId)),
6309
+ "Failed to delete workflow"
6310
+ );
6311
+ }
6312
+ async function runWorkflow(arbi, workflowId) {
6313
+ return requireData(
6314
+ await arbi.fetch.POST("/v1/workflow/{workflow_id}/run", byId2(workflowId)),
6315
+ "Failed to run workflow"
6236
6316
  );
6237
6317
  }
6238
6318
 
@@ -6744,10 +6824,52 @@ var Arbi = class {
6744
6824
  list: () => listConversations(this.requireClient()),
6745
6825
  getThreads: (conversationId) => getConversationThreads(this.requireClient(), conversationId),
6746
6826
  delete: (conversationId) => deleteConversation(this.requireClient(), conversationId),
6747
- share: (conversationId) => shareConversation(this.requireClient(), conversationId),
6748
- updateTitle: (conversationId, title) => updateConversationTitle(this.requireClient(), conversationId, title),
6827
+ /**
6828
+ * Patch a conversation: `title`, `shared` (owner only), and the work fields (`description`,
6829
+ * `due_at`, `signoff_user_ext_id`, `parent_conversation_ext_id`, `status`, `plan`). The one call
6830
+ * behind rename, share and unshare.
6831
+ */
6832
+ update: (conversationId, body) => updateConversation(this.requireClient(), conversationId, body),
6833
+ /** Create a work item: a plain to-do, or (with a prompt / skill) agent work that starts now. */
6834
+ createWork: (body) => createWork(this.requireClient(), body),
6835
+ /** Run a work item now, or retry it. */
6836
+ run: (conversationId) => runConversation(this.requireClient(), conversationId),
6837
+ /** The sign-off person approves, or sends feedback back to the agent in the same thread. */
6838
+ review: (conversationId, body) => reviewConversation(this.requireClient(), conversationId, body),
6839
+ /** Hand sign-off to another workspace member. */
6840
+ requestApproval: (conversationId, body) => requestApproval(this.requireClient(), conversationId, body),
6841
+ /** The session key an unattended run waits for the owner to allow; 404 when nothing waits. */
6842
+ pendingAuth: (conversationId) => getPendingAuth(this.requireClient(), conversationId),
6843
+ /** The task's history, oldest first. */
6844
+ activity: (conversationId) => getActivity(this.requireClient(), conversationId),
6845
+ /** Draft a reviewable plan from an objective. */
6846
+ plan: (body) => planWork(this.requireClient(), body),
6847
+ /**
6848
+ * Run a work item and, when the run is parked waiting for workspace access, grant the agent's
6849
+ * run session a temporary key and run it again. Work that needs no approval returns from the
6850
+ * first call already running.
6851
+ */
6852
+ runWithAuth: async (conversationId) => {
6853
+ const client = this.requireClient();
6854
+ const first = await runConversation(client, conversationId);
6855
+ if (!first.pending_auth_request_id) return first;
6856
+ const pending = await getPendingAuth(client, conversationId);
6857
+ await this.workspaces.grantTemporaryAccess({
6858
+ workspaceId: pending.workspace_ext_id ?? this.getWorkspaceId(),
6859
+ emails: [pending.agent_email],
6860
+ sessionPubkeyB64: pending.session_pubkey
6861
+ });
6862
+ return runConversation(client, conversationId);
6863
+ },
6749
6864
  getMessage: (messageId) => getMessage(this.requireClient(), messageId),
6750
- deleteMessage: (messageId) => deleteMessage(this.requireClient(), messageId)
6865
+ deleteMessage: (messageId) => deleteMessage(this.requireClient(), messageId),
6866
+ /** Post a human comment (no assistant run) — see `postConversationMessage`. */
6867
+ postMessage: (body) => postConversationMessage(this.requireClient(), body),
6868
+ setAssistantMode: (conversationId, assistantMode) => updateConversationAssistantMode(
6869
+ this.requireClient(),
6870
+ conversationId,
6871
+ assistantMode
6872
+ )
6751
6873
  };
6752
6874
  // ── Assistant ─────────────────────────────────────────────────────────
6753
6875
  assistant = {
@@ -6967,33 +7089,14 @@ var Arbi = class {
6967
7089
  return session;
6968
7090
  }
6969
7091
  };
6970
- // ── Scheduled tasks ───────────────────────────────────────────────────
6971
- tasks = {
6972
- list: () => listTasks(this.requireClient()),
6973
- create: (body) => createTask(this.requireClient(), body),
6974
- get: (taskId) => getTask(this.requireClient(), taskId),
6975
- update: (taskId, body) => updateTask(this.requireClient(), taskId, body),
6976
- delete: (taskId) => deleteTask(this.requireClient(), taskId),
6977
- run: (taskId) => runTask(this.requireClient(), taskId),
6978
- listRuns: (taskId) => listTaskRuns(this.requireClient(), taskId),
6979
- /**
6980
- * Run a task and, when the run is parked waiting for workspace access (a temporary
6981
- * authorization tier), grant the agent's run session a temporary key and run it again.
6982
- * A task that needs no approval returns from the first call already running.
6983
- */
6984
- runWithAuth: async (taskId) => {
6985
- const client = this.requireClient();
6986
- const first = await runTask(client, taskId);
6987
- if (!first.pending_auth_request_id || !first.pending_auth_session_pubkey || !first.pending_auth_agent_email || !first.workspace_ext_id) {
6988
- return first;
6989
- }
6990
- await this.workspaces.grantTemporaryAccess({
6991
- workspaceId: first.workspace_ext_id,
6992
- emails: [first.pending_auth_agent_email],
6993
- sessionPubkeyB64: first.pending_auth_session_pubkey
6994
- });
6995
- return runTask(client, taskId);
6996
- }
7092
+ // ── Workflows ─────────────────────────────────────────────────────────
7093
+ workflows = {
7094
+ list: () => listWorkflows(this.requireClient()),
7095
+ create: (body) => createWorkflow(this.requireClient(), body),
7096
+ update: (workflowId, body) => updateWorkflow(this.requireClient(), workflowId, body),
7097
+ delete: (workflowId) => deleteWorkflow(this.requireClient(), workflowId),
7098
+ /** Fire a workflow now, as a test run. Resolves with the conversation it created and whether it started. */
7099
+ run: (workflowId) => runWorkflow(this.requireClient(), workflowId)
6997
7100
  };
6998
7101
  // ── Workspace facts ─────────────────────────────────────────────────
6999
7102
  facts = {
@@ -8155,6 +8258,6 @@ async function startDmListener(options) {
8155
8258
  };
8156
8259
  }
8157
8260
 
8158
- export { Arbi, ArbiApiError, ArbiError, ArbiSessionExpiredError, ClaudeOrchestrator, DOC_TERMINAL_STATUSES, FileConfigStore, OpenClawOrchestrator, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, agents_exports as agents, assistant_exports as assistant, authenticatedFetch, buildDocNameMap, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, createDocumentWaiter, device_flow_exports as deviceFlow, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, documents_node_exports as documentsNode, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatItemLabel, formatStreamSummary, formatUserName, formatWorkspaceChoices, formatWsMessage, generateEncryptedWorkspaceKey, generateNewWorkspaceKey, getErrorCode, getErrorMessage, getRawWorkspaceKey, health_exports as health, listen_exports as listen, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, performSigningKeyLogin, performSsoDeviceFlowLogin, profile_exports as profile, projects_exports as projects, requireData, requireOk, resolveAuth, resolveCitations, resolveWorkspace, responses_exports as responses, selectWorkspace, selectWorkspaceById, sessions_exports as sessions, settings_exports as settings, startDmListener, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, tasks_exports as tasks, workspaces_exports as workspaces };
8261
+ export { Arbi, ArbiApiError, ArbiError, ArbiSessionExpiredError, ClaudeOrchestrator, DOC_TERMINAL_STATUSES, FileConfigStore, OpenClawOrchestrator, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, agents_exports as agents, assistant_exports as assistant, authenticatedFetch, buildDocNameMap, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, createDocumentWaiter, device_flow_exports as deviceFlow, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, documents_node_exports as documentsNode, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatItemLabel, formatStreamSummary, formatUserName, formatWorkspaceChoices, formatWsMessage, generateEncryptedWorkspaceKey, generateNewWorkspaceKey, getErrorCode, getErrorMessage, getRawWorkspaceKey, health_exports as health, listen_exports as listen, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, performSigningKeyLogin, performSsoDeviceFlowLogin, profile_exports as profile, projects_exports as projects, requireData, requireOk, resolveAuth, resolveCitations, resolveWorkspace, responses_exports as responses, selectWorkspace, selectWorkspaceById, sessions_exports as sessions, settings_exports as settings, startDmListener, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, work_exports as work, workflows_exports as workflows, workspaces_exports as workspaces };
8159
8262
  //# sourceMappingURL=index.js.map
8160
8263
  //# sourceMappingURL=index.js.map