@arbidocs/sdk 0.4.84 → 0.4.85

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 { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aI as SkippedFile, b9 as UploadResult, m as AuthHeaders, b5 as UploadBatchResult, b8 as UploadOptions, b6 as UploadDirectOptions, b7 as UploadDirectResult, aF as SUPPORTED_EXTENSIONS, a0 as MailAttachment, I as DmCryptoContext } from './browser-uyIwS2cN.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, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aG as SendBack, aH as SkillSummary, aJ as StepActionRequest, aK as StepActivityEvent, aL as StepAssignee, aM as StepField, aN as StepKind, aO as StepPhase, aP as StepSignal, aQ as StepSignalWhen, aR as StepState, aS as StepStatus, aT as SubmitBackgroundQueryOptions, aU as TagChange, aV as TagField, aW as TagFieldDefinition, aX as TagMatrixResponse, aY as TagMatrixRow, aZ as TagMatrixSelection, a_ as TagResponse, a$ as TaskPlan, b0 as TaskPlanStep, b1 as TokenBudgetContext, b2 as UpdateConversationRequest, b4 as UpdateWorkflowRequest, ba as UsageBreakdown, bb as UserDailyUsageResponse, bc as UserInfo, bd as UserInputRequestEvent, be as UserMessageEvent, bf as WebSocketAuthError, bg as WorkStatus, bh as WorkflowAuthMode, bi as WorkflowResponse, bj as WorkflowRunHistoryResponse, bk as WorkflowRunResponse, bl as WorkspaceContext, bm as WsConnection, bn as account, bo as agentconfig, bp as agents, bq as assistant, br as authenticatedFetch, bs as buildDocNameMap, bt as buildFactsContextTool, bu as buildRetrievalChunkTool, bv as buildRetrievalFullContextTool, bw as buildRetrievalTocTool, bx as connectWebSocket, by as connectWithReconnect, bz as consumeSSEStream, bA as contacts, bB as conversations, bC as countCitations, bD as createAuthenticatedClient, bE as createDocumentWaiter, bF as dm, bG as doctags, bH as documents, bI as facts, bJ as files, bK as filterSkills, bL as formatAgentStepLabel, bM as formatFileSize, bN as formatItemLabel, bO as formatStreamSummary, bP as formatUserName, bQ as formatWorkspaceChoices, bR as formatWsMessage, bS as generateEncryptedWorkspaceKey, bT as generateNewWorkspaceKey, bU as getErrorCode, bV as getErrorMessage, bW as getRawWorkspaceKey, bX as health, bZ as identityErrorCode, bY as identityVerification, b_ as mail, b$ as parseSSEEvents, c0 as parseSlashCommand, c1 as parseSlashTokenInProgress, c2 as performPasswordLogin, c3 as performSigningKeyLogin, c4 as performSsoDeviceFlowLogin, c5 as profile, c6 as projects, c7 as requireData, c8 as requireOk, c9 as resolveAuth, ca as resolveCitations, cb as resolveWorkspace, cc as responses, cd as selectWorkspace, ce as selectWorkspaceById, cf as sessions, cg as settings, ch as streamSSE, ci as stripCitationMarkdown, cj as summarizeCitations, ck as tags, cl as work, cm as workflowSteps, cn as workflows, co as workspaces } from './browser-uyIwS2cN.cjs';
1
+ import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aI as SkippedFile, ba as UploadResult, m as AuthHeaders, b6 as UploadBatchResult, b9 as UploadOptions, b7 as UploadDirectOptions, b8 as UploadDirectResult, aF as SUPPORTED_EXTENSIONS, a0 as MailAttachment, I as DmCryptoContext } from './browser-BOIk_RaR.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, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aG as SendBack, aH as SkillSummary, aJ as StepActionRequest, aK as StepActivityEvent, aL as StepAssignee, aM as StepField, aN as StepKind, aO as StepPhase, aP as StepSignal, aQ as StepSignalWhen, aR as StepState, aS as StepStatus, aT as SubmitBackgroundQueryOptions, aU as TagChange, aV as TagFieldDefinition, aW as TagKind, aX as TagKindField, aY as TagKindSchema, aZ as TagLinks, a_ as TagListQuery, a$ as TagResponse, b0 as TaskPlan, b1 as TaskPlanStep, b2 as TokenBudgetContext, b3 as UpdateConversationRequest, b5 as UpdateWorkflowRequest, bb as UsageBreakdown, bc as UserDailyUsageResponse, bd as UserInfo, be as UserInputRequestEvent, bf as UserMessageEvent, bg as WebSocketAuthError, bh as WorkStatus, bi as WorkflowAuthMode, bj as WorkflowResponse, bk as WorkflowRunHistoryResponse, bl as WorkflowRunResponse, bm as WorkspaceContext, bn as WsConnection, bo as account, bp as agentconfig, bq as agents, br as assistant, bs as authenticatedFetch, bt as buildDocNameMap, bu as buildFactsContextTool, bv as buildRetrievalChunkTool, bw as buildRetrievalFullContextTool, bx as buildRetrievalTocTool, by as connectWebSocket, bz as connectWithReconnect, bA as consumeSSEStream, bB as contacts, bC as conversations, bD as countCitations, bE as createAuthenticatedClient, bF as createDocumentWaiter, bG as dm, bH as doctags, bI as documents, bJ as facts, bK as files, bL as filterSkills, bM as formatAgentStepLabel, bN as formatFileSize, bO as formatItemLabel, bP as formatStreamSummary, bQ as formatUserName, bR as formatWorkspaceChoices, bS as formatWsMessage, bT as generateEncryptedWorkspaceKey, bU as generateNewWorkspaceKey, bV as getErrorCode, bW as getErrorMessage, bX as getRawWorkspaceKey, bY as health, b_ as identityErrorCode, bZ as identityVerification, b$ as mail, c0 as parseSSEEvents, c1 as parseSlashCommand, c2 as parseSlashTokenInProgress, c3 as performPasswordLogin, c4 as performSigningKeyLogin, c5 as performSsoDeviceFlowLogin, c6 as profile, c7 as projects, c8 as requireData, c9 as requireOk, ca as resolveAuth, cb as resolveCitations, cc as resolveWorkspace, cd as responses, ce as selectWorkspace, cf as selectWorkspaceById, cg as sessions, ch as settings, ci as streamSSE, cj as stripCitationMarkdown, ck as summarizeCitations, cl as tags, cm as work, cn as workflowSteps, co as workflows, cp as workspaces } from './browser-BOIk_RaR.cjs';
3
3
  import { SessionStorageProvider, ArbiClient } from '@arbidocs/client';
