@arbidocs/sdk 0.4.83 → 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/{browser-uyIwS2cN.d.cts → browser-BOIk_RaR.d.cts} +247 -112
- package/dist/{browser-uyIwS2cN.d.ts → browser-BOIk_RaR.d.ts} +247 -112
- package/dist/browser.cjs +244 -172
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +244 -172
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +244 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +244 -172
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/browser.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, x as CreateFactRequest, y as CreateFactsRequest, z as CreateWorkRequest, B as CreateWorkflowRequest, E as DecryptedDmNotification, F as DeferredInterjectionEvent, G as DmAttachmentFile, H as DmAttachmentInput, K as DocumentAutomationAction, N as DocumentSelector, Q as FactResponse, R as FactSearchRequest, S as FactSearchResponse, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, _ as ListFactsOptions, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, a9 as ProbeAnswerEvent, 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, 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
|
|
1
|
+
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, x as CreateFactRequest, y as CreateFactsRequest, z as CreateWorkRequest, B as CreateWorkflowRequest, E as DecryptedDmNotification, F as DeferredInterjectionEvent, G as DmAttachmentFile, H as DmAttachmentInput, K as DocumentAutomationAction, N as DocumentSelector, Q as FactResponse, R as FactSearchRequest, S as FactSearchResponse, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, _ as ListFactsOptions, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, a9 as ProbeAnswerEvent, 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, 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, b4 as UpdateFactRequest, 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, br as assistant, bs as authenticatedFetch, 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, 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, bQ as formatUserName, bR as formatWorkspaceChoices, 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, 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';
|
|
2
2
|
export { LoginProfile } from '@arbidocs/client';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, x as CreateFactRequest, y as CreateFactsRequest, z as CreateWorkRequest, B as CreateWorkflowRequest, E as DecryptedDmNotification, F as DeferredInterjectionEvent, G as DmAttachmentFile, H as DmAttachmentInput, K as DocumentAutomationAction, N as DocumentSelector, Q as FactResponse, R as FactSearchRequest, S as FactSearchResponse, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, _ as ListFactsOptions, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, a9 as ProbeAnswerEvent, 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, 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
|
|
1
|
+
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as ConversationUsageResponse, x as CreateFactRequest, y as CreateFactsRequest, z as CreateWorkRequest, B as CreateWorkflowRequest, E as DecryptedDmNotification, F as DeferredInterjectionEvent, G as DmAttachmentFile, H as DmAttachmentInput, K as DocumentAutomationAction, N as DocumentSelector, Q as FactResponse, R as FactSearchRequest, S as FactSearchResponse, U as IdentityErrorCode, V as IdentityPurchase, W as IdentityState, X as IdentityStatus, Y as LinkedRun, _ as ListFactsOptions, a2 as MessageMetadataPayload, a3 as MessageQueuedEvent, a4 as OutputTokensDetails, a5 as ParsedSlashCommand, a6 as PendingAuthResponse, a7 as PlanStepsError, a8 as PlanWorkRequest, a9 as ProbeAnswerEvent, 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, 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, b4 as UpdateFactRequest, 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, br as assistant, bs as authenticatedFetch, 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, 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, bQ as formatUserName, bR as formatWorkspaceChoices, 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, 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';
|
|
2
2
|
export { LoginProfile } from '@arbidocs/client';
|
package/dist/browser.js
CHANGED
|
@@ -5162,17 +5162,33 @@ function extractResponseText(response) {
|
|
|
5162
5162
|
// src/operations/tags.ts
|
|
5163
5163
|
var tags_exports = {};
|
|
5164
5164
|
__export(tags_exports, {
|
|
5165
|
+
FLAT_TAG_KINDS: () => FLAT_TAG_KINDS,
|
|
5165
5166
|
TAG_FIELD_TYPES: () => TAG_FIELD_TYPES,
|
|
5167
|
+
TAG_KINDS: () => TAG_KINDS,
|
|
5166
5168
|
createTag: () => createTag,
|
|
5167
5169
|
deleteTag: () => deleteTag,
|
|
5168
|
-
|
|
5170
|
+
getTagKind: () => getTagKind,
|
|
5171
|
+
kindFieldWrites: () => kindFieldWrites,
|
|
5172
|
+
listTagKinds: () => listTagKinds,
|
|
5169
5173
|
listTags: () => listTags,
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
tagMatrixColumns: () => tagMatrixColumns,
|
|
5174
|
+
mergeKindFieldDefinitions: () => mergeKindFieldDefinitions,
|
|
5175
|
+
setTagValues: () => setTagValues,
|
|
5173
5176
|
updateTag: () => updateTag,
|
|
5174
|
-
|
|
5177
|
+
updateTagKind: () => updateTagKind
|
|
5175
5178
|
});
|
|
5179
|
+
var withFields = (schema) => ({
|
|
5180
|
+
...schema,
|
|
5181
|
+
fields: schema.fields ?? []
|
|
5182
|
+
});
|
|
5183
|
+
var TAG_KINDS = [
|
|
5184
|
+
"label",
|
|
5185
|
+
"annotation",
|
|
5186
|
+
"issue",
|
|
5187
|
+
"person",
|
|
5188
|
+
"organisation",
|
|
5189
|
+
"search"
|
|
5190
|
+
];
|
|
5191
|
+
var FLAT_TAG_KINDS = ["issue", "person", "organisation"];
|
|
5176
5192
|
var TAG_FIELD_TYPES = [
|
|
5177
5193
|
"text",
|
|
5178
5194
|
"number",
|
|
@@ -5181,8 +5197,20 @@ var TAG_FIELD_TYPES = [
|
|
|
5181
5197
|
"select",
|
|
5182
5198
|
"person"
|
|
5183
5199
|
];
|
|
5184
|
-
async function listTags(arbi) {
|
|
5185
|
-
|
|
5200
|
+
async function listTags(arbi, query = {}) {
|
|
5201
|
+
const params = {};
|
|
5202
|
+
if (query.kind) params.kind = query.kind;
|
|
5203
|
+
if (query.parentId) params.parent = query.parentId;
|
|
5204
|
+
if (query.ids?.length) params.ids = query.ids;
|
|
5205
|
+
if (query.include?.length) params.include = query.include;
|
|
5206
|
+
if (query.linksLimit !== void 0) params.links_limit = query.linksLimit;
|
|
5207
|
+
return requireData(
|
|
5208
|
+
await arbi.fetch.GET(
|
|
5209
|
+
"/v1/tag/",
|
|
5210
|
+
Object.keys(params).length ? { params: { query: params } } : {}
|
|
5211
|
+
),
|
|
5212
|
+
"Failed to fetch tags"
|
|
5213
|
+
);
|
|
5186
5214
|
}
|
|
5187
5215
|
async function createTag(arbi, options) {
|
|
5188
5216
|
return requireData(
|
|
@@ -5192,8 +5220,8 @@ async function createTag(arbi, options) {
|
|
|
5192
5220
|
tag_type: options.tagType ?? { type: "checkbox", options: [] },
|
|
5193
5221
|
instruction: options.instruction ?? null,
|
|
5194
5222
|
shared: options.shared ?? false,
|
|
5223
|
+
...options.kind ? { kind: options.kind } : {},
|
|
5195
5224
|
...options.parentId ? { parent_ext_id: options.parentId } : {},
|
|
5196
|
-
...options.fields ? { fields: options.fields } : {},
|
|
5197
5225
|
...options.fieldValues ? { field_values: options.fieldValues } : {}
|
|
5198
5226
|
}
|
|
5199
5227
|
}),
|
|
@@ -5212,48 +5240,47 @@ async function updateTag(arbi, tagId, change) {
|
|
|
5212
5240
|
return requireData(
|
|
5213
5241
|
await arbi.fetch.PATCH("/v1/tag/{tag_ext_id}", {
|
|
5214
5242
|
params: { path: { tag_ext_id: tagId } },
|
|
5215
|
-
body:
|
|
5243
|
+
body: change
|
|
5216
5244
|
}),
|
|
5217
5245
|
"Failed to update tag"
|
|
5218
5246
|
);
|
|
5219
5247
|
}
|
|
5220
|
-
async function
|
|
5221
|
-
|
|
5222
|
-
if (change.fields) body.fields = change.fields;
|
|
5223
|
-
if (change.values) body.field_values = change.values;
|
|
5224
|
-
return updateTag(arbi, tagId, body);
|
|
5248
|
+
async function setTagValues(arbi, tagId, values) {
|
|
5249
|
+
return updateTag(arbi, tagId, { field_values: values });
|
|
5225
5250
|
}
|
|
5226
|
-
async function
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
return requireData(
|
|
5230
|
-
await arbi.fetch.GET("/v1/tag/matrix", { params: { query } }),
|
|
5231
|
-
"Failed to fetch the tag matrix"
|
|
5251
|
+
async function listTagKinds(arbi) {
|
|
5252
|
+
return requireData(await arbi.fetch.GET("/v1/tag/kinds"), "Failed to fetch tag kinds").map(
|
|
5253
|
+
withFields
|
|
5232
5254
|
);
|
|
5233
5255
|
}
|
|
5234
|
-
function
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
return columns;
|
|
5256
|
+
async function getTagKind(arbi, kind) {
|
|
5257
|
+
return withFields(
|
|
5258
|
+
requireData(
|
|
5259
|
+
await arbi.fetch.GET("/v1/tag/kinds/{kind}", { params: { path: { kind } } }),
|
|
5260
|
+
"Failed to fetch the tag kind"
|
|
5261
|
+
)
|
|
5262
|
+
);
|
|
5242
5263
|
}
|
|
5243
|
-
function
|
|
5244
|
-
return (
|
|
5264
|
+
async function updateTagKind(arbi, kind, fields) {
|
|
5265
|
+
return withFields(
|
|
5266
|
+
requireData(
|
|
5267
|
+
await arbi.fetch.PUT("/v1/tag/kinds/{kind}", {
|
|
5268
|
+
params: { path: { kind } },
|
|
5269
|
+
body: { fields }
|
|
5270
|
+
}),
|
|
5271
|
+
"Failed to update the tag kind"
|
|
5272
|
+
)
|
|
5273
|
+
);
|
|
5245
5274
|
}
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
const byName = new Map(
|
|
5275
|
+
var kindFieldWrites = (fields) => fields.map((f2) => ({ id: f2.id, name: f2.name, type: f2.type, options: f2.options ?? null }));
|
|
5276
|
+
function mergeKindFieldDefinitions(current, wanted, { keepOthers = false } = {}) {
|
|
5277
|
+
const byName = new Map(current.map((f2) => [f2.name.toLowerCase(), f2]));
|
|
5249
5278
|
const out = wanted.map((w2) => {
|
|
5250
5279
|
const old = w2.id ? void 0 : byName.get(w2.name.trim().toLowerCase());
|
|
5251
5280
|
return old ? { ...w2, id: old.id } : w2;
|
|
5252
5281
|
});
|
|
5253
5282
|
if (keepOthers) {
|
|
5254
|
-
for (const f2 of
|
|
5255
|
-
if (!out.some((w2) => w2.id === f2.id))
|
|
5256
|
-
out.push({ id: f2.id, name: f2.name, type: f2.type, options: f2.options ?? null });
|
|
5283
|
+
for (const f2 of kindFieldWrites(current)) if (!out.some((w2) => w2.id === f2.id)) out.push(f2);
|
|
5257
5284
|
}
|
|
5258
5285
|
return out;
|
|
5259
5286
|
}
|
|
@@ -7052,6 +7079,137 @@ async function remindFact(arbi, factId, options = {}) {
|
|
|
7052
7079
|
);
|
|
7053
7080
|
}
|
|
7054
7081
|
|
|
7082
|
+
// src/operations/mail.ts
|
|
7083
|
+
var mail_exports = {};
|
|
7084
|
+
__export(mail_exports, {
|
|
7085
|
+
NATIVE_ACCOUNT: () => NATIVE_ACCOUNT,
|
|
7086
|
+
attachmentFromBytes: () => attachmentFromBytes,
|
|
7087
|
+
claimNativeAlias: () => claimNativeAlias,
|
|
7088
|
+
createMailFetch: () => createMailFetch,
|
|
7089
|
+
downloadAttachment: () => downloadAttachment,
|
|
7090
|
+
getMailPolicy: () => getMailPolicy,
|
|
7091
|
+
getMessage: () => getMessage2,
|
|
7092
|
+
listFolders: () => listFolders,
|
|
7093
|
+
listMailAccounts: () => listMailAccounts,
|
|
7094
|
+
listMessages: () => listMessages,
|
|
7095
|
+
saveDraft: () => saveDraft,
|
|
7096
|
+
sendMessage: () => sendMessage,
|
|
7097
|
+
unlockNativeMail: () => unlockNativeMail,
|
|
7098
|
+
updateMessage: () => updateMessage
|
|
7099
|
+
});
|
|
7100
|
+
var NATIVE_ACCOUNT = "native";
|
|
7101
|
+
function createMailFetch(auth) {
|
|
7102
|
+
return (path, init = {}) => authenticatedFetch({
|
|
7103
|
+
...auth,
|
|
7104
|
+
path: `/v1/mail${path}`,
|
|
7105
|
+
method: init.method,
|
|
7106
|
+
body: init.body,
|
|
7107
|
+
headers: {
|
|
7108
|
+
...init.body ? { "Content-Type": "application/json" } : {},
|
|
7109
|
+
...init.headers
|
|
7110
|
+
}
|
|
7111
|
+
});
|
|
7112
|
+
}
|
|
7113
|
+
async function json(response) {
|
|
7114
|
+
return (await response).json();
|
|
7115
|
+
}
|
|
7116
|
+
var accountPath = (accountId) => `/accounts/${encodeURIComponent(accountId)}`;
|
|
7117
|
+
function getMailPolicy(mail) {
|
|
7118
|
+
return json(mail("/policy"));
|
|
7119
|
+
}
|
|
7120
|
+
function listMailAccounts(mail) {
|
|
7121
|
+
return json(mail("/accounts"));
|
|
7122
|
+
}
|
|
7123
|
+
async function claimNativeAlias(mail, alias) {
|
|
7124
|
+
const { email } = await json(
|
|
7125
|
+
mail("/native/alias", { method: "POST", body: JSON.stringify({ alias }) })
|
|
7126
|
+
);
|
|
7127
|
+
return email;
|
|
7128
|
+
}
|
|
7129
|
+
function listFolders(mail, accountId = NATIVE_ACCOUNT) {
|
|
7130
|
+
return json(mail(`${accountPath(accountId)}/folders`));
|
|
7131
|
+
}
|
|
7132
|
+
function listMessages(mail, options) {
|
|
7133
|
+
const params = new URLSearchParams({ folder_id: options.folderId });
|
|
7134
|
+
if (options.query) params.set("q", options.query);
|
|
7135
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
7136
|
+
if (options.limit) params.set("limit", String(options.limit));
|
|
7137
|
+
return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/messages?${params}`));
|
|
7138
|
+
}
|
|
7139
|
+
function getMessage2(mail, messageId, accountId = NATIVE_ACCOUNT) {
|
|
7140
|
+
return json(mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`));
|
|
7141
|
+
}
|
|
7142
|
+
async function downloadAttachment(mail, messageId, attachmentId, accountId = NATIVE_ACCOUNT) {
|
|
7143
|
+
const path = `${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachmentId)}`;
|
|
7144
|
+
return new Uint8Array(await (await mail(path)).arrayBuffer());
|
|
7145
|
+
}
|
|
7146
|
+
async function updateMessage(mail, messageId, update, accountId = NATIVE_ACCOUNT) {
|
|
7147
|
+
await mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`, {
|
|
7148
|
+
method: "PATCH",
|
|
7149
|
+
body: JSON.stringify(update)
|
|
7150
|
+
});
|
|
7151
|
+
}
|
|
7152
|
+
function saveDraft(mail, compose, accountId = NATIVE_ACCOUNT) {
|
|
7153
|
+
return json(
|
|
7154
|
+
mail(`${accountPath(accountId)}/drafts`, { method: "POST", body: JSON.stringify(compose) })
|
|
7155
|
+
);
|
|
7156
|
+
}
|
|
7157
|
+
function sendMessage(mail, message, accountId = NATIVE_ACCOUNT) {
|
|
7158
|
+
const body = { ...message, request_id: message.request_id ?? crypto.randomUUID() };
|
|
7159
|
+
return json(
|
|
7160
|
+
mail(`${accountPath(accountId)}/send`, { method: "POST", body: JSON.stringify(body) })
|
|
7161
|
+
);
|
|
7162
|
+
}
|
|
7163
|
+
async function unlockNativeMail(mail, keys) {
|
|
7164
|
+
await initSodium();
|
|
7165
|
+
const secretKey = deriveEncryptionKeypairFromSigning({
|
|
7166
|
+
publicKey: keys.signingPrivateKey.slice(32, 64),
|
|
7167
|
+
secretKey: keys.signingPrivateKey
|
|
7168
|
+
}).secretKey;
|
|
7169
|
+
try {
|
|
7170
|
+
let cursor = 0;
|
|
7171
|
+
while (cursor !== null) {
|
|
7172
|
+
const page = await json(
|
|
7173
|
+
mail(`/native/keys?cursor=${cursor}`)
|
|
7174
|
+
);
|
|
7175
|
+
const sealed = {};
|
|
7176
|
+
for (const [id, wrapped] of Object.entries(page.keys)) {
|
|
7177
|
+
const key = sealedBoxDecrypt(wrapped, secretKey);
|
|
7178
|
+
try {
|
|
7179
|
+
sealed[id] = await sealKeyForSession(key, keys.serverSessionKey);
|
|
7180
|
+
} finally {
|
|
7181
|
+
key.fill(0);
|
|
7182
|
+
}
|
|
7183
|
+
}
|
|
7184
|
+
if (Object.keys(sealed).length) {
|
|
7185
|
+
await mail("/native/session-keys", {
|
|
7186
|
+
method: "POST",
|
|
7187
|
+
body: JSON.stringify({ keys: sealed })
|
|
7188
|
+
});
|
|
7189
|
+
}
|
|
7190
|
+
cursor = page.next_cursor;
|
|
7191
|
+
}
|
|
7192
|
+
} finally {
|
|
7193
|
+
secretKey.fill(0);
|
|
7194
|
+
}
|
|
7195
|
+
}
|
|
7196
|
+
function attachmentFromBytes(name, contentType, bytes) {
|
|
7197
|
+
return {
|
|
7198
|
+
id: "",
|
|
7199
|
+
name,
|
|
7200
|
+
content_type: contentType,
|
|
7201
|
+
size: bytes.length,
|
|
7202
|
+
content_base64: bytesToBase642(bytes)
|
|
7203
|
+
};
|
|
7204
|
+
}
|
|
7205
|
+
function bytesToBase642(bytes) {
|
|
7206
|
+
let binary = "";
|
|
7207
|
+
for (let i2 = 0; i2 < bytes.length; i2 += 32768) {
|
|
7208
|
+
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
7209
|
+
}
|
|
7210
|
+
return btoa(binary);
|
|
7211
|
+
}
|
|
7212
|
+
|
|
7055
7213
|
// src/arbi.ts
|
|
7056
7214
|
function tokenExpiresWithin(token, seconds) {
|
|
7057
7215
|
const payload = token?.split(".")[1];
|
|
@@ -7702,6 +7860,39 @@ var Arbi = class {
|
|
|
7702
7860
|
return response;
|
|
7703
7861
|
})
|
|
7704
7862
|
};
|
|
7863
|
+
/**
|
|
7864
|
+
* Mail transport for `/v1/mail` (the native inbox and connected accounts), with normal session
|
|
7865
|
+
* recovery. Pass `fetch` to the `mail` operations, e.g. `mail.listFolders(arbi.mail.fetch)`.
|
|
7866
|
+
*/
|
|
7867
|
+
mail = {
|
|
7868
|
+
/** Fetch a path under `/v1/mail`; rejects a non-2xx response with an `ArbiApiError` (`status`). */
|
|
7869
|
+
fetch: (path, init = {}) => this.recovering(async () => {
|
|
7870
|
+
const { baseUrl, accessToken } = this.getAuthHeaders();
|
|
7871
|
+
const headers = new Headers(init.headers);
|
|
7872
|
+
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
7873
|
+
if (init.body && !headers.has("Content-Type"))
|
|
7874
|
+
headers.set("Content-Type", "application/json");
|
|
7875
|
+
const response = await fetch(`${baseUrl}/v1/mail${path}`, { ...init, headers });
|
|
7876
|
+
if (!response.ok) {
|
|
7877
|
+
const body = await response.json().catch(() => null);
|
|
7878
|
+
throw new ArbiApiError(
|
|
7879
|
+
typeof body?.detail === "string" ? body.detail : "The mail request could not be completed",
|
|
7880
|
+
body,
|
|
7881
|
+
response.status
|
|
7882
|
+
);
|
|
7883
|
+
}
|
|
7884
|
+
return response;
|
|
7885
|
+
}),
|
|
7886
|
+
/** Unlock the signed-in user's native inbox for this server session (see `unlockNativeMail`). */
|
|
7887
|
+
unlockNative: () => {
|
|
7888
|
+
const login = this.loginResult;
|
|
7889
|
+
if (!login) return Promise.reject(new ArbiError("Sign in to unlock your inbox"));
|
|
7890
|
+
return unlockNativeMail(this.mail.fetch, {
|
|
7891
|
+
signingPrivateKey: login.signingPrivateKey,
|
|
7892
|
+
serverSessionKey: login.serverSessionKey
|
|
7893
|
+
});
|
|
7894
|
+
}
|
|
7895
|
+
};
|
|
7705
7896
|
// ── Assistant ─────────────────────────────────────────────────────────
|
|
7706
7897
|
assistant = {
|
|
7707
7898
|
cancelRun: (responseId) => this.recovering(() => cancelAssistantRun(this.getAuthHeaders(), responseId)),
|
|
@@ -7774,17 +7965,29 @@ var Arbi = class {
|
|
|
7774
7965
|
};
|
|
7775
7966
|
// ── Tags ──────────────────────────────────────────────────────────────
|
|
7776
7967
|
tags = {
|
|
7777
|
-
|
|
7968
|
+
/**
|
|
7969
|
+
* The workspace's tags, filtered (`kind`, `parentId`, `ids`) and with `include: ['links']`
|
|
7970
|
+
* each tag's documents, facts and threads: `list({ kind: 'issue', include: ['links'] })` is the
|
|
7971
|
+
* issue table's rows (its columns: `tagKinds.get('issue')`).
|
|
7972
|
+
*/
|
|
7973
|
+
list: (query) => listTags(this.requireClient(), query),
|
|
7778
7974
|
create: (options) => createTag(this.requireClient(), {
|
|
7779
7975
|
...options,
|
|
7780
7976
|
workspaceId: options.workspaceId ?? this.requireWorkspace()
|
|
7781
7977
|
}),
|
|
7782
7978
|
delete: (tagId) => deleteTag(this.requireClient(), tagId),
|
|
7783
7979
|
update: (tagId, change) => updateTag(this.requireClient(), tagId, change),
|
|
7784
|
-
/**
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7980
|
+
/** Merge-patch a tag's values for its kind's fields (`null` clears one). */
|
|
7981
|
+
setValues: (tagId, values) => setTagValues(this.requireClient(), tagId, values)
|
|
7982
|
+
};
|
|
7983
|
+
// ── Tag kinds: the workspace's fields per kind (a table's columns) ─────
|
|
7984
|
+
tagKinds = {
|
|
7985
|
+
/** Every kind's fields (the built-in ones where the workspace has not set its own). */
|
|
7986
|
+
list: () => listTagKinds(this.requireClient()),
|
|
7987
|
+
/** A kind's fields: the columns of a table of its tags. */
|
|
7988
|
+
get: (kind) => getTagKind(this.requireClient(), kind),
|
|
7989
|
+
/** Set a kind's fields in full (ids keep fields and their values; the rest are new). */
|
|
7990
|
+
update: (kind, fields) => updateTagKind(this.requireClient(), kind, fields)
|
|
7788
7991
|
};
|
|
7789
7992
|
// ── Document Tags ─────────────────────────────────────────────────────
|
|
7790
7993
|
doctags = {
|
|
@@ -8008,137 +8211,6 @@ var Arbi = class {
|
|
|
8008
8211
|
}
|
|
8009
8212
|
};
|
|
8010
8213
|
|
|
8011
|
-
// src/operations/mail.ts
|
|
8012
|
-
var mail_exports = {};
|
|
8013
|
-
__export(mail_exports, {
|
|
8014
|
-
NATIVE_ACCOUNT: () => NATIVE_ACCOUNT,
|
|
8015
|
-
attachmentFromBytes: () => attachmentFromBytes,
|
|
8016
|
-
claimNativeAlias: () => claimNativeAlias,
|
|
8017
|
-
createMailFetch: () => createMailFetch,
|
|
8018
|
-
downloadAttachment: () => downloadAttachment,
|
|
8019
|
-
getMailPolicy: () => getMailPolicy,
|
|
8020
|
-
getMessage: () => getMessage2,
|
|
8021
|
-
listFolders: () => listFolders,
|
|
8022
|
-
listMailAccounts: () => listMailAccounts,
|
|
8023
|
-
listMessages: () => listMessages,
|
|
8024
|
-
saveDraft: () => saveDraft,
|
|
8025
|
-
sendMessage: () => sendMessage,
|
|
8026
|
-
unlockNativeMail: () => unlockNativeMail,
|
|
8027
|
-
updateMessage: () => updateMessage
|
|
8028
|
-
});
|
|
8029
|
-
var NATIVE_ACCOUNT = "native";
|
|
8030
|
-
function createMailFetch(auth) {
|
|
8031
|
-
return (path, init = {}) => authenticatedFetch({
|
|
8032
|
-
...auth,
|
|
8033
|
-
path: `/v1/mail${path}`,
|
|
8034
|
-
method: init.method,
|
|
8035
|
-
body: init.body,
|
|
8036
|
-
headers: {
|
|
8037
|
-
...init.body ? { "Content-Type": "application/json" } : {},
|
|
8038
|
-
...init.headers
|
|
8039
|
-
}
|
|
8040
|
-
});
|
|
8041
|
-
}
|
|
8042
|
-
async function json(response) {
|
|
8043
|
-
return (await response).json();
|
|
8044
|
-
}
|
|
8045
|
-
var accountPath = (accountId) => `/accounts/${encodeURIComponent(accountId)}`;
|
|
8046
|
-
function getMailPolicy(mail) {
|
|
8047
|
-
return json(mail("/policy"));
|
|
8048
|
-
}
|
|
8049
|
-
function listMailAccounts(mail) {
|
|
8050
|
-
return json(mail("/accounts"));
|
|
8051
|
-
}
|
|
8052
|
-
async function claimNativeAlias(mail, alias) {
|
|
8053
|
-
const { email } = await json(
|
|
8054
|
-
mail("/native/alias", { method: "POST", body: JSON.stringify({ alias }) })
|
|
8055
|
-
);
|
|
8056
|
-
return email;
|
|
8057
|
-
}
|
|
8058
|
-
function listFolders(mail, accountId = NATIVE_ACCOUNT) {
|
|
8059
|
-
return json(mail(`${accountPath(accountId)}/folders`));
|
|
8060
|
-
}
|
|
8061
|
-
function listMessages(mail, options) {
|
|
8062
|
-
const params = new URLSearchParams({ folder_id: options.folderId });
|
|
8063
|
-
if (options.query) params.set("q", options.query);
|
|
8064
|
-
if (options.cursor) params.set("cursor", options.cursor);
|
|
8065
|
-
if (options.limit) params.set("limit", String(options.limit));
|
|
8066
|
-
return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/messages?${params}`));
|
|
8067
|
-
}
|
|
8068
|
-
function getMessage2(mail, messageId, accountId = NATIVE_ACCOUNT) {
|
|
8069
|
-
return json(mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`));
|
|
8070
|
-
}
|
|
8071
|
-
async function downloadAttachment(mail, messageId, attachmentId, accountId = NATIVE_ACCOUNT) {
|
|
8072
|
-
const path = `${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachmentId)}`;
|
|
8073
|
-
return new Uint8Array(await (await mail(path)).arrayBuffer());
|
|
8074
|
-
}
|
|
8075
|
-
async function updateMessage(mail, messageId, update, accountId = NATIVE_ACCOUNT) {
|
|
8076
|
-
await mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`, {
|
|
8077
|
-
method: "PATCH",
|
|
8078
|
-
body: JSON.stringify(update)
|
|
8079
|
-
});
|
|
8080
|
-
}
|
|
8081
|
-
function saveDraft(mail, compose, accountId = NATIVE_ACCOUNT) {
|
|
8082
|
-
return json(
|
|
8083
|
-
mail(`${accountPath(accountId)}/drafts`, { method: "POST", body: JSON.stringify(compose) })
|
|
8084
|
-
);
|
|
8085
|
-
}
|
|
8086
|
-
function sendMessage(mail, message, accountId = NATIVE_ACCOUNT) {
|
|
8087
|
-
const body = { ...message, request_id: message.request_id ?? crypto.randomUUID() };
|
|
8088
|
-
return json(
|
|
8089
|
-
mail(`${accountPath(accountId)}/send`, { method: "POST", body: JSON.stringify(body) })
|
|
8090
|
-
);
|
|
8091
|
-
}
|
|
8092
|
-
async function unlockNativeMail(mail, keys) {
|
|
8093
|
-
await initSodium();
|
|
8094
|
-
const secretKey = deriveEncryptionKeypairFromSigning({
|
|
8095
|
-
publicKey: keys.signingPrivateKey.slice(32, 64),
|
|
8096
|
-
secretKey: keys.signingPrivateKey
|
|
8097
|
-
}).secretKey;
|
|
8098
|
-
try {
|
|
8099
|
-
let cursor = 0;
|
|
8100
|
-
while (cursor !== null) {
|
|
8101
|
-
const page = await json(
|
|
8102
|
-
mail(`/native/keys?cursor=${cursor}`)
|
|
8103
|
-
);
|
|
8104
|
-
const sealed = {};
|
|
8105
|
-
for (const [id, wrapped] of Object.entries(page.keys)) {
|
|
8106
|
-
const key = sealedBoxDecrypt(wrapped, secretKey);
|
|
8107
|
-
try {
|
|
8108
|
-
sealed[id] = await sealKeyForSession(key, keys.serverSessionKey);
|
|
8109
|
-
} finally {
|
|
8110
|
-
key.fill(0);
|
|
8111
|
-
}
|
|
8112
|
-
}
|
|
8113
|
-
if (Object.keys(sealed).length) {
|
|
8114
|
-
await mail("/native/session-keys", {
|
|
8115
|
-
method: "POST",
|
|
8116
|
-
body: JSON.stringify({ keys: sealed })
|
|
8117
|
-
});
|
|
8118
|
-
}
|
|
8119
|
-
cursor = page.next_cursor;
|
|
8120
|
-
}
|
|
8121
|
-
} finally {
|
|
8122
|
-
secretKey.fill(0);
|
|
8123
|
-
}
|
|
8124
|
-
}
|
|
8125
|
-
function attachmentFromBytes(name, contentType, bytes) {
|
|
8126
|
-
return {
|
|
8127
|
-
id: "",
|
|
8128
|
-
name,
|
|
8129
|
-
content_type: contentType,
|
|
8130
|
-
size: bytes.length,
|
|
8131
|
-
content_base64: bytesToBase642(bytes)
|
|
8132
|
-
};
|
|
8133
|
-
}
|
|
8134
|
-
function bytesToBase642(bytes) {
|
|
8135
|
-
let binary = "";
|
|
8136
|
-
for (let i2 = 0; i2 < bytes.length; i2 += 32768) {
|
|
8137
|
-
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
8138
|
-
}
|
|
8139
|
-
return btoa(binary);
|
|
8140
|
-
}
|
|
8141
|
-
|
|
8142
8214
|
export { Arbi, ArbiApiError, ArbiError, PlanStepsError, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, assistant_exports as assistant, authenticatedFetch, buildFactsContextTool, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatItemLabel, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, identityErrorCode, identity_exports as identityVerification, mail_exports as mail, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, 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, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, work_exports as work, workflow_steps_exports as workflowSteps, workflows_exports as workflows, workspaces_exports as workspaces };
|
|
8143
8215
|
//# sourceMappingURL=browser.js.map
|
|
8144
8216
|
//# sourceMappingURL=browser.js.map
|