4
4
  export { LoginProfile } from '@arbidocs/client';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aI as SkippedFile, b9 as UploadResult, m as AuthHeaders, b5 as UploadBatchResult, b8 as UploadOptions, b6 as UploadDirectOptions, b7 as UploadDirectResult, aF as SUPPORTED_EXTENSIONS, a0 as MailAttachment, I as DmCryptoContext } from './browser-uyIwS2cN.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, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aG as SendBack, aH as SkillSummary, aJ as StepActionRequest, aK as StepActivityEvent, aL as StepAssignee, aM as StepField, aN as StepKind, aO as StepPhase, aP as StepSignal, aQ as StepSignalWhen, aR as StepState, aS as StepStatus, aT as SubmitBackgroundQueryOptions, aU as TagChange, aV as TagField, aW as TagFieldDefinition, aX as TagMatrixResponse, aY as TagMatrixRow, aZ as TagMatrixSelection, a_ as TagResponse, a$ as TaskPlan, b0 as TaskPlanStep, b1 as TokenBudgetContext, b2 as UpdateConversationRequest, b4 as UpdateWorkflowRequest, ba as UsageBreakdown, bb as UserDailyUsageResponse, bc as UserInfo, bd as UserInputRequestEvent, be as UserMessageEvent, bf as WebSocketAuthError, bg as WorkStatus, bh as WorkflowAuthMode, bi as WorkflowResponse, bj as WorkflowRunHistoryResponse, bk as WorkflowRunResponse, bl as WorkspaceContext, bm as WsConnection, bn as account, bo as agentconfig, bp as agents, bq as assistant, br as authenticatedFetch, bs as buildDocNameMap, bt as buildFactsContextTool, bu as buildRetrievalChunkTool, bv as buildRetrievalFullContextTool, bw as buildRetrievalTocTool, bx as connectWebSocket, by as connectWithReconnect, bz as consumeSSEStream, bA as contacts, bB as conversations, bC as countCitations, bD as createAuthenticatedClient, bE as createDocumentWaiter, bF as dm, bG as doctags, bH as documents, bI as facts, bJ as files, bK as filterSkills, bL as formatAgentStepLabel, bM as formatFileSize, bN as formatItemLabel, bO as formatStreamSummary, bP as formatUserName, bQ as formatWorkspaceChoices, bR as formatWsMessage, bS as generateEncryptedWorkspaceKey, bT as generateNewWorkspaceKey, bU as getErrorCode, bV as getErrorMessage, bW as getRawWorkspaceKey, bX as health, bZ as identityErrorCode, bY as identityVerification, b_ as mail, b$ as parseSSEEvents, c0 as parseSlashCommand, c1 as parseSlashTokenInProgress, c2 as performPasswordLogin, c3 as performSigningKeyLogin, c4 as performSsoDeviceFlowLogin, c5 as profile, c6 as projects, c7 as requireData, c8 as requireOk, c9 as resolveAuth, ca as resolveCitations, cb as resolveWorkspace, cc as responses, cd as selectWorkspace, ce as selectWorkspaceById, cf as sessions, cg as settings, ch as streamSSE, ci as stripCitationMarkdown, cj as summarizeCitations, ck as tags, cl as work, cm as workflowSteps, cn as workflows, co as workspaces } from './browser-uyIwS2cN.js';
1
+ import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, aI as SkippedFile, ba as UploadResult, m as AuthHeaders, b6 as UploadBatchResult, b9 as UploadOptions, b7 as UploadDirectOptions, b8 as UploadDirectResult, aF as SUPPORTED_EXTENSIONS, a0 as MailAttachment, I as DmCryptoContext } from './browser-BOIk_RaR.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, w as ConversationUsageResponse, z as CreateWorkRequest, B as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, E as DecryptedDmNotification, G as DmAttachmentFile, H as DmAttachmentInput, J as DocNameMap, K as DocumentAutomationAction, L as DocumentListFields, M as DocumentListOrder, N as DocumentSelector, O as DocumentWaiter, P as DocumentWaiterOptions, T as FormattedWsMessage, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, Z as ListAllOptions, $ as ListPaginatedOptions, a1 as MessageLevel, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, aa as ProjectBudget, ab as ProjectConversationUsageResponse, ac as ProjectDetails, ad as ProjectEventKind, ae as ProjectEventResponse, af as ProjectInvoicesResponse, ag as ProjectResponse, ah as ProjectUpdateRequest, ai as ProjectUsageResponse, aj as QueryOptions, ak as RaisedSignal, al as ReconnectOptions, am as ReconnectableWsConnection, an as ResolvedCitation, ao as ResolvedRecipient, ap as ResponseCompletedEvent, aq as ResponseContentPartAddedEvent, ar as ResponseCreatedEvent, as as ResponseFailedEvent, at as ResponseOutputItemAddedEvent, au as ResponseOutputItemDoneEvent, av as ResponseOutputTextDeltaEvent, aw as ResponseOutputTextDoneEvent, ax as ResponseUsage, ay as RunProgress, az as RunStep, aA as RunWaitingOn, aB as SSEEvent, aC as SSEStreamCallbacks, aD as SSEStreamResult, aE as SSEStreamStartData, aG as SendBack, aH as SkillSummary, aJ as StepActionRequest, aK as StepActivityEvent, aL as StepAssignee, aM as StepField, aN as StepKind, aO as StepPhase, aP as StepSignal, aQ as StepSignalWhen, aR as StepState, aS as StepStatus, aT as SubmitBackgroundQueryOptions, aU as TagChange, aV as TagFieldDefinition, aW as TagKind, aX as TagKindField, aY as TagKindSchema, aZ as TagLinks, a_ as TagListQuery, a$ as TagResponse, b0 as TaskPlan, b1 as TaskPlanStep, b2 as TokenBudgetContext, b3 as UpdateConversationRequest, b5 as UpdateWorkflowRequest, bb as UsageBreakdown, bc as UserDailyUsageResponse, bd as UserInfo, be as UserInputRequestEvent, bf as UserMessageEvent, bg as WebSocketAuthError, bh as WorkStatus, bi as WorkflowAuthMode, bj as WorkflowResponse, bk as WorkflowRunHistoryResponse, bl as WorkflowRunResponse, bm as WorkspaceContext, bn as WsConnection, bo as account, bp as agentconfig, bq as agents, br as assistant, bs as authenticatedFetch, bt as buildDocNameMap, bu as buildFactsContextTool, bv as buildRetrievalChunkTool, bw as buildRetrievalFullContextTool, bx as buildRetrievalTocTool, by as connectWebSocket, bz as connectWithReconnect, bA as consumeSSEStream, bB as contacts, bC as conversations, bD as countCitations, bE as createAuthenticatedClient, bF as createDocumentWaiter, bG as dm, bH as doctags, bI as documents, bJ as facts, bK as files, bL as filterSkills, bM as formatAgentStepLabel, bN as formatFileSize, bO as formatItemLabel, bP as formatStreamSummary, bQ as formatUserName, bR as formatWorkspaceChoices, bS as formatWsMessage, bT as generateEncryptedWorkspaceKey, bU as generateNewWorkspaceKey, bV as getErrorCode, bW as getErrorMessage, bX as getRawWorkspaceKey, bY as health, b_ as identityErrorCode, bZ as identityVerification, b$ as mail, c0 as parseSSEEvents, c1 as parseSlashCommand, c2 as parseSlashTokenInProgress, c3 as performPasswordLogin, c4 as performSigningKeyLogin, c5 as performSsoDeviceFlowLogin, c6 as profile, c7 as projects, c8 as requireData, c9 as requireOk, ca as resolveAuth, cb as resolveCitations, cc as resolveWorkspace, cd as responses, ce as selectWorkspace, cf as selectWorkspaceById, cg as sessions, ch as settings, ci as streamSSE, cj as stripCitationMarkdown, ck as summarizeCitations, cl as tags, cm as work, cn as workflowSteps, co as workflows, cp as workspaces } from './browser-BOIk_RaR.js';
3
3
  import { SessionStorageProvider, ArbiClient } from '@arbidocs/client';
4
4
  export { LoginProfile } from '@arbidocs/client';
5
5
 
package/dist/index.js CHANGED
@@ -5705,17 +5705,33 @@ function extractResponseText(response) {
5705
5705
  // src/operations/tags.ts
5706
5706
  var tags_exports = {};
5707
5707
  __export(tags_exports, {
5708
+ FLAT_TAG_KINDS: () => FLAT_TAG_KINDS,
5708
5709
  TAG_FIELD_TYPES: () => TAG_FIELD_TYPES,
5710
+ TAG_KINDS: () => TAG_KINDS,
5709
5711
  createTag: () => createTag,
5710
5712
  deleteTag: () => deleteTag,
5711
- getTagMatrix: () => getTagMatrix,
5713
+ getTagKind: () => getTagKind,
5714
+ kindFieldWrites: () => kindFieldWrites,
5715
+ listTagKinds: () => listTagKinds,
5712
5716
  listTags: () => listTags,
5713
- mergeTagFieldDefinitions: () => mergeTagFieldDefinitions,
5714
- ownTagFields: () => ownTagFields,
5715
- tagMatrixColumns: () => tagMatrixColumns,
5717
+ mergeKindFieldDefinitions: () => mergeKindFieldDefinitions,
5718
+ setTagValues: () => setTagValues,
5716
5719
  updateTag: () => updateTag,
5717
- updateTagFields: () => updateTagFields
5720
+ updateTagKind: () => updateTagKind
5718
5721
  });
5722
+ var withFields = (schema) => ({
5723
+ ...schema,
5724
+ fields: schema.fields ?? []
5725
+ });
5726
+ var TAG_KINDS = [
5727
+ "label",
5728
+ "annotation",
5729
+ "issue",
5730
+ "person",
5731
+ "organisation",
5732
+ "search"
5733
+ ];
5734
+ var FLAT_TAG_KINDS = ["issue", "person", "organisation"];
5719
5735
  var TAG_FIELD_TYPES = [
5720
5736
  "text",
5721
5737
  "number",
@@ -5724,8 +5740,20 @@ var TAG_FIELD_TYPES = [
5724
5740
  "select",
5725
5741
  "person"
5726
5742
  ];
5727
- async function listTags(arbi) {
5728
- return requireData(await arbi.fetch.GET("/v1/tag/list"), "Failed to fetch tags");
5743
+ async function listTags(arbi, query = {}) {
5744
+ const params = {};
5745
+ if (query.kind) params.kind = query.kind;
5746
+ if (query.parentId) params.parent = query.parentId;
5747
+ if (query.ids?.length) params.ids = query.ids;
5748
+ if (query.include?.length) params.include = query.include;
5749
+ if (query.linksLimit !== void 0) params.links_limit = query.linksLimit;
5750
+ return requireData(
5751
+ await arbi.fetch.GET(
5752
+ "/v1/tag/",
5753
+ Object.keys(params).length ? { params: { query: params } } : {}
5754
+ ),
5755
+ "Failed to fetch tags"
5756
+ );
5729
5757
  }
5730
5758
  async function createTag(arbi, options) {
5731
5759
  return requireData(
@@ -5735,8 +5763,8 @@ async function createTag(arbi, options) {
5735
5763
  tag_type: options.tagType ?? { type: "checkbox", options: [] },
5736
5764
  instruction: options.instruction ?? null,
5737
5765
  shared: options.shared ?? false,
5766
+ ...options.kind ? { kind: options.kind } : {},
5738
5767
  ...options.parentId ? { parent_ext_id: options.parentId } : {},
5739
- ...options.fields ? { fields: options.fields } : {},
5740
5768
  ...options.fieldValues ? { field_values: options.fieldValues } : {}
5741
5769
  }
5742
5770
  }),
@@ -5755,48 +5783,47 @@ async function updateTag(arbi, tagId, change) {
5755
5783
  return requireData(
5756
5784
  await arbi.fetch.PATCH("/v1/tag/{tag_ext_id}", {
5757
5785
  params: { path: { tag_ext_id: tagId } },
5758
- body: { kind_to_children: false, ...change }
5786
+ body: change
5759
5787
  }),
5760
5788
  "Failed to update tag"
5761
5789
  );
5762
5790
  }
5763
- async function updateTagFields(arbi, tagId, change) {
5764
- const body = {};
5765
- if (change.fields) body.fields = change.fields;
5766
- if (change.values) body.field_values = change.values;
5767
- return updateTag(arbi, tagId, body);
5791
+ async function setTagValues(arbi, tagId, values) {
5792
+ return updateTag(arbi, tagId, { field_values: values });
5768
5793
  }
5769
- async function getTagMatrix(arbi, selection, linksLimit) {
5770
- const query = "parentId" in selection ? { parent_ext_id: selection.parentId } : { tag_ext_id: selection.tagIds };
5771
- if (linksLimit !== void 0) query.links_limit = linksLimit;
5772
- return requireData(
5773
- await arbi.fetch.GET("/v1/tag/matrix", { params: { query } }),
5774
- "Failed to fetch the tag matrix"
5794
+ async function listTagKinds(arbi) {
5795
+ return requireData(await arbi.fetch.GET("/v1/tag/kinds"), "Failed to fetch tag kinds").map(
5796
+ withFields
5775
5797
  );
5776
5798
  }
5777
- function tagMatrixColumns(matrix) {
5778
- const columns = [];
5779
- const add = (f2) => {
5780
- if (!columns.some((c2) => c2.id === f2.id)) columns.push(f2);
5781
- };
5782
- for (const f2 of matrix.parent?.fields ?? []) add(f2);
5783
- for (const row of matrix.rows ?? []) for (const f2 of row.tag.fields ?? []) add(f2);
5784
- return columns;
5799
+ async function getTagKind(arbi, kind) {
5800
+ return withFields(
5801
+ requireData(
5802
+ await arbi.fetch.GET("/v1/tag/kinds/{kind}", { params: { path: { kind } } }),
5803
+ "Failed to fetch the tag kind"
5804
+ )
5805
+ );
5785
5806
  }
5786
- function ownTagFields(tag) {
5787
- return (tag.fields ?? []).filter((f2) => f2.tag_ext_id === tag.external_id);
5807
+ async function updateTagKind(arbi, kind, fields) {
5808
+ return withFields(
5809
+ requireData(
5810
+ await arbi.fetch.PUT("/v1/tag/kinds/{kind}", {
5811
+ params: { path: { kind } },
5812
+ body: { fields }
5813
+ }),
5814
+ "Failed to update the tag kind"
5815
+ )
5816
+ );
5788
5817
  }
5789
- function mergeTagFieldDefinitions(tag, wanted, { keepOthers = false } = {}) {
5790
- const own = ownTagFields(tag);
5791
- const byName = new Map(own.map((f2) => [f2.name.toLowerCase(), f2]));
5818
+ var kindFieldWrites = (fields) => fields.map((f2) => ({ id: f2.id, name: f2.name, type: f2.type, options: f2.options ?? null }));
5819
+ function mergeKindFieldDefinitions(current, wanted, { keepOthers = false } = {}) {
5820
+ const byName = new Map(current.map((f2) => [f2.name.toLowerCase(), f2]));
5792
5821
  const out = wanted.map((w2) => {
5793
5822
  const old = w2.id ? void 0 : byName.get(w2.name.trim().toLowerCase());
5794
5823
  return old ? { ...w2, id: old.id } : w2;
5795
5824
  });
5796
5825
  if (keepOthers) {
5797
- for (const f2 of own)
5798
- if (!out.some((w2) => w2.id === f2.id))
5799
- out.push({ id: f2.id, name: f2.name, type: f2.type, options: f2.options ?? null });
5826
+ for (const f2 of kindFieldWrites(current)) if (!out.some((w2) => w2.id === f2.id)) out.push(f2);
5800
5827
  }
5801
5828
  return out;
5802
5829
  }
@@ -7610,6 +7637,137 @@ async function remindFact(arbi, factId, options = {}) {
7610
7637
  );
7611
7638
  }
7612
7639
 
7640
+ // src/operations/mail.ts
7641
+ var mail_exports = {};
7642
+ __export(mail_exports, {
7643
+ NATIVE_ACCOUNT: () => NATIVE_ACCOUNT,
7644
+ attachmentFromBytes: () => attachmentFromBytes,
7645
+ claimNativeAlias: () => claimNativeAlias,
7646
+ createMailFetch: () => createMailFetch,
7647
+ downloadAttachment: () => downloadAttachment,
7648
+ getMailPolicy: () => getMailPolicy,
7649
+ getMessage: () => getMessage2,
7650
+ listFolders: () => listFolders,
7651
+ listMailAccounts: () => listMailAccounts,
7652
+ listMessages: () => listMessages,
7653
+ saveDraft: () => saveDraft,
7654
+ sendMessage: () => sendMessage,
7655
+ unlockNativeMail: () => unlockNativeMail,
7656
+ updateMessage: () => updateMessage
7657
+ });
7658
+ var NATIVE_ACCOUNT = "native";
7659
+ function createMailFetch(auth) {
7660
+ return (path4, init = {}) => authenticatedFetch({
7661
+ ...auth,
7662
+ path: `/v1/mail${path4}`,
7663
+ method: init.method,
7664
+ body: init.body,
7665
+ headers: {
7666
+ ...init.body ? { "Content-Type": "application/json" } : {},
7667
+ ...init.headers
7668
+ }
7669
+ });
7670
+ }
7671
+ async function json(response) {
7672
+ return (await response).json();
7673
+ }
7674
+ var accountPath = (accountId) => `/accounts/${encodeURIComponent(accountId)}`;
7675
+ function getMailPolicy(mail) {
7676
+ return json(mail("/policy"));
7677
+ }
7678
+ function listMailAccounts(mail) {
7679
+ return json(mail("/accounts"));
7680
+ }
7681
+ async function claimNativeAlias(mail, alias) {
7682
+ const { email } = await json(
7683
+ mail("/native/alias", { method: "POST", body: JSON.stringify({ alias }) })
7684
+ );
7685
+ return email;
7686
+ }
7687
+ function listFolders(mail, accountId = NATIVE_ACCOUNT) {
7688
+ return json(mail(`${accountPath(accountId)}/folders`));
7689
+ }
7690
+ function listMessages(mail, options) {
7691
+ const params = new URLSearchParams({ folder_id: options.folderId });
7692
+ if (options.query) params.set("q", options.query);
7693
+ if (options.cursor) params.set("cursor", options.cursor);
7694
+ if (options.limit) params.set("limit", String(options.limit));
7695
+ return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/messages?${params}`));
7696
+ }
7697
+ function getMessage2(mail, messageId, accountId = NATIVE_ACCOUNT) {
7698
+ return json(mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`));
7699
+ }
7700
+ async function downloadAttachment(mail, messageId, attachmentId, accountId = NATIVE_ACCOUNT) {
7701
+ const path4 = `${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachmentId)}`;
7702
+ return new Uint8Array(await (await mail(path4)).arrayBuffer());
7703
+ }
7704
+ async function updateMessage(mail, messageId, update, accountId = NATIVE_ACCOUNT) {
7705
+ await mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`, {
7706
+ method: "PATCH",
7707
+ body: JSON.stringify(update)
7708
+ });
7709
+ }
7710
+ function saveDraft(mail, compose, accountId = NATIVE_ACCOUNT) {
7711
+ return json(
7712
+ mail(`${accountPath(accountId)}/drafts`, { method: "POST", body: JSON.stringify(compose) })
7713
+ );
7714
+ }
7715
+ function sendMessage(mail, message, accountId = NATIVE_ACCOUNT) {
7716
+ const body = { ...message, request_id: message.request_id ?? crypto.randomUUID() };
7717
+ return json(
7718
+ mail(`${accountPath(accountId)}/send`, { method: "POST", body: JSON.stringify(body) })
7719
+ );
7720
+ }
7721
+ async function unlockNativeMail(mail, keys) {
7722
+ await initSodium();
7723
+ const secretKey = deriveEncryptionKeypairFromSigning({
7724
+ publicKey: keys.signingPrivateKey.slice(32, 64),
7725
+ secretKey: keys.signingPrivateKey
7726
+ }).secretKey;
7727
+ try {
7728
+ let cursor = 0;
7729
+ while (cursor !== null) {
7730
+ const page = await json(
7731
+ mail(`/native/keys?cursor=${cursor}`)
7732
+ );
7733
+ const sealed = {};
7734
+ for (const [id, wrapped] of Object.entries(page.keys)) {
7735
+ const key = sealedBoxDecrypt(wrapped, secretKey);
7736
+ try {
7737
+ sealed[id] = await sealKeyForSession(key, keys.serverSessionKey);
7738
+ } finally {
7739
+ key.fill(0);
7740
+ }
7741
+ }
7742
+ if (Object.keys(sealed).length) {
7743
+ await mail("/native/session-keys", {
7744
+ method: "POST",
7745
+ body: JSON.stringify({ keys: sealed })
7746
+ });
7747
+ }
7748
+ cursor = page.next_cursor;
7749
+ }
7750
+ } finally {
7751
+ secretKey.fill(0);
7752
+ }
7753
+ }
7754
+ function attachmentFromBytes(name, contentType, bytes) {
7755
+ return {
7756
+ id: "",
7757
+ name,
7758
+ content_type: contentType,
7759
+ size: bytes.length,
7760
+ content_base64: bytesToBase642(bytes)
7761
+ };
7762
+ }
7763
+ function bytesToBase642(bytes) {
7764
+ let binary = "";
7765
+ for (let i2 = 0; i2 < bytes.length; i2 += 32768) {
7766
+ binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
7767
+ }
7768
+ return btoa(binary);
7769
+ }
7770
+
7613
7771
  // src/arbi.ts
7614
7772
  function tokenExpiresWithin(token, seconds) {
7615
7773
  const payload = token?.split(".")[1];
@@ -8260,6 +8418,39 @@ var Arbi = class {
8260
8418
  return response;
8261
8419
  })
8262
8420
  };
8421
+ /**
8422
+ * Mail transport for `/v1/mail` (the native inbox and connected accounts), with normal session
8423
+ * recovery. Pass `fetch` to the `mail` operations, e.g. `mail.listFolders(arbi.mail.fetch)`.
8424
+ */
8425
+ mail = {
8426
+ /** Fetch a path under `/v1/mail`; rejects a non-2xx response with an `ArbiApiError` (`status`). */
8427
+ fetch: (path4, init = {}) => this.recovering(async () => {
8428
+ const { baseUrl, accessToken } = this.getAuthHeaders();
8429
+ const headers = new Headers(init.headers);
8430
+ headers.set("Authorization", `Bearer ${accessToken}`);
8431
+ if (init.body && !headers.has("Content-Type"))
8432
+ headers.set("Content-Type", "application/json");
8433
+ const response = await fetch(`${baseUrl}/v1/mail${path4}`, { ...init, headers });
8434
+ if (!response.ok) {
8435
+ const body = await response.json().catch(() => null);
8436
+ throw new ArbiApiError(
8437
+ typeof body?.detail === "string" ? body.detail : "The mail request could not be completed",
8438
+ body,
8439
+ response.status
8440
+ );
8441
+ }
8442
+ return response;
8443
+ }),
8444
+ /** Unlock the signed-in user's native inbox for this server session (see `unlockNativeMail`). */
8445
+ unlockNative: () => {
8446
+ const login = this.loginResult;
8447
+ if (!login) return Promise.reject(new ArbiError("Sign in to unlock your inbox"));
8448
+ return unlockNativeMail(this.mail.fetch, {
8449
+ signingPrivateKey: login.signingPrivateKey,
8450
+ serverSessionKey: login.serverSessionKey
8451
+ });
8452
+ }
8453
+ };
8263
8454
  // ── Assistant ─────────────────────────────────────────────────────────
8264
8455
  assistant = {
8265
8456
  cancelRun: (responseId) => this.recovering(() => cancelAssistantRun(this.getAuthHeaders(), responseId)),
@@ -8332,17 +8523,29 @@ var Arbi = class {
8332
8523
  };
8333
8524
  // ── Tags ──────────────────────────────────────────────────────────────
8334
8525
  tags = {
8335
- list: () => listTags(this.requireClient()),
8526
+ /**
8527
+ * The workspace's tags, filtered (`kind`, `parentId`, `ids`) and with `include: ['links']`
8528
+ * each tag's documents, facts and threads: `list({ kind: 'issue', include: ['links'] })` is the
8529
+ * issue table's rows (its columns: `tagKinds.get('issue')`).
8530
+ */
8531
+ list: (query) => listTags(this.requireClient(), query),
8336
8532
  create: (options) => createTag(this.requireClient(), {
8337
8533
  ...options,
8338
8534
  workspaceId: options.workspaceId ?? this.requireWorkspace()
8339
8535
  }),
8340
8536
  delete: (tagId) => deleteTag(this.requireClient(), tagId),
8341
8537
  update: (tagId, change) => updateTag(this.requireClient(), tagId, change),
8342
- /** Replace a tag's own field definitions and/or merge-patch its values (`null` clears one). */
8343
- updateFields: (tagId, change) => updateTagFields(this.requireClient(), tagId, change),
8344
- /** Tags as rows (a parent's children, or the given tags) with field values, docs and facts. */
8345
- matrix: (selection, linksLimit) => getTagMatrix(this.requireClient(), selection, linksLimit)
8538
+ /** Merge-patch a tag's values for its kind's fields (`null` clears one). */
8539
+ setValues: (tagId, values) => setTagValues(this.requireClient(), tagId, values)
8540
+ };
8541
+ // ── Tag kinds: the workspace's fields per kind (a table's columns) ─────
8542
+ tagKinds = {
8543
+ /** Every kind's fields (the built-in ones where the workspace has not set its own). */
8544
+ list: () => listTagKinds(this.requireClient()),
8545
+ /** A kind's fields: the columns of a table of its tags. */
8546
+ get: (kind) => getTagKind(this.requireClient(), kind),
8547
+ /** Set a kind's fields in full (ids keep fields and their values; the rest are new). */
8548
+ update: (kind, fields) => updateTagKind(this.requireClient(), kind, fields)
8346
8549
  };
8347
8550
  // ── Document Tags ─────────────────────────────────────────────────────
8348
8551
  doctags = {
@@ -9311,137 +9514,6 @@ async function uploadArchive(auth, archivePath, options) {
9311
9514
  }
9312
9515
  }
9313
9516
 
9314
- // src/operations/mail.ts
9315
- var mail_exports = {};
9316
- __export(mail_exports, {
9317
- NATIVE_ACCOUNT: () => NATIVE_ACCOUNT,
9318
- attachmentFromBytes: () => attachmentFromBytes,
9319
- claimNativeAlias: () => claimNativeAlias,
9320
- createMailFetch: () => createMailFetch,
9321
- downloadAttachment: () => downloadAttachment,
9322
- getMailPolicy: () => getMailPolicy,
9323
- getMessage: () => getMessage2,
9324
- listFolders: () => listFolders,
9325
- listMailAccounts: () => listMailAccounts,
9326
- listMessages: () => listMessages,
9327
- saveDraft: () => saveDraft,
9328
- sendMessage: () => sendMessage,
9329
- unlockNativeMail: () => unlockNativeMail,
9330
- updateMessage: () => updateMessage
9331
- });
9332
- var NATIVE_ACCOUNT = "native";
9333
- function createMailFetch(auth) {
9334
- return (path4, init = {}) => authenticatedFetch({
9335
- ...auth,
9336
- path: `/v1/mail${path4}`,
9337
- method: init.method,
9338
- body: init.body,
9339
- headers: {
9340
- ...init.body ? { "Content-Type": "application/json" } : {},
9341
- ...init.headers
9342
- }
9343
- });
9344
- }
9345
- async function json(response) {
9346
- return (await response).json();
9347
- }
9348
- var accountPath = (accountId) => `/accounts/${encodeURIComponent(accountId)}`;
9349
- function getMailPolicy(mail) {
9350
- return json(mail("/policy"));
9351
- }
9352
- function listMailAccounts(mail) {
9353
- return json(mail("/accounts"));
9354
- }
9355
- async function claimNativeAlias(mail, alias) {
9356
- const { email } = await json(
9357
- mail("/native/alias", { method: "POST", body: JSON.stringify({ alias }) })
9358
- );
9359
- return email;
9360
- }
9361
- function listFolders(mail, accountId = NATIVE_ACCOUNT) {
9362
- return json(mail(`${accountPath(accountId)}/folders`));
9363
- }
9364
- function listMessages(mail, options) {
9365
- const params = new URLSearchParams({ folder_id: options.folderId });
9366
- if (options.query) params.set("q", options.query);
9367
- if (options.cursor) params.set("cursor", options.cursor);
9368
- if (options.limit) params.set("limit", String(options.limit));
9369
- return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/messages?${params}`));
9370
- }
9371
- function getMessage2(mail, messageId, accountId = NATIVE_ACCOUNT) {
9372
- return json(mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`));
9373
- }
9374
- async function downloadAttachment(mail, messageId, attachmentId, accountId = NATIVE_ACCOUNT) {
9375
- const path4 = `${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachmentId)}`;
9376
- return new Uint8Array(await (await mail(path4)).arrayBuffer());
9377
- }
9378
- async function updateMessage(mail, messageId, update, accountId = NATIVE_ACCOUNT) {
9379
- await mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`, {
9380
- method: "PATCH",
9381
- body: JSON.stringify(update)
9382
- });
9383
- }
9384
- function saveDraft(mail, compose, accountId = NATIVE_ACCOUNT) {
9385
- return json(
9386
- mail(`${accountPath(accountId)}/drafts`, { method: "POST", body: JSON.stringify(compose) })
9387
- );
9388
- }
9389
- function sendMessage(mail, message, accountId = NATIVE_ACCOUNT) {
9390
- const body = { ...message, request_id: message.request_id ?? crypto.randomUUID() };
9391
- return json(
9392
- mail(`${accountPath(accountId)}/send`, { method: "POST", body: JSON.stringify(body) })
9393
- );
9394
- }
9395
- async function unlockNativeMail(mail, keys) {
9396
- await initSodium();
9397
- const secretKey = deriveEncryptionKeypairFromSigning({
9398
- publicKey: keys.signingPrivateKey.slice(32, 64),
9399
- secretKey: keys.signingPrivateKey
9400
- }).secretKey;
9401
- try {
9402
- let cursor = 0;
9403
- while (cursor !== null) {
9404
- const page = await json(
9405
- mail(`/native/keys?cursor=${cursor}`)
9406
- );
9407
- const sealed = {};
9408
- for (const [id, wrapped] of Object.entries(page.keys)) {
9409
- const key = sealedBoxDecrypt(wrapped, secretKey);
9410
- try {
9411
- sealed[id] = await sealKeyForSession(key, keys.serverSessionKey);
9412
- } finally {
9413
- key.fill(0);
9414
- }
9415
- }
9416
- if (Object.keys(sealed).length) {
9417
- await mail("/native/session-keys", {
9418
- method: "POST",
9419
- body: JSON.stringify({ keys: sealed })
9420
- });
9421
- }
9422
- cursor = page.next_cursor;
9423
- }
9424
- } finally {
9425
- secretKey.fill(0);
9426
- }
9427
- }
9428
- function attachmentFromBytes(name, contentType, bytes) {
9429
- return {
9430
- id: "",
9431
- name,
9432
- content_type: contentType,
9433
- size: bytes.length,
9434
- content_base64: bytesToBase642(bytes)
9435
- };
9436
- }
9437
- function bytesToBase642(bytes) {
9438
- let binary = "";
9439
- for (let i2 = 0; i2 < bytes.length; i2 += 32768) {
9440
- binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
9441
- }
9442
- return btoa(binary);
9443
- }
9444
-
9445
9517
  // src/operations/mail-node.ts
9446
9518
  var mail_node_exports = {};
9447
9519
  __export(mail_node_exports, {