@arbidocs/sdk 0.4.147 → 0.4.150

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.
@@ -21,6 +21,12 @@ declare class ArbiApiError extends ArbiError {
21
21
  readonly detail?: string;
22
22
  constructor(message: string, apiError?: unknown, status?: number);
23
23
  }
24
+ /**
25
+ * Why a write was refused, for the person who made it: the server's own reason (an
26
+ * {@link ArbiApiError}'s `detail`, or a raw error body's `detail`), else `fallback` — never a
27
+ * generic client message.
28
+ */
29
+ declare function refusalReason(err: unknown, fallback: string): string;
24
30
  /**
25
31
  * Check API response and throw on error. Returns narrowed non-null data.
26
32
  */
@@ -1860,6 +1866,12 @@ declare function listWorkspaces(arbi: ArbiClient): Promise<{
1860
1866
  project_subscription?: string | null | undefined;
1861
1867
  project_owner_ext_id?: string | null | undefined;
1862
1868
  house_template_ext_id?: string | null | undefined;
1869
+ archive?: {
1870
+ status: "archiving" | "archived" | "restoring";
1871
+ archived_at: string;
1872
+ documents_done: number;
1873
+ documents_total: number;
1874
+ } | null | undefined;
1863
1875
  }[]>;
1864
1876
  /**
1865
1877
  * Create a workspace with a pre-encrypted workspace key.
@@ -1910,6 +1922,12 @@ declare function createWorkspace(arbi: ArbiClient, name: string, encryptedWorksp
1910
1922
  project_subscription?: string | null | undefined;
1911
1923
  project_owner_ext_id?: string | null | undefined;
1912
1924
  house_template_ext_id?: string | null | undefined;
1925
+ archive?: {
1926
+ status: "archiving" | "archived" | "restoring";
1927
+ archived_at: string;
1928
+ documents_done: number;
1929
+ documents_total: number;
1930
+ } | null | undefined;
1913
1931
  }>;
1914
1932
  declare function deleteWorkspaces(arbi: ArbiClient, workspaceIds: string[]): Promise<void>;
1915
1933
  declare function updateWorkspace(arbi: ArbiClient, body: WorkspaceUpdateRequest$1): Promise<{
@@ -1954,6 +1972,12 @@ declare function updateWorkspace(arbi: ArbiClient, body: WorkspaceUpdateRequest$
1954
1972
  project_subscription?: string | null | undefined;
1955
1973
  project_owner_ext_id?: string | null | undefined;
1956
1974
  house_template_ext_id?: string | null | undefined;
1975
+ archive?: {
1976
+ status: "archiving" | "archived" | "restoring";
1977
+ archived_at: string;
1978
+ documents_done: number;
1979
+ documents_total: number;
1980
+ } | null | undefined;
1957
1981
  }>;
1958
1982
  declare function listWorkspaceUsers(arbi: ArbiClient): Promise<{
1959
1983
  user: {
@@ -1975,6 +1999,33 @@ declare function listWorkspaceUsers(arbi: ArbiClient): Promise<{
1975
1999
  agent_ext_id?: string | null | undefined;
1976
2000
  is_temporary: boolean;
1977
2001
  }[]>;
2002
+ /**
2003
+ * `POST /v1/workspace/users` with the whole request: members of the open workspace (or of
2004
+ * `workspace_ext_id` with its key sealed to the caller's session), a temporary session-scoped grant
2005
+ * (`session_pubkey_b64`), an invitation to people not on the platform yet (`confirm_invite`), or a
2006
+ * share of one resource (`resource_type`, `resource_ext_id`, `confirm_share`). Resolves with the
2007
+ * memberships added.
2008
+ */
2009
+ declare function addWorkspaceMembers(arbi: ArbiClient, request: components['schemas']['AddWorkspaceUsersRequest']): Promise<{
2010
+ user: {
2011
+ external_id: string;
2012
+ parent_ext_id?: string | null | undefined;
2013
+ email: string;
2014
+ given_name: string;
2015
+ family_name?: string | null | undefined;
2016
+ picture?: string | null | undefined;
2017
+ encryption_public_key: string;
2018
+ is_sso: boolean;
2019
+ is_identity_verified: boolean;
2020
+ };
2021
+ role: components["schemas"]["WorkspaceRole"];
2022
+ joined_at: string;
2023
+ conversation_count: number;
2024
+ document_count: number;
2025
+ files_mb: number;
2026
+ agent_ext_id?: string | null | undefined;
2027
+ is_temporary: boolean;
2028
+ }[]>;
1978
2029
  declare function addWorkspaceUsers(arbi: ArbiClient, emails: string[], role?: 'owner' | 'collaborator' | 'guest',
1979
2030
  /** Share a workspace other than the open one: its id and its key sealed to the caller's session. */
1980
2031
  target?: {
@@ -2115,6 +2166,7 @@ declare function getWorkspaceActivity(arbi: ArbiClient, workspaceExtId: string,
2115
2166
  declare function primeWorkspaceKey(arbi: ArbiClient, workspaceExtId: string, sessionSealedKey: string): Promise<void>;
2116
2167
 
2117
2168
  type workspaces_WorkspaceActivityOptions = WorkspaceActivityOptions;
2169
+ declare const workspaces_addWorkspaceMembers: typeof addWorkspaceMembers;
2118
2170
  declare const workspaces_addWorkspaceUsers: typeof addWorkspaceUsers;
2119
2171
  declare const workspaces_copyDocuments: typeof copyDocuments;
2120
2172
  declare const workspaces_createWorkspace: typeof createWorkspace;
@@ -2128,7 +2180,7 @@ declare const workspaces_removeWorkspaceUsers: typeof removeWorkspaceUsers;
2128
2180
  declare const workspaces_setUserRole: typeof setUserRole;
2129
2181
  declare const workspaces_updateWorkspace: typeof updateWorkspace;
2130
2182
  declare namespace workspaces {
2131
- export { type workspaces_WorkspaceActivityOptions as WorkspaceActivityOptions, workspaces_addWorkspaceUsers as addWorkspaceUsers, workspaces_copyDocuments as copyDocuments, workspaces_createWorkspace as createWorkspace, workspaces_deleteWorkspaces as deleteWorkspaces, workspaces_getWorkspaceActivity as getWorkspaceActivity, workspaces_grantTemporaryWorkspaceAccess as grantTemporaryWorkspaceAccess, workspaces_listWorkspaceUsers as listWorkspaceUsers, workspaces_listWorkspaces as listWorkspaces, workspaces_primeWorkspaceKey as primeWorkspaceKey, workspaces_removeWorkspaceUsers as removeWorkspaceUsers, workspaces_setUserRole as setUserRole, workspaces_updateWorkspace as updateWorkspace };
2183
+ export { type workspaces_WorkspaceActivityOptions as WorkspaceActivityOptions, workspaces_addWorkspaceMembers as addWorkspaceMembers, workspaces_addWorkspaceUsers as addWorkspaceUsers, workspaces_copyDocuments as copyDocuments, workspaces_createWorkspace as createWorkspace, workspaces_deleteWorkspaces as deleteWorkspaces, workspaces_getWorkspaceActivity as getWorkspaceActivity, workspaces_grantTemporaryWorkspaceAccess as grantTemporaryWorkspaceAccess, workspaces_listWorkspaceUsers as listWorkspaceUsers, workspaces_listWorkspaces as listWorkspaces, workspaces_primeWorkspaceKey as primeWorkspaceKey, workspaces_removeWorkspaceUsers as removeWorkspaceUsers, workspaces_setUserRole as setUserRole, workspaces_updateWorkspace as updateWorkspace };
2132
2184
  }
2133
2185
 
2134
2186
  /**
@@ -2944,6 +2996,12 @@ declare function buildRetrievalFullContextTool(docIds: string[]): components['sc
2944
2996
  */
2945
2997
  declare function buildFactsContextTool(factIds: string[]): components['schemas']['FactsContextTool'];
2946
2998
  declare function buildRetrievalTocTool(docIds: string[]): components['schemas']['RetrievalTOCTool'];
2999
+ /**
3000
+ * The most document ids one retrieve sends. An empty list searches the whole workspace (the
3001
+ * server resolves it), so a caller sends ids only for a narrowed scope, and a scope above this
3002
+ * should be narrowed further or cleared.
3003
+ */
3004
+ declare const MAX_RETRIEVE_DOC_IDS = 5000;
2947
3005
  interface RetrieveOptions {
2948
3006
  arbi: ArbiClient;
2949
3007
  workspaceId: string;
@@ -2953,6 +3011,8 @@ interface RetrieveOptions {
2953
3011
  fullContextDocIds?: string[];
2954
3012
  tocDocIds?: string[];
2955
3013
  model?: string;
3014
+ /** Keep the response server-side (default true); a plain search keeps nothing. */
3015
+ store?: boolean;
2956
3016
  }
2957
3017
  interface ChunkMetadata {
2958
3018
  doc_ext_id?: string | null;
@@ -2987,6 +3047,29 @@ interface RetrieveResult {
2987
3047
  * Uses the typed SDK route POST /v1/assistant/retrieve.
2988
3048
  */
2989
3049
  declare function retrieve(options: RetrieveOptions): Promise<RetrieveResult>;
3050
+ /** One passage a search found, ranked by {@link searchChunks}. */
3051
+ interface SearchChunk {
3052
+ /** Stable key: the chunk id, else the document and the passage's position in its results. */
3053
+ id: string;
3054
+ /**
3055
+ * The chunk id: the join key to the passage's place in the document viewer
3056
+ * (`data-chunk-id`). Absent on legacy chunks.
3057
+ */
3058
+ chunkExtId?: string;
3059
+ docId: string;
3060
+ docTitle: string;
3061
+ page?: number;
3062
+ /** The rerank score when there is one, else the retrieval score. */
3063
+ score: number;
3064
+ /** Position among its document's results. */
3065
+ index: number;
3066
+ content: string;
3067
+ }
3068
+ /**
3069
+ * A retrieve's passages, best first: unreadable fragments dropped, one per chunk, each with its
3070
+ * best score (a rerank score that is not positive does not count).
3071
+ */
3072
+ declare function searchChunks(result: RetrieveResult | null | undefined): SearchChunk[];
2990
3073
  interface AssistantQueryOptions extends AuthHeaders {
2991
3074
  agentId?: string;
2992
3075
  activeArtifactExtId?: string;
@@ -3131,9 +3214,11 @@ type assistant_AssistantQueryOptions = AssistantQueryOptions;
3131
3214
  type assistant_Chunk = Chunk;
3132
3215
  type assistant_ChunkMetadata = ChunkMetadata;
3133
3216
  type assistant_CommandDescriptor = CommandDescriptor;
3217
+ declare const assistant_MAX_RETRIEVE_DOC_IDS: typeof MAX_RETRIEVE_DOC_IDS;
3134
3218
  type assistant_ParsedSlashCommand = ParsedSlashCommand;
3135
3219
  type assistant_RetrieveOptions = RetrieveOptions;
3136
3220
  type assistant_RetrieveResult = RetrieveResult;
3221
+ type assistant_SearchChunk = SearchChunk;
3137
3222
  type assistant_SkillSummary = SkillSummary;
3138
3223
  declare const assistant_buildFactsContextTool: typeof buildFactsContextTool;
3139
3224
  declare const assistant_buildRetrievalChunkTool: typeof buildRetrievalChunkTool;
@@ -3149,9 +3234,10 @@ declare const assistant_parseSlashTokenInProgress: typeof parseSlashTokenInProgr
3149
3234
  declare const assistant_queryAssistant: typeof queryAssistant;
3150
3235
  declare const assistant_respondToAgent: typeof respondToAgent;
3151
3236
  declare const assistant_retrieve: typeof retrieve;
3237
+ declare const assistant_searchChunks: typeof searchChunks;
3152
3238
  declare const assistant_uploadSkill: typeof uploadSkill;
3153
3239
  declare namespace assistant {
3154
- export { type assistant_AssistantQueryOptions as AssistantQueryOptions, type assistant_Chunk as Chunk, type assistant_ChunkMetadata as ChunkMetadata, type assistant_CommandDescriptor as CommandDescriptor, type assistant_ParsedSlashCommand as ParsedSlashCommand, type assistant_RetrieveOptions as RetrieveOptions, type assistant_RetrieveResult as RetrieveResult, type assistant_SkillSummary as SkillSummary, assistant_buildFactsContextTool as buildFactsContextTool, assistant_buildRetrievalChunkTool as buildRetrievalChunkTool, assistant_buildRetrievalFullContextTool as buildRetrievalFullContextTool, assistant_buildRetrievalTocTool as buildRetrievalTocTool, assistant_cancelAssistantRun as cancelAssistantRun, assistant_filterSkills as filterSkills, assistant_isSharedSkill as isSharedSkill, assistant_listCommands as listCommands, assistant_listSkills as listSkills, assistant_parseSlashCommand as parseSlashCommand, assistant_parseSlashTokenInProgress as parseSlashTokenInProgress, assistant_queryAssistant as queryAssistant, assistant_respondToAgent as respondToAgent, assistant_retrieve as retrieve, assistant_uploadSkill as uploadSkill };
3240
+ export { type assistant_AssistantQueryOptions as AssistantQueryOptions, type assistant_Chunk as Chunk, type assistant_ChunkMetadata as ChunkMetadata, type assistant_CommandDescriptor as CommandDescriptor, assistant_MAX_RETRIEVE_DOC_IDS as MAX_RETRIEVE_DOC_IDS, type assistant_ParsedSlashCommand as ParsedSlashCommand, type assistant_RetrieveOptions as RetrieveOptions, type assistant_RetrieveResult as RetrieveResult, type assistant_SearchChunk as SearchChunk, type assistant_SkillSummary as SkillSummary, assistant_buildFactsContextTool as buildFactsContextTool, assistant_buildRetrievalChunkTool as buildRetrievalChunkTool, assistant_buildRetrievalFullContextTool as buildRetrievalFullContextTool, assistant_buildRetrievalTocTool as buildRetrievalTocTool, assistant_cancelAssistantRun as cancelAssistantRun, assistant_filterSkills as filterSkills, assistant_isSharedSkill as isSharedSkill, assistant_listCommands as listCommands, assistant_listSkills as listSkills, assistant_parseSlashCommand as parseSlashCommand, assistant_parseSlashTokenInProgress as parseSlashTokenInProgress, assistant_queryAssistant as queryAssistant, assistant_respondToAgent as respondToAgent, assistant_retrieve as retrieve, assistant_searchChunks as searchChunks, assistant_uploadSkill as uploadSkill };
3155
3241
  }
3156
3242
 
3157
3243
  /**
@@ -4674,6 +4760,8 @@ type ProjectEventKind = ProjectEventResponse['kind'];
4674
4760
  type ProjectConversationUsageResponse = components['schemas']['ProjectConversationUsageResponse'];
4675
4761
  /** The project details a host sets on create and update (budget, client, stage, lead, fields). */
4676
4762
  type ProjectDetails = Pick<ProjectUpdateRequest, 'budget' | 'client' | 'client_ref' | 'stage' | 'lead_user' | 'fields' | 'field_schema'>;
4763
+ /** What a new project starts with besides its name and plan (details, a per-collaborator cap). */
4764
+ type ProjectCreateOptions = Omit<components['schemas']['ProjectCreateRequest'], 'name' | 'plan'>;
4677
4765
  /** The caller's projects; only those at `stage` and/or led by `leadUser` (`usr-…`) when given. */
4678
4766
  declare function listProjects(arbi: ArbiClient, filters?: {
4679
4767
  stage?: string;
@@ -4801,7 +4889,7 @@ declare function listProjects(arbi: ArbiClient, filters?: {
4801
4889
  * is created pending and only becomes usable after Stripe checkout (done in the web app).
4802
4890
  * `details` sets its budget, client, stage, lead and fields from the start.
4803
4891
  */
4804
- declare function createProject(arbi: ArbiClient, name: string, plan?: 'free' | 'pro', details?: ProjectDetails): Promise<{
4892
+ declare function createProject(arbi: ArbiClient, name: string, plan?: 'free' | 'pro', details?: ProjectCreateOptions): Promise<{
4805
4893
  external_id: string;
4806
4894
  name: string;
4807
4895
  created_by: string;
@@ -5306,353 +5394,1092 @@ declare function getProjectInvoices(arbi: ArbiClient, projectExtId: string): Pro
5306
5394
  * `daily_cap_per_user` to render a "£ used today" indicator.
5307
5395
  */
5308
5396
  declare function getUserUsageToday(arbi: ArbiClient): Promise<UserDailyUsageResponse>;
5309
-
5310
- type projects_ProjectBudget = ProjectBudget;
5311
- type projects_ProjectConversationUsageResponse = ProjectConversationUsageResponse;
5312
- type projects_ProjectDetails = ProjectDetails;
5313
- type projects_ProjectEventKind = ProjectEventKind;
5314
- type projects_ProjectEventResponse = ProjectEventResponse;
5315
- type projects_ProjectInvoicesResponse = ProjectInvoicesResponse;
5316
- type projects_ProjectResponse = ProjectResponse;
5317
- type projects_ProjectUpdateRequest = ProjectUpdateRequest;
5318
- type projects_ProjectUsageResponse = ProjectUsageResponse;
5319
- type projects_UserDailyUsageResponse = UserDailyUsageResponse;
5320
- declare const projects_createProject: typeof createProject;
5321
- declare const projects_deleteProject: typeof deleteProject;
5322
- declare const projects_formatBudget: typeof formatBudget;
5323
- declare const projects_getProjectConversationUsage: typeof getProjectConversationUsage;
5324
- declare const projects_getProjectInvoices: typeof getProjectInvoices;
5325
- declare const projects_getProjectUsage: typeof getProjectUsage;
5326
- declare const projects_getUserUsageToday: typeof getUserUsageToday;
5327
- declare const projects_listProjectEvents: typeof listProjectEvents;
5328
- declare const projects_listProjects: typeof listProjects;
5329
- declare const projects_parseBudget: typeof parseBudget;
5330
- declare const projects_refreshProject: typeof refreshProject;
5331
- declare const projects_renameProject: typeof renameProject;
5332
- declare const projects_updateProject: typeof updateProject;
5333
- declare namespace projects {
5334
- export { type projects_ProjectBudget as ProjectBudget, type projects_ProjectConversationUsageResponse as ProjectConversationUsageResponse, type projects_ProjectDetails as ProjectDetails, type projects_ProjectEventKind as ProjectEventKind, type projects_ProjectEventResponse as ProjectEventResponse, type projects_ProjectInvoicesResponse as ProjectInvoicesResponse, type projects_ProjectResponse as ProjectResponse, type projects_ProjectUpdateRequest as ProjectUpdateRequest, type projects_ProjectUsageResponse as ProjectUsageResponse, type projects_UserDailyUsageResponse as UserDailyUsageResponse, projects_createProject as createProject, projects_deleteProject as deleteProject, projects_formatBudget as formatBudget, projects_getProjectConversationUsage as getProjectConversationUsage, projects_getProjectInvoices as getProjectInvoices, projects_getProjectUsage as getProjectUsage, projects_getUserUsageToday as getUserUsageToday, projects_listProjectEvents as listProjectEvents, projects_listProjects as listProjects, projects_parseBudget as parseBudget, projects_refreshProject as refreshProject, projects_renameProject as renameProject, projects_updateProject as updateProject };
5335
- }
5336
-
5337
- /**
5338
- * Stepped workflows: a run is a work conversation whose plan has named steps (`TaskPlan.steps`).
5339
- * Form, upload and review steps wait for a person (`work.actOnStep`); an agent step is a turn the
5340
- * assistant takes in the thread. Where a run is lives in the conversation's activity log: each
5341
- * step's `step_started` / `step_done` / `step_skipped` / `step_failed` event, the latest winning. A
5342
- * `step_sent_back` reopens the step it names and every step after it (pending again); `step_ready`
5343
- * records that a ready person step's assignee was told; `step_signal` is a signal a done step raised,
5344
- * and `linked_run` the thread a linked workflow started on it. An agent step whose `step_waiting`
5345
- * (then `step_progress`, as the set shrinks) carries `waiting.documents` waits for those documents
5346
- * to finish processing before its turn starts.
5347
- *
5348
- * Pure functions over the API's own types (`TaskPlanStep`, `ActivityResponse`), for any client: the
5349
- * CLI's `arbi run steps`, scripts and agents. They mirror the server (`src/core/workflow_steps.py`).
5350
- *
5351
- * NOTE: `@arbidocs/blocks` has the same model over its UI step type (`agents/workflows/run.ts`:
5352
- * `stepDependencies`, `stepStatesFromActivity`, `stepPhase`, `validateWorkflowGraph`). Blocks is
5353
- * deliberately SDK-free (it depends on `@arbidocs/client` only), so it cannot import this module;
5354
- * the few lines both need are duplicated. Change them together.
5355
- */
5356
-
5357
- type TaskPlanStep = components['schemas']['TaskPlanStep'];
5358
- type StepKind = TaskPlanStep['kind'];
5359
- /** A signal a step raises when it is done and its condition holds. */
5360
- type StepSignal = components['schemas']['StepSignal'];
5361
- type StepSignalWhen = components['schemas']['StepSignalWhen'];
5362
- /** Who a step is for: one of `user`, `run_owner`, `input` or `project_lead`. */
5363
- type StepAssignee = components['schemas']['StepAssignee'];
5364
- /** What the activity log says about a step: nothing yet (`pending`), or its latest event. */
5365
- type StepStatus = 'pending' | 'running' | 'done' | 'skipped' | 'failed';
5366
- /**
5367
- * Where a step stands in a run: `pending` while something it waits for is unfinished, `ready`
5368
- * once everything it waits for is done or skipped, then its own status.
5369
- */
5370
- /** `waiting`: an action step started and now waits for people (signers to sign, a draft to be sent). */
5371
- type StepPhase = 'pending' | 'ready' | 'running' | 'waiting' | 'done' | 'skipped' | 'failed';
5372
- interface StepState {
5373
- status: StepStatus;
5374
- /** The step's answer in the thread (an agent step: a message id), or what a branch delivered. */
5375
- responseId: string | null;
5376
- error: string | null;
5377
- /** Reopened by a send-back to this very step, and not touched since. */
5378
- sentBack: boolean;
5379
- /** The send-back came with a note (encrypted in the log; an agent step runs again with it). */
5380
- hasNote: boolean;
5381
- /** Who was told the step is ready (`usr-` / `agt-`), since it last changed. */
5382
- announcedTo: string | null;
5383
- /**
5384
- * The documents (ids) an agent step waits on to finish processing before its turn starts, as
5385
- * its latest `step_waiting` / `step_progress` says; empty once it starts (or never waited).
5386
- */
5387
- waitingDocuments: string[];
5388
- /**
5389
- * What a started action step waits for (`sign`, `email_draft`), as its latest `step_waiting` says,
5390
- * and the document it is about (a signature request's document); null when it waits on nothing.
5391
- */
5392
- waitingAction: string | null;
5393
- waitingDocument: string | null;
5394
- }
5395
- /** One entry of a conversation's activity log, as far as steps are concerned. */
5396
- interface StepActivityEvent {
5397
- kind: string;
5398
- detail?: Record<string, unknown> | null;
5399
- actor_ext_id?: string | null;
5400
- created_at?: string;
5401
- }
5402
- declare const STEP_KINDS: readonly StepKind[];
5403
- /** What an `action` step does with a platform feature (`src/core/workflow_actions.py`). */
5404
- declare const STEP_ACTION_TYPES: readonly ["sign", "email_draft", "tabular_review"];
5405
- declare const PERSON_STEP_KINDS: readonly StepKind[];
5406
- /** The server's step id rule. */
5407
- declare const STEP_ID_PATTERN: RegExp;
5408
- declare const isPersonStep: (step: Pick<TaskPlanStep, "kind">) => boolean;
5409
- /** What a step waits for: its `after`, else the step before it in the list (a sequence). */
5410
- declare function stepDependencies(steps: Pick<TaskPlanStep, 'id' | 'after'>[], id: string): string[];
5411
- /** "Waiting for 3 documents to finish processing" (one: "1 document"). */
5412
- declare function waitingForDocumentsText(count: number): string;
5413
- /**
5414
- * Each step's state from the activity log (oldest first): its latest step event wins. A send-back
5415
- * reopens the steps it lists as pending (only the one it went `to` is `sentBack`); a `step_ready`
5416
- * records who was told, and a `step_waiting` / `step_progress` the documents an agent step waits
5417
- * on, until the step's next change.
5418
- */
5419
- declare function stepStatesFromActivity(events: StepActivityEvent[]): Record<string, StepState>;
5420
- /** A signal a done step raised (`step_signal`). */
5421
- interface RaisedSignal {
5422
- step: string;
5423
- signal: string;
5424
- at: string | null;
5425
- }
5426
- /** A thread a linked workflow started on a signal raised in this run (`linked_run`). */
5427
- interface LinkedRun {
5428
- step: string | null;
5429
- signal: string | null;
5430
- /** The new thread (`con-…`). */
5431
- conversationId: string;
5432
- /** The workflow that started it (`wfl-…`). */
5433
- workflowId: string | null;
5434
- at: string | null;
5435
- }
5436
- /** A person sent the work back from `step` to `to` (`step_sent_back`). */
5437
- interface SendBack {
5438
- step: string;
5439
- to: string;
5440
- /** `to` and every step after it: pending again. */
5441
- reopened: string[];
5442
- hasNote: boolean;
5443
- by: string | null;
5444
- at: string | null;
5445
- }
5446
- /** The signals the run's steps raised, oldest first. */
5447
- declare function raisedSignals(events: StepActivityEvent[]): RaisedSignal[];
5448
- /** The threads linked workflows started from this run's signals, oldest first. */
5449
- declare function linkedRuns(events: StepActivityEvent[]): LinkedRun[];
5450
- /** Every send-back in the run, oldest first. */
5451
- declare function sendBacks(events: StepActivityEvent[]): SendBack[];
5452
- /** Where one step stands: its own status once it has one, else `ready` or `pending`. */
5453
- declare function stepPhase(steps: Pick<TaskPlanStep, 'id' | 'after'>[], states: Record<string, StepState>, id: string): StepPhase;
5454
- interface RunStep {
5455
- id: string;
5456
- title: string;
5457
- kind: StepKind;
5458
- phase: StepPhase;
5459
- /** What it waits for (its `after`, or the step before it). */
5460
- after: string[];
5461
- /** A done agent step's answer: the assistant message id in the thread. */
5462
- responseId: string | null;
5463
- error: string | null;
5464
- /** Who the step is for (from the plan), or null: the run's owner hears of it. */
5465
- assignee: StepAssignee | null;
5466
- /** Who was told it is ready, since it last changed (`usr-` / `agt-`). */
5467
- announcedTo: string | null;
5468
- /** Reopened by a send-back to it and not touched since (`hasNote`: with a note). */
5469
- sentBack: boolean;
5470
- hasNote: boolean;
5471
- /** How many times work was sent back to this step. */
5472
- timesSentBack: number;
5473
- /** The signals this step raised (each name once, first raised first). */
5474
- signals: string[];
5475
- /** The threads linked workflows started on this step's signals. */
5476
- linkedRuns: LinkedRun[];
5477
- /** The documents (ids) it waits on to finish processing before its turn starts. */
5478
- waitingDocuments: string[];
5479
- /** A started action step waiting for people: what for (`sign`, `email_draft`), and its document. */
5480
- waitingAction: string | null;
5481
- waitingDocument: string | null;
5482
- }
5483
- /** A run's steps with where each stands, in plan order. */
5484
- declare function runSteps(steps: TaskPlanStep[], events: StepActivityEvent[]): RunStep[];
5485
- /** Who a step is for, in words: `run owner`, `project lead`, `input:<field>` or the user id. */
5486
- declare function describeAssignee(assignee: StepAssignee | null | undefined): string;
5487
- /** The step a server-sent message starts (its `tools.workflow_step` marker), or null. */
5488
- declare function messageWorkflowStep(message: {
5489
- tools?: Record<string, unknown> | null;
5490
- }): string | null;
5397
+ type ProductResponse = components['schemas']['ProductResponse'];
5398
+ type ProjectQuoteRequest = components['schemas']['ProjectQuoteRequest'];
5399
+ type ProjectCheckoutRequest = components['schemas']['ProjectCheckoutRequest'];
5400
+ type ProjectPlanChangeRequest = components['schemas']['ProjectPlanChangeRequest'];
5401
+ type ProjectNextPeriodAddonsRequest = components['schemas']['ProjectNextPeriodAddonsRequest'];
5402
+ type ProjectAddonSettingsRequest = components['schemas']['ProjectAddonSettingsRequest'];
5403
+ type TaxQuoteResponse = components['schemas']['TaxQuoteResponse'];
5404
+ /** A purchasable add-on block. */
5405
+ type ProjectAddonKind = 'ai_usage' | 'storage';
5406
+ /** The plans and add-ons on sale, with their prices. */
5407
+ declare function listProducts(arbi: ArbiClient): Promise<{
5408
+ product_id: string;
5409
+ name: string;
5410
+ description?: string | null | undefined;
5411
+ prices: {
5412
+ price_id: string;
5413
+ amount?: number | null | undefined;
5414
+ amount_ex_vat?: number | null | undefined;
5415
+ currency: string;
5416
+ interval: string;
5417
+ interval_count: number;
5418
+ default_price: boolean;
5419
+ pack_prices: {
5420
+ packs: number;
5421
+ amount: number;
5422
+ amount_ex_vat: number;
5423
+ }[];
5424
+ addon_prices: {
5425
+ kind: "ai_usage" | "storage";
5426
+ ai_gbp: number;
5427
+ storage_gb: number;
5428
+ amount_ex_vat: number;
5429
+ amount: number;
5430
+ monthly_ex_vat: number;
5431
+ monthly: number;
5432
+ }[];
5433
+ }[];
5434
+ }[]>;
5491
5435
  /**
5492
- * What a run waits for now:
5493
- * - `agent`: a step is running, or an agent step is ready (the server starts it next);
5494
- * - `person`: a form, upload or review is ready for someone to complete or skip;
5495
- * - `finished`: every step is done or skipped;
5496
- * - `stuck`: nothing can move (a failed step that others wait for): skip it to go on.
5497
- */
5498
- type RunWaitingOn = 'agent' | 'person' | 'finished' | 'stuck';
5499
- declare function runWaitingOn(run: RunStep[]): RunWaitingOn;
5436
+ * The tax-inclusive total of a Pro purchase for a billing address (Stripe Tax; nothing is
5437
+ * created): for a new project when `projectExtId` is null, else for that (Free) project. A 422
5438
+ * `TAX_LOCATION_INVALID` asks for a ZIP / postcode.
5439
+ */
5440
+ declare function quotePlan(arbi: ArbiClient, projectExtId: string | null, body: ProjectQuoteRequest): Promise<{
5441
+ subtotal_pence: number;
5442
+ tax_pence: number;
5443
+ total_pence: number;
5444
+ tax_label?: string | null | undefined;
5445
+ reverse_charge: boolean;
5446
+ country?: string | null | undefined;
5447
+ taxability_reason?: string | null | undefined;
5448
+ lines: {
5449
+ reference: string;
5450
+ subtotal_pence: number;
5451
+ tax_pence: number;
5452
+ }[];
5453
+ }>;
5454
+ /** Start an embedded Stripe checkout for a project; returns its `client_secret`. */
5455
+ declare function createCheckout(arbi: ArbiClient, projectExtId: string, body: ProjectCheckoutRequest): Promise<{
5456
+ client_secret: string;
5457
+ }>;
5500
5458
  /**
5501
- * A field a step asks for: a step's `fields` (what completing it is checked against, e.g. a rating
5502
- * at a review), or a form's `ui.fields` (what the app's form renders).
5459
+ * Switch a Pro project between monthly and annual billing at the end of the period (the current
5460
+ * interval clears a pending switch, and resumes a project set to cancel). Returns the project.
5503
5461
  */
5504
- interface StepField {
5462
+ declare function changePlan(arbi: ArbiClient, projectExtId: string, body: ProjectPlanChangeRequest): Promise<{
5463
+ external_id: string;
5505
5464
  name: string;
5506
- type: string;
5507
- label?: string | null;
5508
- required?: boolean;
5509
- options?: StepFieldOption[] | null;
5510
- min?: number | null;
5511
- max?: number | null;
5512
- [key: string]: unknown;
5513
- }
5514
- /**
5515
- * The tones a choice can be shown in (the blocks' `Tone`): e.g. a risk rating's low `success`,
5516
- * medium `warning`, high `danger`. Display only: the server passes it through.
5517
- */
5518
- declare const STEP_FIELD_OPTION_TONES: readonly ["neutral", "info", "success", "warning", "danger", "accent", "ai"];
5519
- type StepFieldOptionTone = (typeof STEP_FIELD_OPTION_TONES)[number];
5520
- /** One choice of a `select` field. */
5521
- interface StepFieldOption {
5522
- value: string;
5523
- label?: string | null;
5524
- /** How the choice is coloured where it is picked, chosen or not. */
5525
- tone?: StepFieldOptionTone | null;
5526
- [key: string]: unknown;
5527
- }
5528
- /** The types a step's `fields` can have (the server's `StepField.type`). */
5529
- declare const STEP_FIELD_TYPES: readonly ["text", "longtext", "boolean", "select", "number", "date", "scope", "documents", "person"];
5530
- /**
5531
- * The fields a step asks for: its `fields` when it declares them (any person step), else a form
5532
- * step's `ui.fields`; none for an agent step.
5533
- */
5534
- declare function stepFields(step: Pick<TaskPlanStep, 'kind' | 'ui' | 'fields'>): StepField[];
5535
- /** The required fields of a step still blank in `inputs` (the run's plus the new ones). */
5536
- declare function missingRequiredFields(step: Pick<TaskPlanStep, 'kind' | 'ui' | 'fields'>, inputs: Record<string, unknown>): string[];
5537
- /**
5538
- * What the server would say about completing a step with `inputs` (`{name: problem}`, empty when
5539
- * they fit), for a step that declares `fields`: `required`, `number`, `min`, `max`, `option`,
5540
- * `type`, or `unknown` (a name the step does not ask for). A step without `fields` takes any inputs.
5541
- */
5542
- declare function checkStepInputs(step: Pick<TaskPlanStep, 'fields'>, inputs: Record<string, unknown> | null | undefined): Record<string, string>;
5543
- /** A `checkStepInputs` result as one line: `rating: must be one of low, high; note: required`. */
5544
- declare function describeInputProblems(step: Pick<TaskPlanStep, 'fields'>, problems: Record<string, string>): string;
5545
- /**
5546
- * `name=value` pairs (as typed on a command line) to inputs. A value is text unless the step's
5547
- * field says otherwise: `number` fields become numbers, `boolean` fields `true` / `false`.
5548
- */
5549
- declare function parseInputPairs(pairs: string[], fields?: Pick<StepField, 'name' | 'type'>[]): Record<string, unknown>;
5550
- /** The server's signal name rule. */
5551
- declare const SIGNAL_NAME_PATTERN: RegExp;
5552
- /** A list of what is wrong with a steps definition, each naming where (`steps[1].kind`). */
5553
- declare class PlanStepsError extends Error {
5554
- readonly problems: string[];
5555
- constructor(problems: string[]);
5556
- }
5557
- /**
5558
- * Check a steps definition and return it as the API's `TaskPlanStep[]`. Accepts a list of steps,
5559
- * or an object with `steps` (e.g. a whole plan). Throws `PlanStepsError` listing every problem:
5560
- * shape, ids, kinds, an agent step without a prompt or skill, and the graph (a duplicate id, an
5561
- * `after` naming no step, a cycle, a step listed before one it waits for).
5562
- */
5563
- declare function parsePlanSteps(value: unknown): TaskPlanStep[];
5564
- /** A plan holding only steps (what `createWork` and workflows take as `plan`). */
5565
- declare function stepsPlan(steps: TaskPlanStep[]): components['schemas']['TaskPlan'];
5566
-
5567
- type workflowSteps_LinkedRun = LinkedRun;
5568
- declare const workflowSteps_PERSON_STEP_KINDS: typeof PERSON_STEP_KINDS;
5569
- type workflowSteps_PlanStepsError = PlanStepsError;
5570
- declare const workflowSteps_PlanStepsError: typeof PlanStepsError;
5571
- type workflowSteps_RaisedSignal = RaisedSignal;
5572
- type workflowSteps_RunStep = RunStep;
5573
- type workflowSteps_RunWaitingOn = RunWaitingOn;
5574
- declare const workflowSteps_SIGNAL_NAME_PATTERN: typeof SIGNAL_NAME_PATTERN;
5575
- declare const workflowSteps_STEP_ACTION_TYPES: typeof STEP_ACTION_TYPES;
5576
- declare const workflowSteps_STEP_FIELD_OPTION_TONES: typeof STEP_FIELD_OPTION_TONES;
5577
- declare const workflowSteps_STEP_FIELD_TYPES: typeof STEP_FIELD_TYPES;
5578
- declare const workflowSteps_STEP_ID_PATTERN: typeof STEP_ID_PATTERN;
5579
- declare const workflowSteps_STEP_KINDS: typeof STEP_KINDS;
5580
- type workflowSteps_SendBack = SendBack;
5581
- type workflowSteps_StepActivityEvent = StepActivityEvent;
5582
- type workflowSteps_StepAssignee = StepAssignee;
5583
- type workflowSteps_StepField = StepField;
5584
- type workflowSteps_StepFieldOption = StepFieldOption;
5585
- type workflowSteps_StepFieldOptionTone = StepFieldOptionTone;
5586
- type workflowSteps_StepKind = StepKind;
5587
- type workflowSteps_StepPhase = StepPhase;
5588
- type workflowSteps_StepSignal = StepSignal;
5589
- type workflowSteps_StepSignalWhen = StepSignalWhen;
5590
- type workflowSteps_StepState = StepState;
5591
- type workflowSteps_StepStatus = StepStatus;
5592
- type workflowSteps_TaskPlanStep = TaskPlanStep;
5593
- declare const workflowSteps_checkStepInputs: typeof checkStepInputs;
5594
- declare const workflowSteps_describeAssignee: typeof describeAssignee;
5595
- declare const workflowSteps_describeInputProblems: typeof describeInputProblems;
5596
- declare const workflowSteps_isPersonStep: typeof isPersonStep;
5597
- declare const workflowSteps_linkedRuns: typeof linkedRuns;
5598
- declare const workflowSteps_messageWorkflowStep: typeof messageWorkflowStep;
5599
- declare const workflowSteps_missingRequiredFields: typeof missingRequiredFields;
5600
- declare const workflowSteps_parseInputPairs: typeof parseInputPairs;
5601
- declare const workflowSteps_parsePlanSteps: typeof parsePlanSteps;
5602
- declare const workflowSteps_raisedSignals: typeof raisedSignals;
5603
- declare const workflowSteps_runSteps: typeof runSteps;
5604
- declare const workflowSteps_runWaitingOn: typeof runWaitingOn;
5605
- declare const workflowSteps_sendBacks: typeof sendBacks;
5606
- declare const workflowSteps_stepDependencies: typeof stepDependencies;
5607
- declare const workflowSteps_stepFields: typeof stepFields;
5608
- declare const workflowSteps_stepPhase: typeof stepPhase;
5609
- declare const workflowSteps_stepStatesFromActivity: typeof stepStatesFromActivity;
5610
- declare const workflowSteps_stepsPlan: typeof stepsPlan;
5611
- declare const workflowSteps_waitingForDocumentsText: typeof waitingForDocumentsText;
5612
- declare namespace workflowSteps {
5613
- export { type workflowSteps_LinkedRun as LinkedRun, workflowSteps_PERSON_STEP_KINDS as PERSON_STEP_KINDS, workflowSteps_PlanStepsError as PlanStepsError, type workflowSteps_RaisedSignal as RaisedSignal, type workflowSteps_RunStep as RunStep, type workflowSteps_RunWaitingOn as RunWaitingOn, workflowSteps_SIGNAL_NAME_PATTERN as SIGNAL_NAME_PATTERN, workflowSteps_STEP_ACTION_TYPES as STEP_ACTION_TYPES, workflowSteps_STEP_FIELD_OPTION_TONES as STEP_FIELD_OPTION_TONES, workflowSteps_STEP_FIELD_TYPES as STEP_FIELD_TYPES, workflowSteps_STEP_ID_PATTERN as STEP_ID_PATTERN, workflowSteps_STEP_KINDS as STEP_KINDS, type workflowSteps_SendBack as SendBack, type workflowSteps_StepActivityEvent as StepActivityEvent, type workflowSteps_StepAssignee as StepAssignee, type workflowSteps_StepField as StepField, type workflowSteps_StepFieldOption as StepFieldOption, type workflowSteps_StepFieldOptionTone as StepFieldOptionTone, type workflowSteps_StepKind as StepKind, type workflowSteps_StepPhase as StepPhase, type workflowSteps_StepSignal as StepSignal, type workflowSteps_StepSignalWhen as StepSignalWhen, type workflowSteps_StepState as StepState, type workflowSteps_StepStatus as StepStatus, type workflowSteps_TaskPlanStep as TaskPlanStep, workflowSteps_checkStepInputs as checkStepInputs, workflowSteps_describeAssignee as describeAssignee, workflowSteps_describeInputProblems as describeInputProblems, workflowSteps_isPersonStep as isPersonStep, workflowSteps_linkedRuns as linkedRuns, workflowSteps_messageWorkflowStep as messageWorkflowStep, workflowSteps_missingRequiredFields as missingRequiredFields, workflowSteps_parseInputPairs as parseInputPairs, workflowSteps_parsePlanSteps as parsePlanSteps, workflowSteps_raisedSignals as raisedSignals, workflowSteps_runSteps as runSteps, workflowSteps_runWaitingOn as runWaitingOn, workflowSteps_sendBacks as sendBacks, workflowSteps_stepDependencies as stepDependencies, workflowSteps_stepFields as stepFields, workflowSteps_stepPhase as stepPhase, workflowSteps_stepStatesFromActivity as stepStatesFromActivity, workflowSteps_stepsPlan as stepsPlan, workflowSteps_waitingForDocumentsText as waitingForDocumentsText };
5614
- }
5615
-
5616
- /**
5617
- * Work: a conversation with a `status` is a task. Create one, run it, mark it done, or plan it. Backend: `/v1/conversation/...` (docs/design/work-model.md).
5618
- */
5619
-
5620
- type ConversationResponse = components['schemas']['ConversationResponse'];
5621
- type UpdateConversationRequest = components['schemas']['UpdateConversationRequest'];
5622
- type CreateWorkRequest = components['schemas']['CreateWorkRequest'];
5623
- type PendingAuthResponse = components['schemas']['PendingAuthResponse'];
5624
- type PlanWorkRequest = components['schemas']['PlanWorkRequest'];
5625
- type StepActionRequest = components['schemas']['StepActionRequest'];
5626
- type TaskPlan = components['schemas']['TaskPlan'];
5627
- type ActivityResponse = components['schemas']['ActivityResponse'];
5628
- type ActivityKind = components['schemas']['ActivityKind'];
5629
- type WorkStatus = components['schemas']['WorkStatus'];
5630
- type ConversationUsageResponse = components['schemas']['ConversationUsageResponse'];
5631
- /** One slice of a usage breakdown: spend (£), tokens and requests. */
5632
- type UsageBreakdown = components['schemas']['TagBreakdown'];
5633
- /** The authorization tier of a run: per-run temporary key, ask each run, or standing membership. */
5634
- type AuthMode = components['schemas']['src__models__work__AuthMode'];
5635
- /**
5636
- * Update a conversation: title, sharing (`shared`, owner only), and the work fields (description, due
5637
- * date, parent, `status` `todo | done`, plan). This one call replaces share, unshare
5638
- * and rename.
5639
- */
5640
- declare function updateConversation(arbi: ArbiClient, conversationId: string, body: UpdateConversationRequest): Promise<ConversationResponse>;
5641
- /** Create a work item. With a `prompt` / `skill_ref` the agent starts at once; otherwise a to-do. */
5642
- declare function createWork(arbi: ArbiClient, body: CreateWorkRequest): Promise<ConversationResponse>;
5643
- /** Run a work item now (or retry). Not while a run is live. */
5644
- declare function runConversation(arbi: ArbiClient, conversationId: string): Promise<ConversationResponse>;
5645
- /** What an unattended run waits on (agent email + session public key); 404 when nothing waits. */
5646
- declare function getPendingAuth(arbi: ArbiClient, conversationId: string): Promise<PendingAuthResponse>;
5465
+ created_by: string;
5466
+ subscription: string;
5467
+ created_at: string;
5468
+ quotas: {
5469
+ storage_gb: {
5470
+ used: number;
5471
+ limit: number;
5472
+ };
5473
+ ai_usage: {
5474
+ used: number;
5475
+ limit: number;
5476
+ };
5477
+ collaborators: {
5478
+ used: number;
5479
+ limit: number;
5480
+ };
5481
+ budget_reset_at?: number | null | undefined;
5482
+ };
5483
+ daily_cap_per_user?: number | null | undefined;
5484
+ budget?: {
5485
+ amount: number;
5486
+ currency: string;
5487
+ } | null | undefined;
5488
+ client?: string | null | undefined;
5489
+ client_ref?: string | null | undefined;
5490
+ stage?: string | null | undefined;
5491
+ stage_changed_at?: string | null | undefined;
5492
+ lead_user?: string | null | undefined;
5493
+ fields?: {
5494
+ [x: string]: unknown;
5495
+ } | undefined;
5496
+ field_schema?: {
5497
+ key: string;
5498
+ label?: string | null | undefined;
5499
+ type: "text" | "number" | "date" | "checkbox" | "select" | "person" | "document" | "relation" | "lookup" | "rollup" | "tag";
5500
+ options?: string[] | null | undefined;
5501
+ }[] | null | undefined;
5502
+ plan_interval?: ("month" | "year") | null | undefined;
5503
+ packs: number;
5504
+ plan_change?: {
5505
+ result: "upgraded" | "scheduled" | "unchanged" | "requires_action";
5506
+ charged_pence: number;
5507
+ charged_ex_vat_pence: number;
5508
+ confirm_url?: string | null | undefined;
5509
+ } | null | undefined;
5510
+ addons?: {
5511
+ packs: number;
5512
+ packs_next?: number | null | undefined;
5513
+ plan_name: string;
5514
+ plan_ai_gbp: number;
5515
+ plan_storage_gb: number;
5516
+ block_ai_gbp: number;
5517
+ block_storage_gb: number;
5518
+ ai_blocks: number;
5519
+ storage_blocks: number;
5520
+ legacy_ai_blocks: number;
5521
+ legacy_storage_blocks: number;
5522
+ legacy_block_ai_gbp: number;
5523
+ legacy_block_storage_gb: number;
5524
+ blocks_ai_gbp: number;
5525
+ blocks_storage_gb: number;
5526
+ ai_blocks_next?: number | null | undefined;
5527
+ storage_blocks_next?: number | null | undefined;
5528
+ storage_blocks_min: number;
5529
+ auto_topup_threshold_gbp: number;
5530
+ min_auto_topup_threshold_gbp: number;
5531
+ spend_cap_pence?: number | null | undefined;
5532
+ addon_spend_pence: number;
5533
+ auto_spent_pence: number;
5534
+ addon_spend_window_end?: number | null | undefined;
5535
+ manual_spent_pence: number;
5536
+ cap_left_pence?: number | null | undefined;
5537
+ ai_used_gbp: number;
5538
+ ai_allowance_gbp: number;
5539
+ ai_allowance_next_gbp: number;
5540
+ storage_used_gb: number;
5541
+ storage_allowance_gb: number;
5542
+ storage_allowance_next_gb: number;
5543
+ ai_block_monthly_pence: number;
5544
+ ai_block_monthly_ex_vat_pence: number;
5545
+ storage_block_monthly_pence: number;
5546
+ storage_block_monthly_ex_vat_pence: number;
5547
+ ai_block_period_pence: number;
5548
+ ai_block_period_ex_vat_pence: number;
5549
+ storage_block_period_pence: number;
5550
+ storage_block_period_ex_vat_pence: number;
5551
+ ai_block_price_pence: number;
5552
+ ai_block_price_ex_vat_pence: number;
5553
+ storage_block_price_pence: number;
5554
+ storage_block_price_ex_vat_pence: number;
5555
+ cap_reached: boolean;
5556
+ period_end?: number | null | undefined;
5557
+ ai_usage_reset_at?: number | null | undefined;
5558
+ pending_interval?: ("month" | "year") | null | undefined;
5559
+ billing_error?: string | null | undefined;
5560
+ confirm_url?: string | null | undefined;
5561
+ payment?: {
5562
+ status: "pending" | "paid";
5563
+ kind?: ("ai_usage" | "storage") | null | undefined;
5564
+ amount_pence?: number | null | undefined;
5565
+ amount_ex_vat_pence?: number | null | undefined;
5566
+ tax_pence?: number | null | undefined;
5567
+ at?: number | null | undefined;
5568
+ confirm_url?: string | null | undefined;
5569
+ } | null | undefined;
5570
+ } | null | undefined;
5571
+ price_id?: string | null | undefined;
5572
+ plan?: string | null | undefined;
5573
+ amount?: number | null | undefined;
5574
+ amount_ex_vat?: number | null | undefined;
5575
+ currency?: string | null | undefined;
5576
+ current_period_end?: number | null | undefined;
5577
+ cancel_at_period_end?: boolean | null | undefined;
5578
+ portal_url?: string | null | undefined;
5579
+ }>;
5580
+ /** What a plan change would charge now and at the first renewal; nothing changes. */
5581
+ declare function previewPlanChange(arbi: ArbiClient, projectExtId: string, body: ProjectPlanChangeRequest): Promise<{
5582
+ packs: number;
5583
+ plan_name: string;
5584
+ interval: "month" | "year";
5585
+ effective_now: boolean;
5586
+ unchanged: boolean;
5587
+ awaiting_confirmation: boolean;
5588
+ due_now_pence: number;
5589
+ due_now_ex_vat_pence: number;
5590
+ due_now_tax_pence: number;
5591
+ next_renewal_pence: number;
5592
+ next_renewal_ex_vat_pence: number;
5593
+ next_renewal_tax_pence: number;
5594
+ tax_label?: string | null | undefined;
5595
+ next_renewal_at?: number | null | undefined;
5596
+ }>;
5597
+ /** What one more add-on block costs now and at renewal, taxed for the saved address. */
5598
+ declare function quoteAddon(arbi: ArbiClient, projectExtId: string, kind: ProjectAddonKind): Promise<{
5599
+ kind: "ai_usage" | "storage";
5600
+ now: {
5601
+ subtotal_pence: number;
5602
+ tax_pence: number;
5603
+ total_pence: number;
5604
+ tax_label?: string | null | undefined;
5605
+ reverse_charge: boolean;
5606
+ country?: string | null | undefined;
5607
+ taxability_reason?: string | null | undefined;
5608
+ lines: {
5609
+ reference: string;
5610
+ subtotal_pence: number;
5611
+ tax_pence: number;
5612
+ }[];
5613
+ };
5614
+ renewal: {
5615
+ subtotal_pence: number;
5616
+ tax_pence: number;
5617
+ total_pence: number;
5618
+ tax_label?: string | null | undefined;
5619
+ reverse_charge: boolean;
5620
+ country?: string | null | undefined;
5621
+ taxability_reason?: string | null | undefined;
5622
+ lines: {
5623
+ reference: string;
5624
+ subtotal_pence: number;
5625
+ tax_pence: number;
5626
+ }[];
5627
+ };
5628
+ }>;
5629
+ /** A fresh, short-lived Stripe customer-portal link (card, address, receipts). */
5630
+ declare function billingPortal(arbi: ArbiClient, projectExtId: string): Promise<{
5631
+ url: string;
5632
+ }>;
5647
5633
  /**
5648
- * A person finishes a step of a workflow run: completes a form (its inputs join the run's), an upload
5649
- * or a review (the approval), or skips a step. The run then goes on to its next agent step.
5634
+ * Buy one add-on block, charged now and renewed every period until reduced. `requires_action`
5635
+ * comes with a `confirm_url` when the bank wants 3-D Secure; 402 `{code, message}` is a refusal.
5650
5636
  */
5651
- declare function actOnStep(arbi: ArbiClient, conversationId: string, body: StepActionRequest): Promise<ConversationResponse>;
5652
- /** Complete a person step (a form's or a fielded review's `inputs` join the run's inputs). */
5653
- declare function completeStep(arbi: ArbiClient, conversationId: string, step: string, inputs?: Record<string, unknown> | null): Promise<ConversationResponse>;
5654
- /** Skip a step (any unfinished one, a failed agent step too), so what waits for it can go on. */
5655
- declare function skipStep(arbi: ArbiClient, conversationId: string, step: string): Promise<ConversationResponse>;
5637
+ declare function addAddonBlock(arbi: ArbiClient, projectExtId: string, kind: ProjectAddonKind): Promise<{
5638
+ status: "paid" | "requires_action";
5639
+ confirm_url?: string | null | undefined;
5640
+ project: {
5641
+ external_id: string;
5642
+ name: string;
5643
+ created_by: string;
5644
+ subscription: string;
5645
+ created_at: string;
5646
+ quotas: {
5647
+ storage_gb: {
5648
+ used: number;
5649
+ limit: number;
5650
+ };
5651
+ ai_usage: {
5652
+ used: number;
5653
+ limit: number;
5654
+ };
5655
+ collaborators: {
5656
+ used: number;
5657
+ limit: number;
5658
+ };
5659
+ budget_reset_at?: number | null | undefined;
5660
+ };
5661
+ daily_cap_per_user?: number | null | undefined;
5662
+ budget?: {
5663
+ amount: number;
5664
+ currency: string;
5665
+ } | null | undefined;
5666
+ client?: string | null | undefined;
5667
+ client_ref?: string | null | undefined;
5668
+ stage?: string | null | undefined;
5669
+ stage_changed_at?: string | null | undefined;
5670
+ lead_user?: string | null | undefined;
5671
+ fields?: {
5672
+ [x: string]: unknown;
5673
+ } | undefined;
5674
+ field_schema?: {
5675
+ key: string;
5676
+ label?: string | null | undefined;
5677
+ type: "text" | "number" | "date" | "checkbox" | "select" | "person" | "document" | "relation" | "lookup" | "rollup" | "tag";
5678
+ options?: string[] | null | undefined;
5679
+ }[] | null | undefined;
5680
+ plan_interval?: ("month" | "year") | null | undefined;
5681
+ packs: number;
5682
+ plan_change?: {
5683
+ result: "upgraded" | "scheduled" | "unchanged" | "requires_action";
5684
+ charged_pence: number;
5685
+ charged_ex_vat_pence: number;
5686
+ confirm_url?: string | null | undefined;
5687
+ } | null | undefined;
5688
+ addons?: {
5689
+ packs: number;
5690
+ packs_next?: number | null | undefined;
5691
+ plan_name: string;
5692
+ plan_ai_gbp: number;
5693
+ plan_storage_gb: number;
5694
+ block_ai_gbp: number;
5695
+ block_storage_gb: number;
5696
+ ai_blocks: number;
5697
+ storage_blocks: number;
5698
+ legacy_ai_blocks: number;
5699
+ legacy_storage_blocks: number;
5700
+ legacy_block_ai_gbp: number;
5701
+ legacy_block_storage_gb: number;
5702
+ blocks_ai_gbp: number;
5703
+ blocks_storage_gb: number;
5704
+ ai_blocks_next?: number | null | undefined;
5705
+ storage_blocks_next?: number | null | undefined;
5706
+ storage_blocks_min: number;
5707
+ auto_topup_threshold_gbp: number;
5708
+ min_auto_topup_threshold_gbp: number;
5709
+ spend_cap_pence?: number | null | undefined;
5710
+ addon_spend_pence: number;
5711
+ auto_spent_pence: number;
5712
+ addon_spend_window_end?: number | null | undefined;
5713
+ manual_spent_pence: number;
5714
+ cap_left_pence?: number | null | undefined;
5715
+ ai_used_gbp: number;
5716
+ ai_allowance_gbp: number;
5717
+ ai_allowance_next_gbp: number;
5718
+ storage_used_gb: number;
5719
+ storage_allowance_gb: number;
5720
+ storage_allowance_next_gb: number;
5721
+ ai_block_monthly_pence: number;
5722
+ ai_block_monthly_ex_vat_pence: number;
5723
+ storage_block_monthly_pence: number;
5724
+ storage_block_monthly_ex_vat_pence: number;
5725
+ ai_block_period_pence: number;
5726
+ ai_block_period_ex_vat_pence: number;
5727
+ storage_block_period_pence: number;
5728
+ storage_block_period_ex_vat_pence: number;
5729
+ ai_block_price_pence: number;
5730
+ ai_block_price_ex_vat_pence: number;
5731
+ storage_block_price_pence: number;
5732
+ storage_block_price_ex_vat_pence: number;
5733
+ cap_reached: boolean;
5734
+ period_end?: number | null | undefined;
5735
+ ai_usage_reset_at?: number | null | undefined;
5736
+ pending_interval?: ("month" | "year") | null | undefined;
5737
+ billing_error?: string | null | undefined;
5738
+ confirm_url?: string | null | undefined;
5739
+ payment?: {
5740
+ status: "pending" | "paid";
5741
+ kind?: ("ai_usage" | "storage") | null | undefined;
5742
+ amount_pence?: number | null | undefined;
5743
+ amount_ex_vat_pence?: number | null | undefined;
5744
+ tax_pence?: number | null | undefined;
5745
+ at?: number | null | undefined;
5746
+ confirm_url?: string | null | undefined;
5747
+ } | null | undefined;
5748
+ } | null | undefined;
5749
+ price_id?: string | null | undefined;
5750
+ plan?: string | null | undefined;
5751
+ amount?: number | null | undefined;
5752
+ amount_ex_vat?: number | null | undefined;
5753
+ currency?: string | null | undefined;
5754
+ current_period_end?: number | null | undefined;
5755
+ cancel_at_period_end?: boolean | null | undefined;
5756
+ portal_url?: string | null | undefined;
5757
+ };
5758
+ }>;
5759
+ /** How many add-on blocks to keep from the next period (reductions only; no refunds). */
5760
+ declare function setNextPeriodAddons(arbi: ArbiClient, projectExtId: string, body: ProjectNextPeriodAddonsRequest): Promise<{
5761
+ external_id: string;
5762
+ name: string;
5763
+ created_by: string;
5764
+ subscription: string;
5765
+ created_at: string;
5766
+ quotas: {
5767
+ storage_gb: {
5768
+ used: number;
5769
+ limit: number;
5770
+ };
5771
+ ai_usage: {
5772
+ used: number;
5773
+ limit: number;
5774
+ };
5775
+ collaborators: {
5776
+ used: number;
5777
+ limit: number;
5778
+ };
5779
+ budget_reset_at?: number | null | undefined;
5780
+ };
5781
+ daily_cap_per_user?: number | null | undefined;
5782
+ budget?: {
5783
+ amount: number;
5784
+ currency: string;
5785
+ } | null | undefined;
5786
+ client?: string | null | undefined;
5787
+ client_ref?: string | null | undefined;
5788
+ stage?: string | null | undefined;
5789
+ stage_changed_at?: string | null | undefined;
5790
+ lead_user?: string | null | undefined;
5791
+ fields?: {
5792
+ [x: string]: unknown;
5793
+ } | undefined;
5794
+ field_schema?: {
5795
+ key: string;
5796
+ label?: string | null | undefined;
5797
+ type: "text" | "number" | "date" | "checkbox" | "select" | "person" | "document" | "relation" | "lookup" | "rollup" | "tag";
5798
+ options?: string[] | null | undefined;
5799
+ }[] | null | undefined;
5800
+ plan_interval?: ("month" | "year") | null | undefined;
5801
+ packs: number;
5802
+ plan_change?: {
5803
+ result: "upgraded" | "scheduled" | "unchanged" | "requires_action";
5804
+ charged_pence: number;
5805
+ charged_ex_vat_pence: number;
5806
+ confirm_url?: string | null | undefined;
5807
+ } | null | undefined;
5808
+ addons?: {
5809
+ packs: number;
5810
+ packs_next?: number | null | undefined;
5811
+ plan_name: string;
5812
+ plan_ai_gbp: number;
5813
+ plan_storage_gb: number;
5814
+ block_ai_gbp: number;
5815
+ block_storage_gb: number;
5816
+ ai_blocks: number;
5817
+ storage_blocks: number;
5818
+ legacy_ai_blocks: number;
5819
+ legacy_storage_blocks: number;
5820
+ legacy_block_ai_gbp: number;
5821
+ legacy_block_storage_gb: number;
5822
+ blocks_ai_gbp: number;
5823
+ blocks_storage_gb: number;
5824
+ ai_blocks_next?: number | null | undefined;
5825
+ storage_blocks_next?: number | null | undefined;
5826
+ storage_blocks_min: number;
5827
+ auto_topup_threshold_gbp: number;
5828
+ min_auto_topup_threshold_gbp: number;
5829
+ spend_cap_pence?: number | null | undefined;
5830
+ addon_spend_pence: number;
5831
+ auto_spent_pence: number;
5832
+ addon_spend_window_end?: number | null | undefined;
5833
+ manual_spent_pence: number;
5834
+ cap_left_pence?: number | null | undefined;
5835
+ ai_used_gbp: number;
5836
+ ai_allowance_gbp: number;
5837
+ ai_allowance_next_gbp: number;
5838
+ storage_used_gb: number;
5839
+ storage_allowance_gb: number;
5840
+ storage_allowance_next_gb: number;
5841
+ ai_block_monthly_pence: number;
5842
+ ai_block_monthly_ex_vat_pence: number;
5843
+ storage_block_monthly_pence: number;
5844
+ storage_block_monthly_ex_vat_pence: number;
5845
+ ai_block_period_pence: number;
5846
+ ai_block_period_ex_vat_pence: number;
5847
+ storage_block_period_pence: number;
5848
+ storage_block_period_ex_vat_pence: number;
5849
+ ai_block_price_pence: number;
5850
+ ai_block_price_ex_vat_pence: number;
5851
+ storage_block_price_pence: number;
5852
+ storage_block_price_ex_vat_pence: number;
5853
+ cap_reached: boolean;
5854
+ period_end?: number | null | undefined;
5855
+ ai_usage_reset_at?: number | null | undefined;
5856
+ pending_interval?: ("month" | "year") | null | undefined;
5857
+ billing_error?: string | null | undefined;
5858
+ confirm_url?: string | null | undefined;
5859
+ payment?: {
5860
+ status: "pending" | "paid";
5861
+ kind?: ("ai_usage" | "storage") | null | undefined;
5862
+ amount_pence?: number | null | undefined;
5863
+ amount_ex_vat_pence?: number | null | undefined;
5864
+ tax_pence?: number | null | undefined;
5865
+ at?: number | null | undefined;
5866
+ confirm_url?: string | null | undefined;
5867
+ } | null | undefined;
5868
+ } | null | undefined;
5869
+ price_id?: string | null | undefined;
5870
+ plan?: string | null | undefined;
5871
+ amount?: number | null | undefined;
5872
+ amount_ex_vat?: number | null | undefined;
5873
+ currency?: string | null | undefined;
5874
+ current_period_end?: number | null | undefined;
5875
+ cancel_at_period_end?: boolean | null | undefined;
5876
+ portal_url?: string | null | undefined;
5877
+ }>;
5878
+ /** A Pro project's add-on settings: the auto top-up threshold and the monthly usage cap. */
5879
+ declare function updateAddonSettings(arbi: ArbiClient, projectExtId: string, body: ProjectAddonSettingsRequest): Promise<{
5880
+ external_id: string;
5881
+ name: string;
5882
+ created_by: string;
5883
+ subscription: string;
5884
+ created_at: string;
5885
+ quotas: {
5886
+ storage_gb: {
5887
+ used: number;
5888
+ limit: number;
5889
+ };
5890
+ ai_usage: {
5891
+ used: number;
5892
+ limit: number;
5893
+ };
5894
+ collaborators: {
5895
+ used: number;
5896
+ limit: number;
5897
+ };
5898
+ budget_reset_at?: number | null | undefined;
5899
+ };
5900
+ daily_cap_per_user?: number | null | undefined;
5901
+ budget?: {
5902
+ amount: number;
5903
+ currency: string;
5904
+ } | null | undefined;
5905
+ client?: string | null | undefined;
5906
+ client_ref?: string | null | undefined;
5907
+ stage?: string | null | undefined;
5908
+ stage_changed_at?: string | null | undefined;
5909
+ lead_user?: string | null | undefined;
5910
+ fields?: {
5911
+ [x: string]: unknown;
5912
+ } | undefined;
5913
+ field_schema?: {
5914
+ key: string;
5915
+ label?: string | null | undefined;
5916
+ type: "text" | "number" | "date" | "checkbox" | "select" | "person" | "document" | "relation" | "lookup" | "rollup" | "tag";
5917
+ options?: string[] | null | undefined;
5918
+ }[] | null | undefined;
5919
+ plan_interval?: ("month" | "year") | null | undefined;
5920
+ packs: number;
5921
+ plan_change?: {
5922
+ result: "upgraded" | "scheduled" | "unchanged" | "requires_action";
5923
+ charged_pence: number;
5924
+ charged_ex_vat_pence: number;
5925
+ confirm_url?: string | null | undefined;
5926
+ } | null | undefined;
5927
+ addons?: {
5928
+ packs: number;
5929
+ packs_next?: number | null | undefined;
5930
+ plan_name: string;
5931
+ plan_ai_gbp: number;
5932
+ plan_storage_gb: number;
5933
+ block_ai_gbp: number;
5934
+ block_storage_gb: number;
5935
+ ai_blocks: number;
5936
+ storage_blocks: number;
5937
+ legacy_ai_blocks: number;
5938
+ legacy_storage_blocks: number;
5939
+ legacy_block_ai_gbp: number;
5940
+ legacy_block_storage_gb: number;
5941
+ blocks_ai_gbp: number;
5942
+ blocks_storage_gb: number;
5943
+ ai_blocks_next?: number | null | undefined;
5944
+ storage_blocks_next?: number | null | undefined;
5945
+ storage_blocks_min: number;
5946
+ auto_topup_threshold_gbp: number;
5947
+ min_auto_topup_threshold_gbp: number;
5948
+ spend_cap_pence?: number | null | undefined;
5949
+ addon_spend_pence: number;
5950
+ auto_spent_pence: number;
5951
+ addon_spend_window_end?: number | null | undefined;
5952
+ manual_spent_pence: number;
5953
+ cap_left_pence?: number | null | undefined;
5954
+ ai_used_gbp: number;
5955
+ ai_allowance_gbp: number;
5956
+ ai_allowance_next_gbp: number;
5957
+ storage_used_gb: number;
5958
+ storage_allowance_gb: number;
5959
+ storage_allowance_next_gb: number;
5960
+ ai_block_monthly_pence: number;
5961
+ ai_block_monthly_ex_vat_pence: number;
5962
+ storage_block_monthly_pence: number;
5963
+ storage_block_monthly_ex_vat_pence: number;
5964
+ ai_block_period_pence: number;
5965
+ ai_block_period_ex_vat_pence: number;
5966
+ storage_block_period_pence: number;
5967
+ storage_block_period_ex_vat_pence: number;
5968
+ ai_block_price_pence: number;
5969
+ ai_block_price_ex_vat_pence: number;
5970
+ storage_block_price_pence: number;
5971
+ storage_block_price_ex_vat_pence: number;
5972
+ cap_reached: boolean;
5973
+ period_end?: number | null | undefined;
5974
+ ai_usage_reset_at?: number | null | undefined;
5975
+ pending_interval?: ("month" | "year") | null | undefined;
5976
+ billing_error?: string | null | undefined;
5977
+ confirm_url?: string | null | undefined;
5978
+ payment?: {
5979
+ status: "pending" | "paid";
5980
+ kind?: ("ai_usage" | "storage") | null | undefined;
5981
+ amount_pence?: number | null | undefined;
5982
+ amount_ex_vat_pence?: number | null | undefined;
5983
+ tax_pence?: number | null | undefined;
5984
+ at?: number | null | undefined;
5985
+ confirm_url?: string | null | undefined;
5986
+ } | null | undefined;
5987
+ } | null | undefined;
5988
+ price_id?: string | null | undefined;
5989
+ plan?: string | null | undefined;
5990
+ amount?: number | null | undefined;
5991
+ amount_ex_vat?: number | null | undefined;
5992
+ currency?: string | null | undefined;
5993
+ current_period_end?: number | null | undefined;
5994
+ cancel_at_period_end?: boolean | null | undefined;
5995
+ portal_url?: string | null | undefined;
5996
+ }>;
5997
+ /** Move a Pro project to Free at the end of the period (no refunds). */
5998
+ declare function cancelSubscription(arbi: ArbiClient, projectExtId: string): Promise<{
5999
+ external_id: string;
6000
+ name: string;
6001
+ created_by: string;
6002
+ subscription: string;
6003
+ created_at: string;
6004
+ quotas: {
6005
+ storage_gb: {
6006
+ used: number;
6007
+ limit: number;
6008
+ };
6009
+ ai_usage: {
6010
+ used: number;
6011
+ limit: number;
6012
+ };
6013
+ collaborators: {
6014
+ used: number;
6015
+ limit: number;
6016
+ };
6017
+ budget_reset_at?: number | null | undefined;
6018
+ };
6019
+ daily_cap_per_user?: number | null | undefined;
6020
+ budget?: {
6021
+ amount: number;
6022
+ currency: string;
6023
+ } | null | undefined;
6024
+ client?: string | null | undefined;
6025
+ client_ref?: string | null | undefined;
6026
+ stage?: string | null | undefined;
6027
+ stage_changed_at?: string | null | undefined;
6028
+ lead_user?: string | null | undefined;
6029
+ fields?: {
6030
+ [x: string]: unknown;
6031
+ } | undefined;
6032
+ field_schema?: {
6033
+ key: string;
6034
+ label?: string | null | undefined;
6035
+ type: "text" | "number" | "date" | "checkbox" | "select" | "person" | "document" | "relation" | "lookup" | "rollup" | "tag";
6036
+ options?: string[] | null | undefined;
6037
+ }[] | null | undefined;
6038
+ plan_interval?: ("month" | "year") | null | undefined;
6039
+ packs: number;
6040
+ plan_change?: {
6041
+ result: "upgraded" | "scheduled" | "unchanged" | "requires_action";
6042
+ charged_pence: number;
6043
+ charged_ex_vat_pence: number;
6044
+ confirm_url?: string | null | undefined;
6045
+ } | null | undefined;
6046
+ addons?: {
6047
+ packs: number;
6048
+ packs_next?: number | null | undefined;
6049
+ plan_name: string;
6050
+ plan_ai_gbp: number;
6051
+ plan_storage_gb: number;
6052
+ block_ai_gbp: number;
6053
+ block_storage_gb: number;
6054
+ ai_blocks: number;
6055
+ storage_blocks: number;
6056
+ legacy_ai_blocks: number;
6057
+ legacy_storage_blocks: number;
6058
+ legacy_block_ai_gbp: number;
6059
+ legacy_block_storage_gb: number;
6060
+ blocks_ai_gbp: number;
6061
+ blocks_storage_gb: number;
6062
+ ai_blocks_next?: number | null | undefined;
6063
+ storage_blocks_next?: number | null | undefined;
6064
+ storage_blocks_min: number;
6065
+ auto_topup_threshold_gbp: number;
6066
+ min_auto_topup_threshold_gbp: number;
6067
+ spend_cap_pence?: number | null | undefined;
6068
+ addon_spend_pence: number;
6069
+ auto_spent_pence: number;
6070
+ addon_spend_window_end?: number | null | undefined;
6071
+ manual_spent_pence: number;
6072
+ cap_left_pence?: number | null | undefined;
6073
+ ai_used_gbp: number;
6074
+ ai_allowance_gbp: number;
6075
+ ai_allowance_next_gbp: number;
6076
+ storage_used_gb: number;
6077
+ storage_allowance_gb: number;
6078
+ storage_allowance_next_gb: number;
6079
+ ai_block_monthly_pence: number;
6080
+ ai_block_monthly_ex_vat_pence: number;
6081
+ storage_block_monthly_pence: number;
6082
+ storage_block_monthly_ex_vat_pence: number;
6083
+ ai_block_period_pence: number;
6084
+ ai_block_period_ex_vat_pence: number;
6085
+ storage_block_period_pence: number;
6086
+ storage_block_period_ex_vat_pence: number;
6087
+ ai_block_price_pence: number;
6088
+ ai_block_price_ex_vat_pence: number;
6089
+ storage_block_price_pence: number;
6090
+ storage_block_price_ex_vat_pence: number;
6091
+ cap_reached: boolean;
6092
+ period_end?: number | null | undefined;
6093
+ ai_usage_reset_at?: number | null | undefined;
6094
+ pending_interval?: ("month" | "year") | null | undefined;
6095
+ billing_error?: string | null | undefined;
6096
+ confirm_url?: string | null | undefined;
6097
+ payment?: {
6098
+ status: "pending" | "paid";
6099
+ kind?: ("ai_usage" | "storage") | null | undefined;
6100
+ amount_pence?: number | null | undefined;
6101
+ amount_ex_vat_pence?: number | null | undefined;
6102
+ tax_pence?: number | null | undefined;
6103
+ at?: number | null | undefined;
6104
+ confirm_url?: string | null | undefined;
6105
+ } | null | undefined;
6106
+ } | null | undefined;
6107
+ price_id?: string | null | undefined;
6108
+ plan?: string | null | undefined;
6109
+ amount?: number | null | undefined;
6110
+ amount_ex_vat?: number | null | undefined;
6111
+ currency?: string | null | undefined;
6112
+ current_period_end?: number | null | undefined;
6113
+ cancel_at_period_end?: boolean | null | undefined;
6114
+ portal_url?: string | null | undefined;
6115
+ }>;
6116
+
6117
+ type projects_ProductResponse = ProductResponse;
6118
+ type projects_ProjectAddonKind = ProjectAddonKind;
6119
+ type projects_ProjectAddonSettingsRequest = ProjectAddonSettingsRequest;
6120
+ type projects_ProjectBudget = ProjectBudget;
6121
+ type projects_ProjectCheckoutRequest = ProjectCheckoutRequest;
6122
+ type projects_ProjectConversationUsageResponse = ProjectConversationUsageResponse;
6123
+ type projects_ProjectCreateOptions = ProjectCreateOptions;
6124
+ type projects_ProjectDetails = ProjectDetails;
6125
+ type projects_ProjectEventKind = ProjectEventKind;
6126
+ type projects_ProjectEventResponse = ProjectEventResponse;
6127
+ type projects_ProjectInvoicesResponse = ProjectInvoicesResponse;
6128
+ type projects_ProjectNextPeriodAddonsRequest = ProjectNextPeriodAddonsRequest;
6129
+ type projects_ProjectPlanChangeRequest = ProjectPlanChangeRequest;
6130
+ type projects_ProjectQuoteRequest = ProjectQuoteRequest;
6131
+ type projects_ProjectResponse = ProjectResponse;
6132
+ type projects_ProjectUpdateRequest = ProjectUpdateRequest;
6133
+ type projects_ProjectUsageResponse = ProjectUsageResponse;
6134
+ type projects_TaxQuoteResponse = TaxQuoteResponse;
6135
+ type projects_UserDailyUsageResponse = UserDailyUsageResponse;
6136
+ declare const projects_addAddonBlock: typeof addAddonBlock;
6137
+ declare const projects_billingPortal: typeof billingPortal;
6138
+ declare const projects_cancelSubscription: typeof cancelSubscription;
6139
+ declare const projects_changePlan: typeof changePlan;
6140
+ declare const projects_createCheckout: typeof createCheckout;
6141
+ declare const projects_createProject: typeof createProject;
6142
+ declare const projects_deleteProject: typeof deleteProject;
6143
+ declare const projects_formatBudget: typeof formatBudget;
6144
+ declare const projects_getProjectConversationUsage: typeof getProjectConversationUsage;
6145
+ declare const projects_getProjectInvoices: typeof getProjectInvoices;
6146
+ declare const projects_getProjectUsage: typeof getProjectUsage;
6147
+ declare const projects_getUserUsageToday: typeof getUserUsageToday;
6148
+ declare const projects_listProducts: typeof listProducts;
6149
+ declare const projects_listProjectEvents: typeof listProjectEvents;
6150
+ declare const projects_listProjects: typeof listProjects;
6151
+ declare const projects_parseBudget: typeof parseBudget;
6152
+ declare const projects_previewPlanChange: typeof previewPlanChange;
6153
+ declare const projects_quoteAddon: typeof quoteAddon;
6154
+ declare const projects_quotePlan: typeof quotePlan;
6155
+ declare const projects_refreshProject: typeof refreshProject;
6156
+ declare const projects_renameProject: typeof renameProject;
6157
+ declare const projects_setNextPeriodAddons: typeof setNextPeriodAddons;
6158
+ declare const projects_updateAddonSettings: typeof updateAddonSettings;
6159
+ declare const projects_updateProject: typeof updateProject;
6160
+ declare namespace projects {
6161
+ export { type projects_ProductResponse as ProductResponse, type projects_ProjectAddonKind as ProjectAddonKind, type projects_ProjectAddonSettingsRequest as ProjectAddonSettingsRequest, type projects_ProjectBudget as ProjectBudget, type projects_ProjectCheckoutRequest as ProjectCheckoutRequest, type projects_ProjectConversationUsageResponse as ProjectConversationUsageResponse, type projects_ProjectCreateOptions as ProjectCreateOptions, type projects_ProjectDetails as ProjectDetails, type projects_ProjectEventKind as ProjectEventKind, type projects_ProjectEventResponse as ProjectEventResponse, type projects_ProjectInvoicesResponse as ProjectInvoicesResponse, type projects_ProjectNextPeriodAddonsRequest as ProjectNextPeriodAddonsRequest, type projects_ProjectPlanChangeRequest as ProjectPlanChangeRequest, type projects_ProjectQuoteRequest as ProjectQuoteRequest, type projects_ProjectResponse as ProjectResponse, type projects_ProjectUpdateRequest as ProjectUpdateRequest, type projects_ProjectUsageResponse as ProjectUsageResponse, type projects_TaxQuoteResponse as TaxQuoteResponse, type projects_UserDailyUsageResponse as UserDailyUsageResponse, projects_addAddonBlock as addAddonBlock, projects_billingPortal as billingPortal, projects_cancelSubscription as cancelSubscription, projects_changePlan as changePlan, projects_createCheckout as createCheckout, projects_createProject as createProject, projects_deleteProject as deleteProject, projects_formatBudget as formatBudget, projects_getProjectConversationUsage as getProjectConversationUsage, projects_getProjectInvoices as getProjectInvoices, projects_getProjectUsage as getProjectUsage, projects_getUserUsageToday as getUserUsageToday, projects_listProducts as listProducts, projects_listProjectEvents as listProjectEvents, projects_listProjects as listProjects, projects_parseBudget as parseBudget, projects_previewPlanChange as previewPlanChange, projects_quoteAddon as quoteAddon, projects_quotePlan as quotePlan, projects_refreshProject as refreshProject, projects_renameProject as renameProject, projects_setNextPeriodAddons as setNextPeriodAddons, projects_updateAddonSettings as updateAddonSettings, projects_updateProject as updateProject };
6162
+ }
6163
+
6164
+ /**
6165
+ * Stepped workflows: a run is a work conversation whose plan has named steps (`TaskPlan.steps`).
6166
+ * Form, upload and review steps wait for a person (`work.actOnStep`); an agent step is a turn the
6167
+ * assistant takes in the thread. Where a run is lives in the conversation's activity log: each
6168
+ * step's `step_started` / `step_done` / `step_skipped` / `step_failed` event, the latest winning. A
6169
+ * `step_sent_back` reopens the step it names and every step after it (pending again); `step_ready`
6170
+ * records that a ready person step's assignee was told; `step_signal` is a signal a done step raised,
6171
+ * and `linked_run` the thread a linked workflow started on it. An agent step whose `step_waiting`
6172
+ * (then `step_progress`, as the set shrinks) carries `waiting.documents` waits for those documents
6173
+ * to finish processing before its turn starts.
6174
+ *
6175
+ * Pure functions over the API's own types (`TaskPlanStep`, `ActivityResponse`), for any client: the
6176
+ * CLI's `arbi run steps`, scripts and agents. They mirror the server (`src/core/workflow_steps.py`).
6177
+ *
6178
+ * NOTE: `@arbidocs/blocks` has the same model over its UI step type (`agents/workflows/run.ts`:
6179
+ * `stepDependencies`, `stepStatesFromActivity`, `stepPhase`, `validateWorkflowGraph`). Blocks is
6180
+ * deliberately SDK-free (it depends on `@arbidocs/client` only), so it cannot import this module;
6181
+ * the few lines both need are duplicated. Change them together.
6182
+ */
6183
+
6184
+ type TaskPlanStep = components['schemas']['TaskPlanStep'];
6185
+ type StepKind = TaskPlanStep['kind'];
6186
+ /** A signal a step raises when it is done and its condition holds. */
6187
+ type StepSignal = components['schemas']['StepSignal'];
6188
+ type StepSignalWhen = components['schemas']['StepSignalWhen'];
6189
+ /** Who a step is for: one of `user`, `run_owner`, `input` or `project_lead`. */
6190
+ type StepAssignee = components['schemas']['StepAssignee'];
6191
+ /** What the activity log says about a step: nothing yet (`pending`), or its latest event. */
6192
+ type StepStatus = 'pending' | 'running' | 'done' | 'skipped' | 'failed';
6193
+ /**
6194
+ * Where a step stands in a run: `pending` while something it waits for is unfinished, `ready`
6195
+ * once everything it waits for is done or skipped, then its own status.
6196
+ */
6197
+ /** `waiting`: an action step started and now waits for people (signers to sign, a draft to be sent). */
6198
+ type StepPhase = 'pending' | 'ready' | 'running' | 'waiting' | 'done' | 'skipped' | 'failed';
6199
+ interface StepState {
6200
+ status: StepStatus;
6201
+ /** The step's answer in the thread (an agent step: a message id), or what a branch delivered. */
6202
+ responseId: string | null;
6203
+ error: string | null;
6204
+ /** Reopened by a send-back to this very step, and not touched since. */
6205
+ sentBack: boolean;
6206
+ /** The send-back came with a note (encrypted in the log; an agent step runs again with it). */
6207
+ hasNote: boolean;
6208
+ /** Who was told the step is ready (`usr-` / `agt-`), since it last changed. */
6209
+ announcedTo: string | null;
6210
+ /**
6211
+ * The documents (ids) an agent step waits on to finish processing before its turn starts, as
6212
+ * its latest `step_waiting` / `step_progress` says; empty once it starts (or never waited).
6213
+ */
6214
+ waitingDocuments: string[];
6215
+ /**
6216
+ * What a started action step waits for (`sign`, `email_draft`), as its latest `step_waiting` says,
6217
+ * and the document it is about (a signature request's document); null when it waits on nothing.
6218
+ */
6219
+ waitingAction: string | null;
6220
+ waitingDocument: string | null;
6221
+ }
6222
+ /** One entry of a conversation's activity log, as far as steps are concerned. */
6223
+ interface StepActivityEvent {
6224
+ kind: string;
6225
+ detail?: Record<string, unknown> | null;
6226
+ actor_ext_id?: string | null;
6227
+ created_at?: string;
6228
+ }
6229
+ declare const STEP_KINDS: readonly StepKind[];
6230
+ /** What an `action` step does with a platform feature (`src/core/workflow_actions.py`). */
6231
+ declare const STEP_ACTION_TYPES: readonly ["sign", "email_draft", "tabular_review"];
6232
+ declare const PERSON_STEP_KINDS: readonly StepKind[];
6233
+ /** The server's step id rule. */
6234
+ declare const STEP_ID_PATTERN: RegExp;
6235
+ declare const isPersonStep: (step: Pick<TaskPlanStep, "kind">) => boolean;
6236
+ /** What a step waits for: its `after`, else the step before it in the list (a sequence). */
6237
+ declare function stepDependencies(steps: Pick<TaskPlanStep, 'id' | 'after'>[], id: string): string[];
6238
+ /** "Waiting for 3 documents to finish processing" (one: "1 document"). */
6239
+ declare function waitingForDocumentsText(count: number): string;
6240
+ /**
6241
+ * Each step's state from the activity log (oldest first): its latest step event wins. A send-back
6242
+ * reopens the steps it lists as pending (only the one it went `to` is `sentBack`); a `step_ready`
6243
+ * records who was told, and a `step_waiting` / `step_progress` the documents an agent step waits
6244
+ * on, until the step's next change.
6245
+ */
6246
+ declare function stepStatesFromActivity(events: StepActivityEvent[]): Record<string, StepState>;
6247
+ /** A signal a done step raised (`step_signal`). */
6248
+ interface RaisedSignal {
6249
+ step: string;
6250
+ signal: string;
6251
+ at: string | null;
6252
+ }
6253
+ /** A thread a linked workflow started on a signal raised in this run (`linked_run`). */
6254
+ interface LinkedRun {
6255
+ step: string | null;
6256
+ signal: string | null;
6257
+ /** The new thread (`con-…`). */
6258
+ conversationId: string;
6259
+ /** The workflow that started it (`wfl-…`). */
6260
+ workflowId: string | null;
6261
+ at: string | null;
6262
+ }
6263
+ /** A person sent the work back from `step` to `to` (`step_sent_back`). */
6264
+ interface SendBack {
6265
+ step: string;
6266
+ to: string;
6267
+ /** `to` and every step after it: pending again. */
6268
+ reopened: string[];
6269
+ hasNote: boolean;
6270
+ by: string | null;
6271
+ at: string | null;
6272
+ }
6273
+ /** The signals the run's steps raised, oldest first. */
6274
+ declare function raisedSignals(events: StepActivityEvent[]): RaisedSignal[];
6275
+ /** The threads linked workflows started from this run's signals, oldest first. */
6276
+ declare function linkedRuns(events: StepActivityEvent[]): LinkedRun[];
6277
+ /** Every send-back in the run, oldest first. */
6278
+ declare function sendBacks(events: StepActivityEvent[]): SendBack[];
6279
+ /** Where one step stands: its own status once it has one, else `ready` or `pending`. */
6280
+ declare function stepPhase(steps: Pick<TaskPlanStep, 'id' | 'after'>[], states: Record<string, StepState>, id: string): StepPhase;
6281
+ interface RunStep {
6282
+ id: string;
6283
+ title: string;
6284
+ kind: StepKind;
6285
+ phase: StepPhase;
6286
+ /** What it waits for (its `after`, or the step before it). */
6287
+ after: string[];
6288
+ /** A done agent step's answer: the assistant message id in the thread. */
6289
+ responseId: string | null;
6290
+ error: string | null;
6291
+ /** Who the step is for (from the plan), or null: the run's owner hears of it. */
6292
+ assignee: StepAssignee | null;
6293
+ /** Who was told it is ready, since it last changed (`usr-` / `agt-`). */
6294
+ announcedTo: string | null;
6295
+ /** Reopened by a send-back to it and not touched since (`hasNote`: with a note). */
6296
+ sentBack: boolean;
6297
+ hasNote: boolean;
6298
+ /** How many times work was sent back to this step. */
6299
+ timesSentBack: number;
6300
+ /** The signals this step raised (each name once, first raised first). */
6301
+ signals: string[];
6302
+ /** The threads linked workflows started on this step's signals. */
6303
+ linkedRuns: LinkedRun[];
6304
+ /** The documents (ids) it waits on to finish processing before its turn starts. */
6305
+ waitingDocuments: string[];
6306
+ /** A started action step waiting for people: what for (`sign`, `email_draft`), and its document. */
6307
+ waitingAction: string | null;
6308
+ waitingDocument: string | null;
6309
+ }
6310
+ /** A run's steps with where each stands, in plan order. */
6311
+ declare function runSteps(steps: TaskPlanStep[], events: StepActivityEvent[]): RunStep[];
6312
+ /** Who a step is for, in words: `run owner`, `project lead`, `input:<field>` or the user id. */
6313
+ declare function describeAssignee(assignee: StepAssignee | null | undefined): string;
6314
+ /** The step a server-sent message starts (its `tools.workflow_step` marker), or null. */
6315
+ declare function messageWorkflowStep(message: {
6316
+ tools?: Record<string, unknown> | null;
6317
+ }): string | null;
6318
+ /**
6319
+ * What a run waits for now:
6320
+ * - `agent`: a step is running, or an agent step is ready (the server starts it next);
6321
+ * - `person`: a form, upload or review is ready for someone to complete or skip;
6322
+ * - `finished`: every step is done or skipped;
6323
+ * - `stuck`: nothing can move (a failed step that others wait for): skip it to go on.
6324
+ */
6325
+ type RunWaitingOn = 'agent' | 'person' | 'finished' | 'stuck';
6326
+ declare function runWaitingOn(run: RunStep[]): RunWaitingOn;
6327
+ /**
6328
+ * A field a step asks for: a step's `fields` (what completing it is checked against, e.g. a rating
6329
+ * at a review), or a form's `ui.fields` (what the app's form renders).
6330
+ */
6331
+ interface StepField {
6332
+ name: string;
6333
+ type: string;
6334
+ label?: string | null;
6335
+ required?: boolean;
6336
+ options?: StepFieldOption[] | null;
6337
+ min?: number | null;
6338
+ max?: number | null;
6339
+ [key: string]: unknown;
6340
+ }
6341
+ /**
6342
+ * The tones a choice can be shown in (the blocks' `Tone`): e.g. a risk rating's low `success`,
6343
+ * medium `warning`, high `danger`. Display only: the server passes it through.
6344
+ */
6345
+ declare const STEP_FIELD_OPTION_TONES: readonly ["neutral", "info", "success", "warning", "danger", "accent", "ai"];
6346
+ type StepFieldOptionTone = (typeof STEP_FIELD_OPTION_TONES)[number];
6347
+ /** One choice of a `select` field. */
6348
+ interface StepFieldOption {
6349
+ value: string;
6350
+ label?: string | null;
6351
+ /** How the choice is coloured where it is picked, chosen or not. */
6352
+ tone?: StepFieldOptionTone | null;
6353
+ [key: string]: unknown;
6354
+ }
6355
+ /** The types a step's `fields` can have (the server's `StepField.type`). */
6356
+ declare const STEP_FIELD_TYPES: readonly ["text", "longtext", "boolean", "select", "number", "date", "scope", "documents", "person"];
6357
+ /**
6358
+ * The fields a step asks for: its `fields` when it declares them (any person step), else a form
6359
+ * step's `ui.fields`; none for an agent step.
6360
+ */
6361
+ declare function stepFields(step: Pick<TaskPlanStep, 'kind' | 'ui' | 'fields'>): StepField[];
6362
+ /** The required fields of a step still blank in `inputs` (the run's plus the new ones). */
6363
+ declare function missingRequiredFields(step: Pick<TaskPlanStep, 'kind' | 'ui' | 'fields'>, inputs: Record<string, unknown>): string[];
6364
+ /**
6365
+ * What the server would say about completing a step with `inputs` (`{name: problem}`, empty when
6366
+ * they fit), for a step that declares `fields`: `required`, `number`, `min`, `max`, `option`,
6367
+ * `type`, or `unknown` (a name the step does not ask for). A step without `fields` takes any inputs.
6368
+ */
6369
+ declare function checkStepInputs(step: Pick<TaskPlanStep, 'fields'>, inputs: Record<string, unknown> | null | undefined): Record<string, string>;
6370
+ /** A `checkStepInputs` result as one line: `rating: must be one of low, high; note: required`. */
6371
+ declare function describeInputProblems(step: Pick<TaskPlanStep, 'fields'>, problems: Record<string, string>): string;
6372
+ /**
6373
+ * `name=value` pairs (as typed on a command line) to inputs. A value is text unless the step's
6374
+ * field says otherwise: `number` fields become numbers, `boolean` fields `true` / `false`.
6375
+ */
6376
+ declare function parseInputPairs(pairs: string[], fields?: Pick<StepField, 'name' | 'type'>[]): Record<string, unknown>;
6377
+ /** The server's signal name rule. */
6378
+ declare const SIGNAL_NAME_PATTERN: RegExp;
6379
+ /** A list of what is wrong with a steps definition, each naming where (`steps[1].kind`). */
6380
+ declare class PlanStepsError extends Error {
6381
+ readonly problems: string[];
6382
+ constructor(problems: string[]);
6383
+ }
6384
+ /**
6385
+ * Check a steps definition and return it as the API's `TaskPlanStep[]`. Accepts a list of steps,
6386
+ * or an object with `steps` (e.g. a whole plan). Throws `PlanStepsError` listing every problem:
6387
+ * shape, ids, kinds, an agent step without a prompt or skill, and the graph (a duplicate id, an
6388
+ * `after` naming no step, a cycle, a step listed before one it waits for).
6389
+ */
6390
+ declare function parsePlanSteps(value: unknown): TaskPlanStep[];
6391
+ /** A plan holding only steps (what `createWork` and workflows take as `plan`). */
6392
+ declare function stepsPlan(steps: TaskPlanStep[]): components['schemas']['TaskPlan'];
6393
+
6394
+ type workflowSteps_LinkedRun = LinkedRun;
6395
+ declare const workflowSteps_PERSON_STEP_KINDS: typeof PERSON_STEP_KINDS;
6396
+ type workflowSteps_PlanStepsError = PlanStepsError;
6397
+ declare const workflowSteps_PlanStepsError: typeof PlanStepsError;
6398
+ type workflowSteps_RaisedSignal = RaisedSignal;
6399
+ type workflowSteps_RunStep = RunStep;
6400
+ type workflowSteps_RunWaitingOn = RunWaitingOn;
6401
+ declare const workflowSteps_SIGNAL_NAME_PATTERN: typeof SIGNAL_NAME_PATTERN;
6402
+ declare const workflowSteps_STEP_ACTION_TYPES: typeof STEP_ACTION_TYPES;
6403
+ declare const workflowSteps_STEP_FIELD_OPTION_TONES: typeof STEP_FIELD_OPTION_TONES;
6404
+ declare const workflowSteps_STEP_FIELD_TYPES: typeof STEP_FIELD_TYPES;
6405
+ declare const workflowSteps_STEP_ID_PATTERN: typeof STEP_ID_PATTERN;
6406
+ declare const workflowSteps_STEP_KINDS: typeof STEP_KINDS;
6407
+ type workflowSteps_SendBack = SendBack;
6408
+ type workflowSteps_StepActivityEvent = StepActivityEvent;
6409
+ type workflowSteps_StepAssignee = StepAssignee;
6410
+ type workflowSteps_StepField = StepField;
6411
+ type workflowSteps_StepFieldOption = StepFieldOption;
6412
+ type workflowSteps_StepFieldOptionTone = StepFieldOptionTone;
6413
+ type workflowSteps_StepKind = StepKind;
6414
+ type workflowSteps_StepPhase = StepPhase;
6415
+ type workflowSteps_StepSignal = StepSignal;
6416
+ type workflowSteps_StepSignalWhen = StepSignalWhen;
6417
+ type workflowSteps_StepState = StepState;
6418
+ type workflowSteps_StepStatus = StepStatus;
6419
+ type workflowSteps_TaskPlanStep = TaskPlanStep;
6420
+ declare const workflowSteps_checkStepInputs: typeof checkStepInputs;
6421
+ declare const workflowSteps_describeAssignee: typeof describeAssignee;
6422
+ declare const workflowSteps_describeInputProblems: typeof describeInputProblems;
6423
+ declare const workflowSteps_isPersonStep: typeof isPersonStep;
6424
+ declare const workflowSteps_linkedRuns: typeof linkedRuns;
6425
+ declare const workflowSteps_messageWorkflowStep: typeof messageWorkflowStep;
6426
+ declare const workflowSteps_missingRequiredFields: typeof missingRequiredFields;
6427
+ declare const workflowSteps_parseInputPairs: typeof parseInputPairs;
6428
+ declare const workflowSteps_parsePlanSteps: typeof parsePlanSteps;
6429
+ declare const workflowSteps_raisedSignals: typeof raisedSignals;
6430
+ declare const workflowSteps_runSteps: typeof runSteps;
6431
+ declare const workflowSteps_runWaitingOn: typeof runWaitingOn;
6432
+ declare const workflowSteps_sendBacks: typeof sendBacks;
6433
+ declare const workflowSteps_stepDependencies: typeof stepDependencies;
6434
+ declare const workflowSteps_stepFields: typeof stepFields;
6435
+ declare const workflowSteps_stepPhase: typeof stepPhase;
6436
+ declare const workflowSteps_stepStatesFromActivity: typeof stepStatesFromActivity;
6437
+ declare const workflowSteps_stepsPlan: typeof stepsPlan;
6438
+ declare const workflowSteps_waitingForDocumentsText: typeof waitingForDocumentsText;
6439
+ declare namespace workflowSteps {
6440
+ export { type workflowSteps_LinkedRun as LinkedRun, workflowSteps_PERSON_STEP_KINDS as PERSON_STEP_KINDS, workflowSteps_PlanStepsError as PlanStepsError, type workflowSteps_RaisedSignal as RaisedSignal, type workflowSteps_RunStep as RunStep, type workflowSteps_RunWaitingOn as RunWaitingOn, workflowSteps_SIGNAL_NAME_PATTERN as SIGNAL_NAME_PATTERN, workflowSteps_STEP_ACTION_TYPES as STEP_ACTION_TYPES, workflowSteps_STEP_FIELD_OPTION_TONES as STEP_FIELD_OPTION_TONES, workflowSteps_STEP_FIELD_TYPES as STEP_FIELD_TYPES, workflowSteps_STEP_ID_PATTERN as STEP_ID_PATTERN, workflowSteps_STEP_KINDS as STEP_KINDS, type workflowSteps_SendBack as SendBack, type workflowSteps_StepActivityEvent as StepActivityEvent, type workflowSteps_StepAssignee as StepAssignee, type workflowSteps_StepField as StepField, type workflowSteps_StepFieldOption as StepFieldOption, type workflowSteps_StepFieldOptionTone as StepFieldOptionTone, type workflowSteps_StepKind as StepKind, type workflowSteps_StepPhase as StepPhase, type workflowSteps_StepSignal as StepSignal, type workflowSteps_StepSignalWhen as StepSignalWhen, type workflowSteps_StepState as StepState, type workflowSteps_StepStatus as StepStatus, type workflowSteps_TaskPlanStep as TaskPlanStep, workflowSteps_checkStepInputs as checkStepInputs, workflowSteps_describeAssignee as describeAssignee, workflowSteps_describeInputProblems as describeInputProblems, workflowSteps_isPersonStep as isPersonStep, workflowSteps_linkedRuns as linkedRuns, workflowSteps_messageWorkflowStep as messageWorkflowStep, workflowSteps_missingRequiredFields as missingRequiredFields, workflowSteps_parseInputPairs as parseInputPairs, workflowSteps_parsePlanSteps as parsePlanSteps, workflowSteps_raisedSignals as raisedSignals, workflowSteps_runSteps as runSteps, workflowSteps_runWaitingOn as runWaitingOn, workflowSteps_sendBacks as sendBacks, workflowSteps_stepDependencies as stepDependencies, workflowSteps_stepFields as stepFields, workflowSteps_stepPhase as stepPhase, workflowSteps_stepStatesFromActivity as stepStatesFromActivity, workflowSteps_stepsPlan as stepsPlan, workflowSteps_waitingForDocumentsText as waitingForDocumentsText };
6441
+ }
6442
+
6443
+ /**
6444
+ * Work: a conversation with a `status` is a task. Create one, run it, mark it done, or plan it. Backend: `/v1/conversation/...` (docs/design/work-model.md).
6445
+ */
6446
+
6447
+ type ConversationResponse = components['schemas']['ConversationResponse'];
6448
+ type UpdateConversationRequest = components['schemas']['UpdateConversationRequest'];
6449
+ type CreateWorkRequest = components['schemas']['CreateWorkRequest'];
6450
+ type PendingAuthResponse = components['schemas']['PendingAuthResponse'];
6451
+ type PlanWorkRequest = components['schemas']['PlanWorkRequest'];
6452
+ type StepActionRequest = components['schemas']['StepActionRequest'];
6453
+ type TaskPlan = components['schemas']['TaskPlan'];
6454
+ type ActivityResponse = components['schemas']['ActivityResponse'];
6455
+ type ActivityKind = components['schemas']['ActivityKind'];
6456
+ type WorkStatus = components['schemas']['WorkStatus'];
6457
+ type ConversationUsageResponse = components['schemas']['ConversationUsageResponse'];
6458
+ /** One slice of a usage breakdown: spend (£), tokens and requests. */
6459
+ type UsageBreakdown = components['schemas']['TagBreakdown'];
6460
+ /** The authorization tier of a run: per-run temporary key, ask each run, or standing membership. */
6461
+ type AuthMode = components['schemas']['src__models__work__AuthMode'];
6462
+ /**
6463
+ * Update a conversation: title, sharing (`shared`, owner only), and the work fields (description, due
6464
+ * date, parent, `status` `todo | done`, plan). This one call replaces share, unshare
6465
+ * and rename.
6466
+ */
6467
+ declare function updateConversation(arbi: ArbiClient, conversationId: string, body: UpdateConversationRequest): Promise<ConversationResponse>;
6468
+ /** Create a work item. With a `prompt` / `skill_ref` the agent starts at once; otherwise a to-do. */
6469
+ declare function createWork(arbi: ArbiClient, body: CreateWorkRequest): Promise<ConversationResponse>;
6470
+ /** Run a work item now (or retry). Not while a run is live. */
6471
+ declare function runConversation(arbi: ArbiClient, conversationId: string): Promise<ConversationResponse>;
6472
+ /** What an unattended run waits on (agent email + session public key); 404 when nothing waits. */
6473
+ declare function getPendingAuth(arbi: ArbiClient, conversationId: string): Promise<PendingAuthResponse>;
6474
+ /**
6475
+ * A person finishes a step of a workflow run: completes a form (its inputs join the run's), an upload
6476
+ * or a review (the approval), or skips a step. The run then goes on to its next agent step.
6477
+ */
6478
+ declare function actOnStep(arbi: ArbiClient, conversationId: string, body: StepActionRequest): Promise<ConversationResponse>;
6479
+ /** Complete a person step (a form's or a fielded review's `inputs` join the run's inputs). */
6480
+ declare function completeStep(arbi: ArbiClient, conversationId: string, step: string, inputs?: Record<string, unknown> | null): Promise<ConversationResponse>;
6481
+ /** Skip a step (any unfinished one, a failed agent step too), so what waits for it can go on. */
6482
+ declare function skipStep(arbi: ArbiClient, conversationId: string, step: string): Promise<ConversationResponse>;
5656
6483
  /**
5657
6484
  * Send the work back from a ready person step to an earlier step (`to`, default: the one step it
5658
6485
  * waits for), with an optional `note`. That step and every step after it are open again; an agent
@@ -5885,8 +6712,8 @@ declare namespace facts {
5885
6712
 
5886
6713
  /**
5887
6714
  * Native calendar operations over `/v1/calendar`: settings, calendars, events, invitations,
5888
- * sharing, subscriptions, holidays, rooms, scheduling, connected accounts, app passwords and feeds,
5889
- * booking pages, and the public booking endpoints.
6715
+ * sharing, subscriptions, holidays, rooms, scheduling, connected accounts, booking pages,
6716
+ * and the public booking endpoints.
5890
6717
  *
5891
6718
  * Calendar content is sealed under per-calendar keys, themselves sealed to the user. A server
5892
6719
  * session reads it only once those keys are bridged to it ({@link unlockCalendarKeys}:
@@ -5925,8 +6752,6 @@ type PersonKey = S['PersonKey'];
5925
6752
  type CalendarAccount = S['AccountRead'];
5926
6753
  type CalendarAccountKind = CalendarAccount['kind'];
5927
6754
  type CalDavProfile = S['CalDavProfileRead'];
5928
- type AppPassword = S['AppPasswordRead'];
5929
- type AppPasswordCreated = S['AppPasswordCreated'];
5930
6755
  type BookingPage = S['BookingPageRead'];
5931
6756
  type WeeklyHoursSpec = S['WeeklyHours'];
5932
6757
  type PublicBookingPage = S['PublicBookingPage'];
@@ -5943,11 +6768,6 @@ type RoomCreateBody = Partial<ResourceCreate> & Pick<ResourceCreate, 'name'>;
5943
6768
  type CalDavConnectBody = Omit<S['CalDavConnect'], 'background_sync'> & {
5944
6769
  background_sync?: boolean;
5945
6770
  };
5946
- type AppPasswordCreateBody = S['AppPasswordCreate'];
5947
- type FeedLevel = S['FeedCreate']['level'];
5948
- type FeedCreateBody = Omit<S['FeedCreate'], 'label'> & {
5949
- label?: string;
5950
- };
5951
6771
  type BookingPageWriteBody = S['BookingPageWrite'];
5952
6772
  type BookingRequestBody = S['BookingRequest'];
5953
6773
  /** A time window for list queries: ISO instants with an offset. */
@@ -6093,15 +6913,6 @@ declare function syncAccount(client: ArbiClient, accId: string): Promise<Account
6093
6913
  declare function disconnectAccount(client: ArbiClient, accId: string): Promise<void>;
6094
6914
  /** Publish an own calendar into a connected account; it then mirrors both ways. */
6095
6915
  declare function publishCalendarToAccount(client: ArbiClient, accId: string, calendarId: string): Promise<CalendarRead>;
6096
- declare function listAppPasswords(client: ArbiClient): Promise<AppPassword[]>;
6097
- declare function createAppPassword(client: ArbiClient, body: AppPasswordCreateBody): Promise<AppPasswordCreated>;
6098
- declare function createFeed(client: ArbiClient, body: FeedCreateBody): Promise<AppPasswordCreated>;
6099
- declare function revokeAppPassword(client: ArbiClient, apwId: string): Promise<void>;
6100
- /** Split the app-password list into device passwords and feed URLs. */
6101
- declare function splitAppPasswords(rows: AppPassword[]): {
6102
- devices: AppPassword[];
6103
- feeds: AppPassword[];
6104
- };
6105
6916
  declare function listBookingPages(client: ArbiClient): Promise<BookingPage[]>;
6106
6917
  declare function putBookingPage(client: ArbiClient, body: BookingPageWriteBody): Promise<BookingPage>;
6107
6918
  declare function deleteBookingPage(client: ArbiClient, slug: string): Promise<void>;
@@ -6123,9 +6934,6 @@ declare function cancelPublicBooking(baseUrl: string, slug: string, token: strin
6123
6934
 
6124
6935
  declare const calendar_ACCOUNT_VENDOR: typeof ACCOUNT_VENDOR;
6125
6936
  type calendar_AccountSyncResult = AccountSyncResult;
6126
- type calendar_AppPassword = AppPassword;
6127
- type calendar_AppPasswordCreateBody = AppPasswordCreateBody;
6128
- type calendar_AppPasswordCreated = AppPasswordCreated;
6129
6937
  type calendar_AttendeeRead = AttendeeRead;
6130
6938
  type calendar_BookingConfirmation = BookingConfirmation;
6131
6939
  type calendar_BookingPage = BookingPage;
@@ -6150,8 +6958,6 @@ type calendar_EventCreate = EventCreate;
6150
6958
  type calendar_EventCreateBody = EventCreateBody;
6151
6959
  type calendar_EventPatchBody = EventPatchBody;
6152
6960
  type calendar_EventWrite = EventWrite;
6153
- type calendar_FeedCreateBody = FeedCreateBody;
6154
- type calendar_FeedLevel = FeedLevel;
6155
6961
  type calendar_FindTimeParams = FindTimeParams;
6156
6962
  type calendar_FreeBusyEntry = FreeBusyEntry;
6157
6963
  type calendar_HolidayCountry = HolidayCountry;
@@ -6182,10 +6988,8 @@ declare const calendar_bookPublicSlot: typeof bookPublicSlot;
6182
6988
  declare const calendar_cancelPublicBooking: typeof cancelPublicBooking;
6183
6989
  declare const calendar_connectCalDavAccount: typeof connectCalDavAccount;
6184
6990
  declare const calendar_connectOAuthAccount: typeof connectOAuthAccount;
6185
- declare const calendar_createAppPassword: typeof createAppPassword;
6186
6991
  declare const calendar_createCalendar: typeof createCalendar;
6187
6992
  declare const calendar_createEvent: typeof createEvent;
6188
- declare const calendar_createFeed: typeof createFeed;
6189
6993
  declare const calendar_createRoom: typeof createRoom;
6190
6994
  declare const calendar_decideCounter: typeof decideCounter;
6191
6995
  declare const calendar_deleteBookingPage: typeof deleteBookingPage;
@@ -6202,7 +7006,6 @@ declare const calendar_getFreeBusy: typeof getFreeBusy;
6202
7006
  declare const calendar_getPublicBookingPage: typeof getPublicBookingPage;
6203
7007
  declare const calendar_importCalendarIcs: typeof importCalendarIcs;
6204
7008
  declare const calendar_listAccounts: typeof listAccounts;
6205
- declare const calendar_listAppPasswords: typeof listAppPasswords;
6206
7009
  declare const calendar_listBookingPages: typeof listBookingPages;
6207
7010
  declare const calendar_listCalDavProfiles: typeof listCalDavProfiles;
6208
7011
  declare const calendar_listCalendars: typeof listCalendars;
@@ -6220,9 +7023,7 @@ declare const calendar_putBookingPage: typeof putBookingPage;
6220
7023
  declare const calendar_putCalendarSettings: typeof putCalendarSettings;
6221
7024
  declare const calendar_refreshCalendar: typeof refreshCalendar;
6222
7025
  declare const calendar_respondToEvent: typeof respondToEvent;
6223
- declare const calendar_revokeAppPassword: typeof revokeAppPassword;
6224
7026
  declare const calendar_shareCalendar: typeof shareCalendar;
6225
- declare const calendar_splitAppPasswords: typeof splitAppPasswords;
6226
7027
  declare const calendar_subscribeCalendar: typeof subscribeCalendar;
6227
7028
  declare const calendar_syncAccount: typeof syncAccount;
6228
7029
  declare const calendar_unlockCalendarKeys: typeof unlockCalendarKeys;
@@ -6231,12 +7032,12 @@ declare const calendar_updateAccount: typeof updateAccount;
6231
7032
  declare const calendar_updateCalendar: typeof updateCalendar;
6232
7033
  declare const calendar_updateEvent: typeof updateEvent;
6233
7034
  declare namespace calendar {
6234
- export { calendar_ACCOUNT_VENDOR as ACCOUNT_VENDOR, type calendar_AccountSyncResult as AccountSyncResult, type calendar_AppPassword as AppPassword, type calendar_AppPasswordCreateBody as AppPasswordCreateBody, type calendar_AppPasswordCreated as AppPasswordCreated, type calendar_AttendeeRead as AttendeeRead, type calendar_BookingConfirmation as BookingConfirmation, type calendar_BookingPage as BookingPage, type calendar_BookingPageWriteBody as BookingPageWriteBody, type calendar_BookingRequestBody as BookingRequestBody, type calendar_CalDavConnectBody as CalDavConnectBody, type calendar_CalDavProfile as CalDavProfile, type calendar_CalendarAccount as CalendarAccount, type calendar_CalendarAccountKind as CalendarAccountKind, type calendar_CalendarCreate as CalendarCreate, type calendar_CalendarCreateBody as CalendarCreateBody, type calendar_CalendarEvent as CalendarEvent, type calendar_CalendarKeys as CalendarKeys, type calendar_CalendarRead as CalendarRead, type calendar_CalendarSettings as CalendarSettings, type calendar_CalendarSettingsBody as CalendarSettingsBody, type calendar_CalendarUpdate as CalendarUpdate, type calendar_CalendarWindow as CalendarWindow, type calendar_DateTimeSpec as DateTimeSpec, type calendar_EditScope as EditScope, type calendar_EventCreate as EventCreate, type calendar_EventCreateBody as EventCreateBody, type calendar_EventPatchBody as EventPatchBody, type calendar_EventWrite as EventWrite, type calendar_FeedCreateBody as FeedCreateBody, type calendar_FeedLevel as FeedLevel, type calendar_FindTimeParams as FindTimeParams, type calendar_FreeBusyEntry as FreeBusyEntry, type calendar_HolidayCountry as HolidayCountry, type calendar_ImportResult as ImportResult, type calendar_InvitationRead as InvitationRead, type calendar_ListEventsParams as ListEventsParams, type calendar_OAuthAccountKind as OAuthAccountKind, type calendar_OverlayItem as OverlayItem, type calendar_OverlayLayerName as OverlayLayerName, type calendar_PersonKey as PersonKey, calendar_PublicBookingError as PublicBookingError, type calendar_PublicBookingPage as PublicBookingPage, type calendar_ResourceCreate as ResourceCreate, type calendar_RespondParams as RespondParams, type calendar_RespondPartstat as RespondPartstat, type calendar_RoomCreateBody as RoomCreateBody, type calendar_RoomQuery as RoomQuery, type calendar_RoomRead as RoomRead, type calendar_ScopedTarget as ScopedTarget, type calendar_ShareRead as ShareRead, type calendar_ShareRole as ShareRole, type calendar_SubscribeParams as SubscribeParams, type calendar_TimeSuggestion as TimeSuggestion, type calendar_WeeklyHoursSpec as WeeklyHoursSpec, calendar_addHolidayCalendar as addHolidayCalendar, calendar_bookPublicSlot as bookPublicSlot, calendar_cancelPublicBooking as cancelPublicBooking, calendar_connectCalDavAccount as connectCalDavAccount, calendar_connectOAuthAccount as connectOAuthAccount, calendar_createAppPassword as createAppPassword, calendar_createCalendar as createCalendar, calendar_createEvent as createEvent, calendar_createFeed as createFeed, calendar_createRoom as createRoom, calendar_decideCounter as decideCounter, calendar_deleteBookingPage as deleteBookingPage, calendar_deleteCalendar as deleteCalendar, calendar_deleteEvent as deleteEvent, calendar_disconnectAccount as disconnectAccount, calendar_ensureCalendarUnlocked as ensureCalendarUnlocked, calendar_eventIcs as eventIcs, calendar_exportCalendarIcs as exportCalendarIcs, calendar_findTime as findTime, calendar_getCalendarSettings as getCalendarSettings, calendar_getEvent as getEvent, calendar_getFreeBusy as getFreeBusy, calendar_getPublicBookingPage as getPublicBookingPage, calendar_importCalendarIcs as importCalendarIcs, calendar_listAccounts as listAccounts, calendar_listAppPasswords as listAppPasswords, calendar_listBookingPages as listBookingPages, calendar_listCalDavProfiles as listCalDavProfiles, calendar_listCalendars as listCalendars, calendar_listEvents as listEvents, calendar_listHolidayCountries as listHolidayCountries, calendar_listInvitations as listInvitations, calendar_listOverlays as listOverlays, calendar_listRooms as listRooms, calendar_listShares as listShares, calendar_lookupEventByUid as lookupEventByUid, calendar_lookupPeopleKeys as lookupPeopleKeys, calendar_moveEvent as moveEvent, calendar_publishCalendarToAccount as publishCalendarToAccount, calendar_putBookingPage as putBookingPage, calendar_putCalendarSettings as putCalendarSettings, calendar_refreshCalendar as refreshCalendar, calendar_respondToEvent as respondToEvent, calendar_revokeAppPassword as revokeAppPassword, calendar_shareCalendar as shareCalendar, calendar_splitAppPasswords as splitAppPasswords, calendar_subscribeCalendar as subscribeCalendar, calendar_syncAccount as syncAccount, calendar_unlockCalendarKeys as unlockCalendarKeys, calendar_unshareCalendar as unshareCalendar, calendar_updateAccount as updateAccount, calendar_updateCalendar as updateCalendar, calendar_updateEvent as updateEvent };
7035
+ export { calendar_ACCOUNT_VENDOR as ACCOUNT_VENDOR, type calendar_AccountSyncResult as AccountSyncResult, type calendar_AttendeeRead as AttendeeRead, type calendar_BookingConfirmation as BookingConfirmation, type calendar_BookingPage as BookingPage, type calendar_BookingPageWriteBody as BookingPageWriteBody, type calendar_BookingRequestBody as BookingRequestBody, type calendar_CalDavConnectBody as CalDavConnectBody, type calendar_CalDavProfile as CalDavProfile, type calendar_CalendarAccount as CalendarAccount, type calendar_CalendarAccountKind as CalendarAccountKind, type calendar_CalendarCreate as CalendarCreate, type calendar_CalendarCreateBody as CalendarCreateBody, type calendar_CalendarEvent as CalendarEvent, type calendar_CalendarKeys as CalendarKeys, type calendar_CalendarRead as CalendarRead, type calendar_CalendarSettings as CalendarSettings, type calendar_CalendarSettingsBody as CalendarSettingsBody, type calendar_CalendarUpdate as CalendarUpdate, type calendar_CalendarWindow as CalendarWindow, type calendar_DateTimeSpec as DateTimeSpec, type calendar_EditScope as EditScope, type calendar_EventCreate as EventCreate, type calendar_EventCreateBody as EventCreateBody, type calendar_EventPatchBody as EventPatchBody, type calendar_EventWrite as EventWrite, type calendar_FindTimeParams as FindTimeParams, type calendar_FreeBusyEntry as FreeBusyEntry, type calendar_HolidayCountry as HolidayCountry, type calendar_ImportResult as ImportResult, type calendar_InvitationRead as InvitationRead, type calendar_ListEventsParams as ListEventsParams, type calendar_OAuthAccountKind as OAuthAccountKind, type calendar_OverlayItem as OverlayItem, type calendar_OverlayLayerName as OverlayLayerName, type calendar_PersonKey as PersonKey, calendar_PublicBookingError as PublicBookingError, type calendar_PublicBookingPage as PublicBookingPage, type calendar_ResourceCreate as ResourceCreate, type calendar_RespondParams as RespondParams, type calendar_RespondPartstat as RespondPartstat, type calendar_RoomCreateBody as RoomCreateBody, type calendar_RoomQuery as RoomQuery, type calendar_RoomRead as RoomRead, type calendar_ScopedTarget as ScopedTarget, type calendar_ShareRead as ShareRead, type calendar_ShareRole as ShareRole, type calendar_SubscribeParams as SubscribeParams, type calendar_TimeSuggestion as TimeSuggestion, type calendar_WeeklyHoursSpec as WeeklyHoursSpec, calendar_addHolidayCalendar as addHolidayCalendar, calendar_bookPublicSlot as bookPublicSlot, calendar_cancelPublicBooking as cancelPublicBooking, calendar_connectCalDavAccount as connectCalDavAccount, calendar_connectOAuthAccount as connectOAuthAccount, calendar_createCalendar as createCalendar, calendar_createEvent as createEvent, calendar_createRoom as createRoom, calendar_decideCounter as decideCounter, calendar_deleteBookingPage as deleteBookingPage, calendar_deleteCalendar as deleteCalendar, calendar_deleteEvent as deleteEvent, calendar_disconnectAccount as disconnectAccount, calendar_ensureCalendarUnlocked as ensureCalendarUnlocked, calendar_eventIcs as eventIcs, calendar_exportCalendarIcs as exportCalendarIcs, calendar_findTime as findTime, calendar_getCalendarSettings as getCalendarSettings, calendar_getEvent as getEvent, calendar_getFreeBusy as getFreeBusy, calendar_getPublicBookingPage as getPublicBookingPage, calendar_importCalendarIcs as importCalendarIcs, calendar_listAccounts as listAccounts, calendar_listBookingPages as listBookingPages, calendar_listCalDavProfiles as listCalDavProfiles, calendar_listCalendars as listCalendars, calendar_listEvents as listEvents, calendar_listHolidayCountries as listHolidayCountries, calendar_listInvitations as listInvitations, calendar_listOverlays as listOverlays, calendar_listRooms as listRooms, calendar_listShares as listShares, calendar_lookupEventByUid as lookupEventByUid, calendar_lookupPeopleKeys as lookupPeopleKeys, calendar_moveEvent as moveEvent, calendar_publishCalendarToAccount as publishCalendarToAccount, calendar_putBookingPage as putBookingPage, calendar_putCalendarSettings as putCalendarSettings, calendar_refreshCalendar as refreshCalendar, calendar_respondToEvent as respondToEvent, calendar_shareCalendar as shareCalendar, calendar_subscribeCalendar as subscribeCalendar, calendar_syncAccount as syncAccount, calendar_unlockCalendarKeys as unlockCalendarKeys, calendar_unshareCalendar as unshareCalendar, calendar_updateAccount as updateAccount, calendar_updateCalendar as updateCalendar, calendar_updateEvent as updateEvent };
6235
7036
  }
6236
7037
 
6237
7038
  type DocUpdateRequest = components['schemas']['DocUpdateRequest'];
6238
7039
  type WorkspaceUpdateRequest = components['schemas']['WorkspaceUpdateRequest'];
6239
- type TagFormat = components['schemas']['TagFormat'];
7040
+ type TagFormat$1 = components['schemas']['TagFormat'];
6240
7041
  type CitationSources$1 = components['schemas']['CitationSources'];
6241
7042
  type UserSettingsUpdate = components['schemas']['UserSettingsUpdate'];
6242
7043
  type ConfigUpdateData$1 = components['schemas']['ConfigUpdateData'];
@@ -6535,8 +7336,757 @@ declare class Arbi {
6535
7336
  current_period_end?: number | null | undefined;
6536
7337
  cancel_at_period_end?: boolean | null | undefined;
6537
7338
  portal_url?: string | null | undefined;
6538
- }[]>;
6539
- create: (name: string, plan?: "free" | "pro", details?: ProjectDetails) => Promise<{
7339
+ }[]>;
7340
+ create: (name: string, plan?: "free" | "pro", details?: ProjectCreateOptions) => Promise<{
7341
+ external_id: string;
7342
+ name: string;
7343
+ created_by: string;
7344
+ subscription: string;
7345
+ created_at: string;
7346
+ quotas: {
7347
+ storage_gb: {
7348
+ used: number;
7349
+ limit: number;
7350
+ };
7351
+ ai_usage: {
7352
+ used: number;
7353
+ limit: number;
7354
+ };
7355
+ collaborators: {
7356
+ used: number;
7357
+ limit: number;
7358
+ };
7359
+ budget_reset_at?: number | null | undefined;
7360
+ };
7361
+ daily_cap_per_user?: number | null | undefined;
7362
+ budget?: {
7363
+ amount: number;
7364
+ currency: string;
7365
+ } | null | undefined;
7366
+ client?: string | null | undefined;
7367
+ client_ref?: string | null | undefined;
7368
+ stage?: string | null | undefined;
7369
+ stage_changed_at?: string | null | undefined;
7370
+ lead_user?: string | null | undefined;
7371
+ fields?: {
7372
+ [x: string]: unknown;
7373
+ } | undefined;
7374
+ field_schema?: {
7375
+ key: string;
7376
+ label?: string | null | undefined;
7377
+ type: "text" | "number" | "date" | "checkbox" | "select" | "person" | "document" | "relation" | "lookup" | "rollup" | "tag";
7378
+ options?: string[] | null | undefined;
7379
+ }[] | null | undefined;
7380
+ plan_interval?: ("month" | "year") | null | undefined;
7381
+ packs: number;
7382
+ plan_change?: {
7383
+ result: "upgraded" | "scheduled" | "unchanged" | "requires_action";
7384
+ charged_pence: number;
7385
+ charged_ex_vat_pence: number;
7386
+ confirm_url?: string | null | undefined;
7387
+ } | null | undefined;
7388
+ addons?: {
7389
+ packs: number;
7390
+ packs_next?: number | null | undefined;
7391
+ plan_name: string;
7392
+ plan_ai_gbp: number;
7393
+ plan_storage_gb: number;
7394
+ block_ai_gbp: number;
7395
+ block_storage_gb: number;
7396
+ ai_blocks: number;
7397
+ storage_blocks: number;
7398
+ legacy_ai_blocks: number;
7399
+ legacy_storage_blocks: number;
7400
+ legacy_block_ai_gbp: number;
7401
+ legacy_block_storage_gb: number;
7402
+ blocks_ai_gbp: number;
7403
+ blocks_storage_gb: number;
7404
+ ai_blocks_next?: number | null | undefined;
7405
+ storage_blocks_next?: number | null | undefined;
7406
+ storage_blocks_min: number;
7407
+ auto_topup_threshold_gbp: number;
7408
+ min_auto_topup_threshold_gbp: number;
7409
+ spend_cap_pence?: number | null | undefined;
7410
+ addon_spend_pence: number;
7411
+ auto_spent_pence: number;
7412
+ addon_spend_window_end?: number | null | undefined;
7413
+ manual_spent_pence: number;
7414
+ cap_left_pence?: number | null | undefined;
7415
+ ai_used_gbp: number;
7416
+ ai_allowance_gbp: number;
7417
+ ai_allowance_next_gbp: number;
7418
+ storage_used_gb: number;
7419
+ storage_allowance_gb: number;
7420
+ storage_allowance_next_gb: number;
7421
+ ai_block_monthly_pence: number;
7422
+ ai_block_monthly_ex_vat_pence: number;
7423
+ storage_block_monthly_pence: number;
7424
+ storage_block_monthly_ex_vat_pence: number;
7425
+ ai_block_period_pence: number;
7426
+ ai_block_period_ex_vat_pence: number;
7427
+ storage_block_period_pence: number;
7428
+ storage_block_period_ex_vat_pence: number;
7429
+ ai_block_price_pence: number;
7430
+ ai_block_price_ex_vat_pence: number;
7431
+ storage_block_price_pence: number;
7432
+ storage_block_price_ex_vat_pence: number;
7433
+ cap_reached: boolean;
7434
+ period_end?: number | null | undefined;
7435
+ ai_usage_reset_at?: number | null | undefined;
7436
+ pending_interval?: ("month" | "year") | null | undefined;
7437
+ billing_error?: string | null | undefined;
7438
+ confirm_url?: string | null | undefined;
7439
+ payment?: {
7440
+ status: "pending" | "paid";
7441
+ kind?: ("ai_usage" | "storage") | null | undefined;
7442
+ amount_pence?: number | null | undefined;
7443
+ amount_ex_vat_pence?: number | null | undefined;
7444
+ tax_pence?: number | null | undefined;
7445
+ at?: number | null | undefined;
7446
+ confirm_url?: string | null | undefined;
7447
+ } | null | undefined;
7448
+ } | null | undefined;
7449
+ price_id?: string | null | undefined;
7450
+ plan?: string | null | undefined;
7451
+ amount?: number | null | undefined;
7452
+ amount_ex_vat?: number | null | undefined;
7453
+ currency?: string | null | undefined;
7454
+ current_period_end?: number | null | undefined;
7455
+ cancel_at_period_end?: boolean | null | undefined;
7456
+ portal_url?: string | null | undefined;
7457
+ }>;
7458
+ /** Patch a project: name, daily cap, budget, client, stage, lead, fields (merged key by key). */
7459
+ update: (projectExtId: string, body: ProjectUpdateRequest) => Promise<{
7460
+ external_id: string;
7461
+ name: string;
7462
+ created_by: string;
7463
+ subscription: string;
7464
+ created_at: string;
7465
+ quotas: {
7466
+ storage_gb: {
7467
+ used: number;
7468
+ limit: number;
7469
+ };
7470
+ ai_usage: {
7471
+ used: number;
7472
+ limit: number;
7473
+ };
7474
+ collaborators: {
7475
+ used: number;
7476
+ limit: number;
7477
+ };
7478
+ budget_reset_at?: number | null | undefined;
7479
+ };
7480
+ daily_cap_per_user?: number | null | undefined;
7481
+ budget?: {
7482
+ amount: number;
7483
+ currency: string;
7484
+ } | null | undefined;
7485
+ client?: string | null | undefined;
7486
+ client_ref?: string | null | undefined;
7487
+ stage?: string | null | undefined;
7488
+ stage_changed_at?: string | null | undefined;
7489
+ lead_user?: string | null | undefined;
7490
+ fields?: {
7491
+ [x: string]: unknown;
7492
+ } | undefined;
7493
+ field_schema?: {
7494
+ key: string;
7495
+ label?: string | null | undefined;
7496
+ type: "text" | "number" | "date" | "checkbox" | "select" | "person" | "document" | "relation" | "lookup" | "rollup" | "tag";
7497
+ options?: string[] | null | undefined;
7498
+ }[] | null | undefined;
7499
+ plan_interval?: ("month" | "year") | null | undefined;
7500
+ packs: number;
7501
+ plan_change?: {
7502
+ result: "upgraded" | "scheduled" | "unchanged" | "requires_action";
7503
+ charged_pence: number;
7504
+ charged_ex_vat_pence: number;
7505
+ confirm_url?: string | null | undefined;
7506
+ } | null | undefined;
7507
+ addons?: {
7508
+ packs: number;
7509
+ packs_next?: number | null | undefined;
7510
+ plan_name: string;
7511
+ plan_ai_gbp: number;
7512
+ plan_storage_gb: number;
7513
+ block_ai_gbp: number;
7514
+ block_storage_gb: number;
7515
+ ai_blocks: number;
7516
+ storage_blocks: number;
7517
+ legacy_ai_blocks: number;
7518
+ legacy_storage_blocks: number;
7519
+ legacy_block_ai_gbp: number;
7520
+ legacy_block_storage_gb: number;
7521
+ blocks_ai_gbp: number;
7522
+ blocks_storage_gb: number;
7523
+ ai_blocks_next?: number | null | undefined;
7524
+ storage_blocks_next?: number | null | undefined;
7525
+ storage_blocks_min: number;
7526
+ auto_topup_threshold_gbp: number;
7527
+ min_auto_topup_threshold_gbp: number;
7528
+ spend_cap_pence?: number | null | undefined;
7529
+ addon_spend_pence: number;
7530
+ auto_spent_pence: number;
7531
+ addon_spend_window_end?: number | null | undefined;
7532
+ manual_spent_pence: number;
7533
+ cap_left_pence?: number | null | undefined;
7534
+ ai_used_gbp: number;
7535
+ ai_allowance_gbp: number;
7536
+ ai_allowance_next_gbp: number;
7537
+ storage_used_gb: number;
7538
+ storage_allowance_gb: number;
7539
+ storage_allowance_next_gb: number;
7540
+ ai_block_monthly_pence: number;
7541
+ ai_block_monthly_ex_vat_pence: number;
7542
+ storage_block_monthly_pence: number;
7543
+ storage_block_monthly_ex_vat_pence: number;
7544
+ ai_block_period_pence: number;
7545
+ ai_block_period_ex_vat_pence: number;
7546
+ storage_block_period_pence: number;
7547
+ storage_block_period_ex_vat_pence: number;
7548
+ ai_block_price_pence: number;
7549
+ ai_block_price_ex_vat_pence: number;
7550
+ storage_block_price_pence: number;
7551
+ storage_block_price_ex_vat_pence: number;
7552
+ cap_reached: boolean;
7553
+ period_end?: number | null | undefined;
7554
+ ai_usage_reset_at?: number | null | undefined;
7555
+ pending_interval?: ("month" | "year") | null | undefined;
7556
+ billing_error?: string | null | undefined;
7557
+ confirm_url?: string | null | undefined;
7558
+ payment?: {
7559
+ status: "pending" | "paid";
7560
+ kind?: ("ai_usage" | "storage") | null | undefined;
7561
+ amount_pence?: number | null | undefined;
7562
+ amount_ex_vat_pence?: number | null | undefined;
7563
+ tax_pence?: number | null | undefined;
7564
+ at?: number | null | undefined;
7565
+ confirm_url?: string | null | undefined;
7566
+ } | null | undefined;
7567
+ } | null | undefined;
7568
+ price_id?: string | null | undefined;
7569
+ plan?: string | null | undefined;
7570
+ amount?: number | null | undefined;
7571
+ amount_ex_vat?: number | null | undefined;
7572
+ currency?: string | null | undefined;
7573
+ current_period_end?: number | null | undefined;
7574
+ cancel_at_period_end?: boolean | null | undefined;
7575
+ portal_url?: string | null | undefined;
7576
+ }>;
7577
+ /** The project's stage and budget changes, newest first. */
7578
+ events: (projectExtId: string, options?: {
7579
+ kind?: ProjectEventKind;
7580
+ limit?: number;
7581
+ }) => Promise<{
7582
+ external_id: string;
7583
+ kind: "stage_changed" | "budget_changed";
7584
+ actor?: string | null;
7585
+ detail: {
7586
+ [key: string]: unknown;
7587
+ };
7588
+ created_at: string;
7589
+ }[]>;
7590
+ /** The project's spend by conversation in a billing period (£). */
7591
+ usageByConversation: (projectExtId: string, monthsBack?: number) => Promise<{
7592
+ project_ext_id: string;
7593
+ period_start: string;
7594
+ period_end: string;
7595
+ total_spend: number;
7596
+ total_tokens: number;
7597
+ total_requests: number;
7598
+ by_conversation: {
7599
+ [key: string]: components["schemas"]["TagBreakdown"];
7600
+ };
7601
+ unattributed: components["schemas"]["TagBreakdown"];
7602
+ }>;
7603
+ refresh: (projectExtId: string) => Promise<{
7604
+ external_id: string;
7605
+ name: string;
7606
+ created_by: string;
7607
+ subscription: string;
7608
+ created_at: string;
7609
+ quotas: {
7610
+ storage_gb: {
7611
+ used: number;
7612
+ limit: number;
7613
+ };
7614
+ ai_usage: {
7615
+ used: number;
7616
+ limit: number;
7617
+ };
7618
+ collaborators: {
7619
+ used: number;
7620
+ limit: number;
7621
+ };
7622
+ budget_reset_at?: number | null | undefined;
7623
+ };
7624
+ daily_cap_per_user?: number | null | undefined;
7625
+ budget?: {
7626
+ amount: number;
7627
+ currency: string;
7628
+ } | null | undefined;
7629
+ client?: string | null | undefined;
7630
+ client_ref?: string | null | undefined;
7631
+ stage?: string | null | undefined;
7632
+ stage_changed_at?: string | null | undefined;
7633
+ lead_user?: string | null | undefined;
7634
+ fields?: {
7635
+ [x: string]: unknown;
7636
+ } | undefined;
7637
+ field_schema?: {
7638
+ key: string;
7639
+ label?: string | null | undefined;
7640
+ type: "text" | "number" | "date" | "checkbox" | "select" | "person" | "document" | "relation" | "lookup" | "rollup" | "tag";
7641
+ options?: string[] | null | undefined;
7642
+ }[] | null | undefined;
7643
+ plan_interval?: ("month" | "year") | null | undefined;
7644
+ packs: number;
7645
+ plan_change?: {
7646
+ result: "upgraded" | "scheduled" | "unchanged" | "requires_action";
7647
+ charged_pence: number;
7648
+ charged_ex_vat_pence: number;
7649
+ confirm_url?: string | null | undefined;
7650
+ } | null | undefined;
7651
+ addons?: {
7652
+ packs: number;
7653
+ packs_next?: number | null | undefined;
7654
+ plan_name: string;
7655
+ plan_ai_gbp: number;
7656
+ plan_storage_gb: number;
7657
+ block_ai_gbp: number;
7658
+ block_storage_gb: number;
7659
+ ai_blocks: number;
7660
+ storage_blocks: number;
7661
+ legacy_ai_blocks: number;
7662
+ legacy_storage_blocks: number;
7663
+ legacy_block_ai_gbp: number;
7664
+ legacy_block_storage_gb: number;
7665
+ blocks_ai_gbp: number;
7666
+ blocks_storage_gb: number;
7667
+ ai_blocks_next?: number | null | undefined;
7668
+ storage_blocks_next?: number | null | undefined;
7669
+ storage_blocks_min: number;
7670
+ auto_topup_threshold_gbp: number;
7671
+ min_auto_topup_threshold_gbp: number;
7672
+ spend_cap_pence?: number | null | undefined;
7673
+ addon_spend_pence: number;
7674
+ auto_spent_pence: number;
7675
+ addon_spend_window_end?: number | null | undefined;
7676
+ manual_spent_pence: number;
7677
+ cap_left_pence?: number | null | undefined;
7678
+ ai_used_gbp: number;
7679
+ ai_allowance_gbp: number;
7680
+ ai_allowance_next_gbp: number;
7681
+ storage_used_gb: number;
7682
+ storage_allowance_gb: number;
7683
+ storage_allowance_next_gb: number;
7684
+ ai_block_monthly_pence: number;
7685
+ ai_block_monthly_ex_vat_pence: number;
7686
+ storage_block_monthly_pence: number;
7687
+ storage_block_monthly_ex_vat_pence: number;
7688
+ ai_block_period_pence: number;
7689
+ ai_block_period_ex_vat_pence: number;
7690
+ storage_block_period_pence: number;
7691
+ storage_block_period_ex_vat_pence: number;
7692
+ ai_block_price_pence: number;
7693
+ ai_block_price_ex_vat_pence: number;
7694
+ storage_block_price_pence: number;
7695
+ storage_block_price_ex_vat_pence: number;
7696
+ cap_reached: boolean;
7697
+ period_end?: number | null | undefined;
7698
+ ai_usage_reset_at?: number | null | undefined;
7699
+ pending_interval?: ("month" | "year") | null | undefined;
7700
+ billing_error?: string | null | undefined;
7701
+ confirm_url?: string | null | undefined;
7702
+ payment?: {
7703
+ status: "pending" | "paid";
7704
+ kind?: ("ai_usage" | "storage") | null | undefined;
7705
+ amount_pence?: number | null | undefined;
7706
+ amount_ex_vat_pence?: number | null | undefined;
7707
+ tax_pence?: number | null | undefined;
7708
+ at?: number | null | undefined;
7709
+ confirm_url?: string | null | undefined;
7710
+ } | null | undefined;
7711
+ } | null | undefined;
7712
+ price_id?: string | null | undefined;
7713
+ plan?: string | null | undefined;
7714
+ amount?: number | null | undefined;
7715
+ amount_ex_vat?: number | null | undefined;
7716
+ currency?: string | null | undefined;
7717
+ current_period_end?: number | null | undefined;
7718
+ cancel_at_period_end?: boolean | null | undefined;
7719
+ portal_url?: string | null | undefined;
7720
+ }>;
7721
+ /** AI usage + spend breakdown for a project's billing period. */
7722
+ usage: (projectExtId: string, monthsBack?: number) => Promise<{
7723
+ project_ext_id: string;
7724
+ period_start: string;
7725
+ period_end: string;
7726
+ total_spend: number;
7727
+ total_tokens: number;
7728
+ total_requests: number;
7729
+ daily: components["schemas"]["DailyUsage"][];
7730
+ model_groups: {
7731
+ [key: string]: components["schemas"]["ModelGroupUsage"];
7732
+ };
7733
+ by_workspace: {
7734
+ [key: string]: components["schemas"]["TagBreakdown"];
7735
+ };
7736
+ by_user: {
7737
+ [key: string]: components["schemas"]["TagBreakdown"];
7738
+ };
7739
+ by_feature: {
7740
+ [key: string]: components["schemas"]["TagBreakdown"];
7741
+ };
7742
+ invoice_pdf?: string | null;
7743
+ }>;
7744
+ /** Stripe invoices for a project's subscription. */
7745
+ invoices: (projectExtId: string) => Promise<{
7746
+ project_ext_id: string;
7747
+ invoices: components["schemas"]["ProjectInvoice"][];
7748
+ }>;
7749
+ /** Delete a project (only when empty: no workspaces, no subscription). */
7750
+ delete: (projectExtId: string) => Promise<void>;
7751
+ /** The plans and add-ons on sale. */
7752
+ products: () => Promise<{
7753
+ product_id: string;
7754
+ name: string;
7755
+ description?: string | null | undefined;
7756
+ prices: {
7757
+ price_id: string;
7758
+ amount?: number | null | undefined;
7759
+ amount_ex_vat?: number | null | undefined;
7760
+ currency: string;
7761
+ interval: string;
7762
+ interval_count: number;
7763
+ default_price: boolean;
7764
+ pack_prices: {
7765
+ packs: number;
7766
+ amount: number;
7767
+ amount_ex_vat: number;
7768
+ }[];
7769
+ addon_prices: {
7770
+ kind: "ai_usage" | "storage";
7771
+ ai_gbp: number;
7772
+ storage_gb: number;
7773
+ amount_ex_vat: number;
7774
+ amount: number;
7775
+ monthly_ex_vat: number;
7776
+ monthly: number;
7777
+ }[];
7778
+ }[];
7779
+ }[]>;
7780
+ /** The taxed total of a Pro purchase (a new project when `projectExtId` is null). */
7781
+ quotePlan: (projectExtId: string | null, body: ProjectQuoteRequest) => Promise<{
7782
+ subtotal_pence: number;
7783
+ tax_pence: number;
7784
+ total_pence: number;
7785
+ tax_label?: string | null | undefined;
7786
+ reverse_charge: boolean;
7787
+ country?: string | null | undefined;
7788
+ taxability_reason?: string | null | undefined;
7789
+ lines: {
7790
+ reference: string;
7791
+ subtotal_pence: number;
7792
+ tax_pence: number;
7793
+ }[];
7794
+ }>;
7795
+ /** Start an embedded Stripe checkout; returns its `client_secret`. */
7796
+ checkout: (projectExtId: string, body: ProjectCheckoutRequest) => Promise<{
7797
+ client_secret: string;
7798
+ }>;
7799
+ changePlan: (projectExtId: string, body: ProjectPlanChangeRequest) => Promise<{
7800
+ external_id: string;
7801
+ name: string;
7802
+ created_by: string;
7803
+ subscription: string;
7804
+ created_at: string;
7805
+ quotas: {
7806
+ storage_gb: {
7807
+ used: number;
7808
+ limit: number;
7809
+ };
7810
+ ai_usage: {
7811
+ used: number;
7812
+ limit: number;
7813
+ };
7814
+ collaborators: {
7815
+ used: number;
7816
+ limit: number;
7817
+ };
7818
+ budget_reset_at?: number | null | undefined;
7819
+ };
7820
+ daily_cap_per_user?: number | null | undefined;
7821
+ budget?: {
7822
+ amount: number;
7823
+ currency: string;
7824
+ } | null | undefined;
7825
+ client?: string | null | undefined;
7826
+ client_ref?: string | null | undefined;
7827
+ stage?: string | null | undefined;
7828
+ stage_changed_at?: string | null | undefined;
7829
+ lead_user?: string | null | undefined;
7830
+ fields?: {
7831
+ [x: string]: unknown;
7832
+ } | undefined;
7833
+ field_schema?: {
7834
+ key: string;
7835
+ label?: string | null | undefined;
7836
+ type: "text" | "number" | "date" | "checkbox" | "select" | "person" | "document" | "relation" | "lookup" | "rollup" | "tag";
7837
+ options?: string[] | null | undefined;
7838
+ }[] | null | undefined;
7839
+ plan_interval?: ("month" | "year") | null | undefined;
7840
+ packs: number;
7841
+ plan_change?: {
7842
+ result: "upgraded" | "scheduled" | "unchanged" | "requires_action";
7843
+ charged_pence: number;
7844
+ charged_ex_vat_pence: number;
7845
+ confirm_url?: string | null | undefined;
7846
+ } | null | undefined;
7847
+ addons?: {
7848
+ packs: number;
7849
+ packs_next?: number | null | undefined;
7850
+ plan_name: string;
7851
+ plan_ai_gbp: number;
7852
+ plan_storage_gb: number;
7853
+ block_ai_gbp: number;
7854
+ block_storage_gb: number;
7855
+ ai_blocks: number;
7856
+ storage_blocks: number;
7857
+ legacy_ai_blocks: number;
7858
+ legacy_storage_blocks: number;
7859
+ legacy_block_ai_gbp: number;
7860
+ legacy_block_storage_gb: number;
7861
+ blocks_ai_gbp: number;
7862
+ blocks_storage_gb: number;
7863
+ ai_blocks_next?: number | null | undefined;
7864
+ storage_blocks_next?: number | null | undefined;
7865
+ storage_blocks_min: number;
7866
+ auto_topup_threshold_gbp: number;
7867
+ min_auto_topup_threshold_gbp: number;
7868
+ spend_cap_pence?: number | null | undefined;
7869
+ addon_spend_pence: number;
7870
+ auto_spent_pence: number;
7871
+ addon_spend_window_end?: number | null | undefined;
7872
+ manual_spent_pence: number;
7873
+ cap_left_pence?: number | null | undefined;
7874
+ ai_used_gbp: number;
7875
+ ai_allowance_gbp: number;
7876
+ ai_allowance_next_gbp: number;
7877
+ storage_used_gb: number;
7878
+ storage_allowance_gb: number;
7879
+ storage_allowance_next_gb: number;
7880
+ ai_block_monthly_pence: number;
7881
+ ai_block_monthly_ex_vat_pence: number;
7882
+ storage_block_monthly_pence: number;
7883
+ storage_block_monthly_ex_vat_pence: number;
7884
+ ai_block_period_pence: number;
7885
+ ai_block_period_ex_vat_pence: number;
7886
+ storage_block_period_pence: number;
7887
+ storage_block_period_ex_vat_pence: number;
7888
+ ai_block_price_pence: number;
7889
+ ai_block_price_ex_vat_pence: number;
7890
+ storage_block_price_pence: number;
7891
+ storage_block_price_ex_vat_pence: number;
7892
+ cap_reached: boolean;
7893
+ period_end?: number | null | undefined;
7894
+ ai_usage_reset_at?: number | null | undefined;
7895
+ pending_interval?: ("month" | "year") | null | undefined;
7896
+ billing_error?: string | null | undefined;
7897
+ confirm_url?: string | null | undefined;
7898
+ payment?: {
7899
+ status: "pending" | "paid";
7900
+ kind?: ("ai_usage" | "storage") | null | undefined;
7901
+ amount_pence?: number | null | undefined;
7902
+ amount_ex_vat_pence?: number | null | undefined;
7903
+ tax_pence?: number | null | undefined;
7904
+ at?: number | null | undefined;
7905
+ confirm_url?: string | null | undefined;
7906
+ } | null | undefined;
7907
+ } | null | undefined;
7908
+ price_id?: string | null | undefined;
7909
+ plan?: string | null | undefined;
7910
+ amount?: number | null | undefined;
7911
+ amount_ex_vat?: number | null | undefined;
7912
+ currency?: string | null | undefined;
7913
+ current_period_end?: number | null | undefined;
7914
+ cancel_at_period_end?: boolean | null | undefined;
7915
+ portal_url?: string | null | undefined;
7916
+ }>;
7917
+ previewPlanChange: (projectExtId: string, body: ProjectPlanChangeRequest) => Promise<{
7918
+ packs: number;
7919
+ plan_name: string;
7920
+ interval: "month" | "year";
7921
+ effective_now: boolean;
7922
+ unchanged: boolean;
7923
+ awaiting_confirmation: boolean;
7924
+ due_now_pence: number;
7925
+ due_now_ex_vat_pence: number;
7926
+ due_now_tax_pence: number;
7927
+ next_renewal_pence: number;
7928
+ next_renewal_ex_vat_pence: number;
7929
+ next_renewal_tax_pence: number;
7930
+ tax_label?: string | null | undefined;
7931
+ next_renewal_at?: number | null | undefined;
7932
+ }>;
7933
+ quoteAddon: (projectExtId: string, kind: ProjectAddonKind) => Promise<{
7934
+ kind: "ai_usage" | "storage";
7935
+ now: {
7936
+ subtotal_pence: number;
7937
+ tax_pence: number;
7938
+ total_pence: number;
7939
+ tax_label?: string | null | undefined;
7940
+ reverse_charge: boolean;
7941
+ country?: string | null | undefined;
7942
+ taxability_reason?: string | null | undefined;
7943
+ lines: {
7944
+ reference: string;
7945
+ subtotal_pence: number;
7946
+ tax_pence: number;
7947
+ }[];
7948
+ };
7949
+ renewal: {
7950
+ subtotal_pence: number;
7951
+ tax_pence: number;
7952
+ total_pence: number;
7953
+ tax_label?: string | null | undefined;
7954
+ reverse_charge: boolean;
7955
+ country?: string | null | undefined;
7956
+ taxability_reason?: string | null | undefined;
7957
+ lines: {
7958
+ reference: string;
7959
+ subtotal_pence: number;
7960
+ tax_pence: number;
7961
+ }[];
7962
+ };
7963
+ }>;
7964
+ billingPortal: (projectExtId: string) => Promise<{
7965
+ url: string;
7966
+ }>;
7967
+ addAddonBlock: (projectExtId: string, kind: ProjectAddonKind) => Promise<{
7968
+ status: "paid" | "requires_action";
7969
+ confirm_url?: string | null | undefined;
7970
+ project: {
7971
+ external_id: string;
7972
+ name: string;
7973
+ created_by: string;
7974
+ subscription: string;
7975
+ created_at: string;
7976
+ quotas: {
7977
+ storage_gb: {
7978
+ used: number;
7979
+ limit: number;
7980
+ };
7981
+ ai_usage: {
7982
+ used: number;
7983
+ limit: number;
7984
+ };
7985
+ collaborators: {
7986
+ used: number;
7987
+ limit: number;
7988
+ };
7989
+ budget_reset_at?: number | null | undefined;
7990
+ };
7991
+ daily_cap_per_user?: number | null | undefined;
7992
+ budget?: {
7993
+ amount: number;
7994
+ currency: string;
7995
+ } | null | undefined;
7996
+ client?: string | null | undefined;
7997
+ client_ref?: string | null | undefined;
7998
+ stage?: string | null | undefined;
7999
+ stage_changed_at?: string | null | undefined;
8000
+ lead_user?: string | null | undefined;
8001
+ fields?: {
8002
+ [x: string]: unknown;
8003
+ } | undefined;
8004
+ field_schema?: {
8005
+ key: string;
8006
+ label?: string | null | undefined;
8007
+ type: "text" | "number" | "date" | "checkbox" | "select" | "person" | "document" | "relation" | "lookup" | "rollup" | "tag";
8008
+ options?: string[] | null | undefined;
8009
+ }[] | null | undefined;
8010
+ plan_interval?: ("month" | "year") | null | undefined;
8011
+ packs: number;
8012
+ plan_change?: {
8013
+ result: "upgraded" | "scheduled" | "unchanged" | "requires_action";
8014
+ charged_pence: number;
8015
+ charged_ex_vat_pence: number;
8016
+ confirm_url?: string | null | undefined;
8017
+ } | null | undefined;
8018
+ addons?: {
8019
+ packs: number;
8020
+ packs_next?: number | null | undefined;
8021
+ plan_name: string;
8022
+ plan_ai_gbp: number;
8023
+ plan_storage_gb: number;
8024
+ block_ai_gbp: number;
8025
+ block_storage_gb: number;
8026
+ ai_blocks: number;
8027
+ storage_blocks: number;
8028
+ legacy_ai_blocks: number;
8029
+ legacy_storage_blocks: number;
8030
+ legacy_block_ai_gbp: number;
8031
+ legacy_block_storage_gb: number;
8032
+ blocks_ai_gbp: number;
8033
+ blocks_storage_gb: number;
8034
+ ai_blocks_next?: number | null | undefined;
8035
+ storage_blocks_next?: number | null | undefined;
8036
+ storage_blocks_min: number;
8037
+ auto_topup_threshold_gbp: number;
8038
+ min_auto_topup_threshold_gbp: number;
8039
+ spend_cap_pence?: number | null | undefined;
8040
+ addon_spend_pence: number;
8041
+ auto_spent_pence: number;
8042
+ addon_spend_window_end?: number | null | undefined;
8043
+ manual_spent_pence: number;
8044
+ cap_left_pence?: number | null | undefined;
8045
+ ai_used_gbp: number;
8046
+ ai_allowance_gbp: number;
8047
+ ai_allowance_next_gbp: number;
8048
+ storage_used_gb: number;
8049
+ storage_allowance_gb: number;
8050
+ storage_allowance_next_gb: number;
8051
+ ai_block_monthly_pence: number;
8052
+ ai_block_monthly_ex_vat_pence: number;
8053
+ storage_block_monthly_pence: number;
8054
+ storage_block_monthly_ex_vat_pence: number;
8055
+ ai_block_period_pence: number;
8056
+ ai_block_period_ex_vat_pence: number;
8057
+ storage_block_period_pence: number;
8058
+ storage_block_period_ex_vat_pence: number;
8059
+ ai_block_price_pence: number;
8060
+ ai_block_price_ex_vat_pence: number;
8061
+ storage_block_price_pence: number;
8062
+ storage_block_price_ex_vat_pence: number;
8063
+ cap_reached: boolean;
8064
+ period_end?: number | null | undefined;
8065
+ ai_usage_reset_at?: number | null | undefined;
8066
+ pending_interval?: ("month" | "year") | null | undefined;
8067
+ billing_error?: string | null | undefined;
8068
+ confirm_url?: string | null | undefined;
8069
+ payment?: {
8070
+ status: "pending" | "paid";
8071
+ kind?: ("ai_usage" | "storage") | null | undefined;
8072
+ amount_pence?: number | null | undefined;
8073
+ amount_ex_vat_pence?: number | null | undefined;
8074
+ tax_pence?: number | null | undefined;
8075
+ at?: number | null | undefined;
8076
+ confirm_url?: string | null | undefined;
8077
+ } | null | undefined;
8078
+ } | null | undefined;
8079
+ price_id?: string | null | undefined;
8080
+ plan?: string | null | undefined;
8081
+ amount?: number | null | undefined;
8082
+ amount_ex_vat?: number | null | undefined;
8083
+ currency?: string | null | undefined;
8084
+ current_period_end?: number | null | undefined;
8085
+ cancel_at_period_end?: boolean | null | undefined;
8086
+ portal_url?: string | null | undefined;
8087
+ };
8088
+ }>;
8089
+ setNextPeriodAddons: (projectExtId: string, body: ProjectNextPeriodAddonsRequest) => Promise<{
6540
8090
  external_id: string;
6541
8091
  name: string;
6542
8092
  created_by: string;
@@ -6654,8 +8204,7 @@ declare class Arbi {
6654
8204
  cancel_at_period_end?: boolean | null | undefined;
6655
8205
  portal_url?: string | null | undefined;
6656
8206
  }>;
6657
- /** Patch a project: name, daily cap, budget, client, stage, lead, fields (merged key by key). */
6658
- update: (projectExtId: string, body: ProjectUpdateRequest) => Promise<{
8207
+ updateAddonSettings: (projectExtId: string, body: ProjectAddonSettingsRequest) => Promise<{
6659
8208
  external_id: string;
6660
8209
  name: string;
6661
8210
  created_by: string;
@@ -6773,33 +8322,7 @@ declare class Arbi {
6773
8322
  cancel_at_period_end?: boolean | null | undefined;
6774
8323
  portal_url?: string | null | undefined;
6775
8324
  }>;
6776
- /** The project's stage and budget changes, newest first. */
6777
- events: (projectExtId: string, options?: {
6778
- kind?: ProjectEventKind;
6779
- limit?: number;
6780
- }) => Promise<{
6781
- external_id: string;
6782
- kind: "stage_changed" | "budget_changed";
6783
- actor?: string | null;
6784
- detail: {
6785
- [key: string]: unknown;
6786
- };
6787
- created_at: string;
6788
- }[]>;
6789
- /** The project's spend by conversation in a billing period (£). */
6790
- usageByConversation: (projectExtId: string, monthsBack?: number) => Promise<{
6791
- project_ext_id: string;
6792
- period_start: string;
6793
- period_end: string;
6794
- total_spend: number;
6795
- total_tokens: number;
6796
- total_requests: number;
6797
- by_conversation: {
6798
- [key: string]: components["schemas"]["TagBreakdown"];
6799
- };
6800
- unattributed: components["schemas"]["TagBreakdown"];
6801
- }>;
6802
- refresh: (projectExtId: string) => Promise<{
8325
+ cancelSubscription: (projectExtId: string) => Promise<{
6803
8326
  external_id: string;
6804
8327
  name: string;
6805
8328
  created_by: string;
@@ -6917,34 +8440,6 @@ declare class Arbi {
6917
8440
  cancel_at_period_end?: boolean | null | undefined;
6918
8441
  portal_url?: string | null | undefined;
6919
8442
  }>;
6920
- /** AI usage + spend breakdown for a project's billing period. */
6921
- usage: (projectExtId: string, monthsBack?: number) => Promise<{
6922
- project_ext_id: string;
6923
- period_start: string;
6924
- period_end: string;
6925
- total_spend: number;
6926
- total_tokens: number;
6927
- total_requests: number;
6928
- daily: components["schemas"]["DailyUsage"][];
6929
- model_groups: {
6930
- [key: string]: components["schemas"]["ModelGroupUsage"];
6931
- };
6932
- by_workspace: {
6933
- [key: string]: components["schemas"]["TagBreakdown"];
6934
- };
6935
- by_user: {
6936
- [key: string]: components["schemas"]["TagBreakdown"];
6937
- };
6938
- by_feature: {
6939
- [key: string]: components["schemas"]["TagBreakdown"];
6940
- };
6941
- invoice_pdf?: string | null;
6942
- }>;
6943
- /** Stripe invoices for a project's subscription. */
6944
- invoices: (projectExtId: string) => Promise<{
6945
- project_ext_id: string;
6946
- invoices: components["schemas"]["ProjectInvoice"][];
6947
- }>;
6948
8443
  };
6949
8444
  readonly user: {
6950
8445
  /**
@@ -7231,6 +8726,12 @@ declare class Arbi {
7231
8726
  project_subscription?: string | null | undefined;
7232
8727
  project_owner_ext_id?: string | null | undefined;
7233
8728
  house_template_ext_id?: string | null | undefined;
8729
+ archive?: {
8730
+ status: "archiving" | "archived" | "restoring";
8731
+ archived_at: string;
8732
+ documents_done: number;
8733
+ documents_total: number;
8734
+ } | null | undefined;
7234
8735
  }[]>;
7235
8736
  create: (name: string, projectExtId: string, description?: string | null, isPublic?: boolean) => Promise<{
7236
8737
  external_id: string;
@@ -7274,6 +8775,12 @@ declare class Arbi {
7274
8775
  project_subscription?: string | null | undefined;
7275
8776
  project_owner_ext_id?: string | null | undefined;
7276
8777
  house_template_ext_id?: string | null | undefined;
8778
+ archive?: {
8779
+ status: "archiving" | "archived" | "restoring";
8780
+ archived_at: string;
8781
+ documents_done: number;
8782
+ documents_total: number;
8783
+ } | null | undefined;
7277
8784
  }>;
7278
8785
  delete: (workspaceIds: string[]) => Promise<void>;
7279
8786
  update: (body: WorkspaceUpdateRequest) => Promise<{
@@ -7318,6 +8825,12 @@ declare class Arbi {
7318
8825
  project_subscription?: string | null | undefined;
7319
8826
  project_owner_ext_id?: string | null | undefined;
7320
8827
  house_template_ext_id?: string | null | undefined;
8828
+ archive?: {
8829
+ status: "archiving" | "archived" | "restoring";
8830
+ archived_at: string;
8831
+ documents_done: number;
8832
+ documents_total: number;
8833
+ } | null | undefined;
7321
8834
  }>;
7322
8835
  listUsers: () => Promise<{
7323
8836
  user: {
@@ -7385,6 +8898,30 @@ declare class Arbi {
7385
8898
  agent_ext_id?: string | null | undefined;
7386
8899
  is_temporary: boolean;
7387
8900
  }[]>;
8901
+ /**
8902
+ * `POST /v1/workspace/users` with the whole request (another workspace with its sealed key, a
8903
+ * session-scoped grant, an invitation, a resource share): see `addWorkspaceMembers`.
8904
+ */
8905
+ addMembers: (request: Parameters<typeof addWorkspaceMembers>[1]) => Promise<{
8906
+ user: {
8907
+ external_id: string;
8908
+ parent_ext_id?: string | null | undefined;
8909
+ email: string;
8910
+ given_name: string;
8911
+ family_name?: string | null | undefined;
8912
+ picture?: string | null | undefined;
8913
+ encryption_public_key: string;
8914
+ is_sso: boolean;
8915
+ is_identity_verified: boolean;
8916
+ };
8917
+ role: components["schemas"]["WorkspaceRole"];
8918
+ joined_at: string;
8919
+ conversation_count: number;
8920
+ document_count: number;
8921
+ files_mb: number;
8922
+ agent_ext_id?: string | null | undefined;
8923
+ is_temporary: boolean;
8924
+ }[]>;
7388
8925
  /**
7389
8926
  * Grant users a temporary key scoped to ONE session (identified by its public key), for
7390
8927
  * example an agent's run session minted by `agents.authorize()`. Nothing standing is created:
@@ -9214,13 +10751,16 @@ declare class Arbi {
9214
10751
  content?: string | null;
9215
10752
  }[]>;
9216
10753
  /**
9217
- * Search documents without LLM generation (retrieval only).
10754
+ * Search documents without LLM generation (retrieval only). No `docIds` searches the whole
10755
+ * workspace; `searchChunks(result)` ranks the passages found.
9218
10756
  */
9219
10757
  retrieve: (query: string, docIds: string[], options?: {
9220
10758
  searchMode?: "semantic" | "keyword" | "hybrid";
9221
10759
  fullContextDocIds?: string[];
9222
10760
  tocDocIds?: string[];
9223
10761
  model?: string;
10762
+ /** Keep the response server-side (default true). */
10763
+ store?: boolean;
9224
10764
  }) => Promise<RetrieveResult>;
9225
10765
  };
9226
10766
  readonly tags: {
@@ -9278,7 +10818,7 @@ declare class Arbi {
9278
10818
  create: (options: {
9279
10819
  name: string;
9280
10820
  workspaceId?: string;
9281
- tagType?: TagFormat;
10821
+ tagType?: TagFormat$1;
9282
10822
  instruction?: string | null;
9283
10823
  shared?: boolean;
9284
10824
  /** What the tag is (`'issue'`: an issue; flat, no parent). Absent: from the format. */
@@ -9525,6 +11065,8 @@ declare class Arbi {
9525
11065
  name?: string | null;
9526
11066
  user_id?: string | null;
9527
11067
  contact_id?: string | null;
11068
+ address_book_ext_id?: string | null;
11069
+ registered: boolean;
9528
11070
  source: "contacts" | "arbi";
9529
11071
  }[]>;
9530
11072
  groupByStatus: typeof groupContactsByStatus;
@@ -9574,7 +11116,7 @@ declare class Arbi {
9574
11116
  description?: string | null;
9575
11117
  color: string;
9576
11118
  timezone: string;
9577
- kind: "calendar" | "resource" | "subscription" | "holidays" | "birthdays" | "addressbook";
11119
+ kind: "calendar" | "resource" | "subscription" | "holidays" | "addressbook";
9578
11120
  role: "owner" | "delegate" | "write" | "read" | "read_basic" | "freebusy";
9579
11121
  is_default: boolean;
9580
11122
  hidden: boolean;
@@ -9599,7 +11141,7 @@ declare class Arbi {
9599
11141
  description?: string | null;
9600
11142
  color: string;
9601
11143
  timezone: string;
9602
- kind: "calendar" | "resource" | "subscription" | "holidays" | "birthdays" | "addressbook";
11144
+ kind: "calendar" | "resource" | "subscription" | "holidays" | "addressbook";
9603
11145
  role: "owner" | "delegate" | "write" | "read" | "read_basic" | "freebusy";
9604
11146
  is_default: boolean;
9605
11147
  hidden: boolean;
@@ -9624,7 +11166,7 @@ declare class Arbi {
9624
11166
  description?: string | null;
9625
11167
  color: string;
9626
11168
  timezone: string;
9627
- kind: "calendar" | "resource" | "subscription" | "holidays" | "birthdays" | "addressbook";
11169
+ kind: "calendar" | "resource" | "subscription" | "holidays" | "addressbook";
9628
11170
  role: "owner" | "delegate" | "write" | "read" | "read_basic" | "freebusy";
9629
11171
  is_default: boolean;
9630
11172
  hidden: boolean;
@@ -9991,7 +11533,7 @@ declare class Arbi {
9991
11533
  description?: string | null;
9992
11534
  color: string;
9993
11535
  timezone: string;
9994
- kind: "calendar" | "resource" | "subscription" | "holidays" | "birthdays" | "addressbook";
11536
+ kind: "calendar" | "resource" | "subscription" | "holidays" | "addressbook";
9995
11537
  role: "owner" | "delegate" | "write" | "read" | "read_basic" | "freebusy";
9996
11538
  is_default: boolean;
9997
11539
  hidden: boolean;
@@ -10026,7 +11568,7 @@ declare class Arbi {
10026
11568
  description?: string | null;
10027
11569
  color: string;
10028
11570
  timezone: string;
10029
- kind: "calendar" | "resource" | "subscription" | "holidays" | "birthdays" | "addressbook";
11571
+ kind: "calendar" | "resource" | "subscription" | "holidays" | "addressbook";
10030
11572
  role: "owner" | "delegate" | "write" | "read" | "read_basic" | "freebusy";
10031
11573
  is_default: boolean;
10032
11574
  hidden: boolean;
@@ -10218,7 +11760,7 @@ declare class Arbi {
10218
11760
  description?: string | null;
10219
11761
  color: string;
10220
11762
  timezone: string;
10221
- kind: "calendar" | "resource" | "subscription" | "holidays" | "birthdays" | "addressbook";
11763
+ kind: "calendar" | "resource" | "subscription" | "holidays" | "addressbook";
10222
11764
  role: "owner" | "delegate" | "write" | "read" | "read_basic" | "freebusy";
10223
11765
  is_default: boolean;
10224
11766
  hidden: boolean;
@@ -10237,42 +11779,6 @@ declare class Arbi {
10237
11779
  can_write: boolean;
10238
11780
  ctag: string;
10239
11781
  }>;
10240
- listAppPasswords: () => Promise<{
10241
- id: string;
10242
- kind: "dav" | "feed" | "freebusy";
10243
- label: string;
10244
- calendar_ids?: string[];
10245
- feed_level?: string | null;
10246
- created_at: string;
10247
- last_used_at?: string | null;
10248
- }[]>;
10249
- createAppPassword: (body: AppPasswordCreateBody) => Promise<{
10250
- id: string;
10251
- kind: "dav" | "feed" | "freebusy";
10252
- label: string;
10253
- calendar_ids?: string[];
10254
- feed_level?: string | null;
10255
- created_at: string;
10256
- last_used_at?: string | null;
10257
- password?: string | null;
10258
- username?: string | null;
10259
- server_url?: string | null;
10260
- feed_url?: string | null;
10261
- }>;
10262
- createFeed: (body: FeedCreateBody) => Promise<{
10263
- id: string;
10264
- kind: "dav" | "feed" | "freebusy";
10265
- label: string;
10266
- calendar_ids?: string[];
10267
- feed_level?: string | null;
10268
- created_at: string;
10269
- last_used_at?: string | null;
10270
- password?: string | null;
10271
- username?: string | null;
10272
- server_url?: string | null;
10273
- feed_url?: string | null;
10274
- }>;
10275
- revokeAppPassword: (apwId: string) => Promise<void>;
10276
11782
  listBookingPages: () => Promise<{
10277
11783
  id: string;
10278
11784
  slug: string;
@@ -12809,6 +14315,126 @@ declare namespace mail {
12809
14315
  export { type mail_ListMessagesOptions as ListMessagesOptions, type mail_MailAccount as MailAccount, type mail_MailAddress as MailAddress, type mail_MailAddressInput as MailAddressInput, type mail_MailAttachment as MailAttachment, type mail_MailCompose as MailCompose, type mail_MailDraftSaved as MailDraftSaved, type mail_MailFetch as MailFetch, type mail_MailFolder as MailFolder, type mail_MailMessage as MailMessage, type mail_MailMessagePage as MailMessagePage, type mail_MailMessageUpdate as MailMessageUpdate, type mail_MailPolicy as MailPolicy, type mail_MailSend as MailSend, type mail_MailSendResult as MailSendResult, mail_NATIVE_ACCOUNT as NATIVE_ACCOUNT, type mail_NativeMailKeys as NativeMailKeys, mail_attachmentFromBytes as attachmentFromBytes, mail_claimNativeAlias as claimNativeAlias, mail_claimSecureMail as claimSecureMail, mail_createMailFetch as createMailFetch, mail_downloadAttachment as downloadAttachment, mail_getMailPolicy as getMailPolicy, mail_getMessage as getMessage, mail_listFolders as listFolders, mail_listMailAccounts as listMailAccounts, mail_listMessages as listMessages, mail_saveDraft as saveDraft, mail_sendMessage as sendMessage, mail_unlockNativeMail as unlockNativeMail, mail_updateMessage as updateMessage };
12810
14316
  }
12811
14317
 
14318
+ /**
14319
+ * Tag helpers: what kind of tag a tag is, how much carries it, which side of the workspace it is
14320
+ * used on, and its hierarchy (labels and annotations nest one level; issues, people and
14321
+ * organisations are flat). Pure functions over the tag list (`TagResponse`), for any client.
14322
+ */
14323
+
14324
+ type TagFormat = components['schemas']['TagFormat'];
14325
+ /** What the hierarchy helpers read of a tag. */
14326
+ type TagNode = Pick<TagResponse, 'external_id' | 'parent_ext_id' | 'kind'>;
14327
+ /**
14328
+ * What a tag is — the backend stores it explicitly (`TagResponse.kind`); never infer it from the
14329
+ * format (`tag_type`), which only says what kind of value an annotation carries:
14330
+ * - **label** — a short name that files a document or a fact. Carries no value.
14331
+ * - **annotation** — a per-document value (text, number, choice, date): document metadata,
14332
+ * optionally AI-filled.
14333
+ * - **search** — a saved search, not a document tag.
14334
+ * - **issue** — a point in dispute; on a document or fact it means "evidence for this issue".
14335
+ * - **person** / **organisation** — an entity; on a document it means "mentioned here" (the
14336
+ * doctag note says how; its role is its own Role field).
14337
+ * Each kind's fields (an issue's status, a person's position …) are the workspace's for that kind
14338
+ * (`GET /v1/tag/kinds/{kind}`); a tag holds its values. Issues and entities are flat.
14339
+ */
14340
+ /** The entity kinds: the people and organisations documents name. */
14341
+ type EntityKind = Extract<TagKind, 'person' | 'organisation'>;
14342
+ declare const ENTITY_KINDS: readonly EntityKind[];
14343
+ /**
14344
+ * Kinds whose value on a document is just being there: a doctag is added or removed, no note. All
14345
+ * carry the checkbox format, so a tag can be changed between them.
14346
+ */
14347
+ declare const PRESENCE_KINDS: readonly TagKind[];
14348
+ /** The kind the server gives a new tag of this format when none is sent. */
14349
+ declare function defaultKindForFormat(format: TagFormat['type']): TagKind;
14350
+ /** How many documents, facts and threads carry a tag. */
14351
+ declare function tagUseCount(tag: Partial<Pick<TagResponse, 'doctag_count' | 'facttag_count' | 'convotag_count'>>): number;
14352
+ /** Filter out non-document tags (saved searches) from a list of tags. */
14353
+ declare function filterDocumentTags<T extends Pick<TagResponse, 'kind'>>(tags: T[]): T[];
14354
+ /** A tag added to or removed from a document as a whole (label, issue, person, organisation). */
14355
+ declare function isPresenceTag(tag: Pick<TagResponse, 'kind'>): boolean;
14356
+ /**
14357
+ * A plain label: what a label picker offers. Issues, people and organisations share the checkbox
14358
+ * format but are not labels — they are managed on the Tags page.
14359
+ */
14360
+ declare function isLabelTag(tag: Pick<TagResponse, 'kind'>): boolean;
14361
+ declare function isAnnotationTag(tag: Pick<TagResponse, 'kind'>): boolean;
14362
+ declare function isEntityTag(tag: Pick<TagResponse, 'kind'>): boolean;
14363
+ /** The two groups the Fields panel manages: labels and annotations (every kind: the Tags page). */
14364
+ type TagGroup = 'label' | 'annotation';
14365
+ declare function tagsOfGroup<T extends Pick<TagResponse, 'kind'>>(tags: T[], group: TagGroup): T[];
14366
+ /**
14367
+ * Which side of the app a label belongs to.
14368
+ *
14369
+ * Labels are ONE shared set of tag rows — the backend has a single `tags`
14370
+ * table, joined to documents through doctags and to facts through facttags —
14371
+ * but to a reader a label used on documents and one used on facts are separate
14372
+ * vocabularies, and mixing them lists things that cannot apply to what you are
14373
+ * looking at. Side is therefore derived from use, via the two counts the API
14374
+ * reports, rather than stored on the tag.
14375
+ *
14376
+ * A tag used nowhere yet belongs to NEITHER side, so it is offered on both:
14377
+ * otherwise a label would vanish from the very panel that just created it,
14378
+ * before it has been applied to anything.
14379
+ */
14380
+ type TagScope = 'document' | 'fact';
14381
+ declare function tagsForScope<T extends Partial<Pick<TagResponse, 'doctag_count' | 'facttag_count'>>>(tags: T[], scope: TagScope): T[];
14382
+ /**
14383
+ * How many levels the tag tree may have: a root plus one nested level.
14384
+ *
14385
+ * A field row is already dense (checkbox, name, type, share toggle, usage
14386
+ * count, expander), so each extra indent level costs width the row cannot
14387
+ * spare and a deep checkbox list stops being scannable. Two levels also
14388
+ * matches the only hierarchy the app already reads — `DocumentTable` hides a
14389
+ * tag whose parent is a `select` tag.
14390
+ */
14391
+ declare const TAG_NESTING_MAX_DEPTH = 2;
14392
+ /** One row of the flattened tree, in render order. */
14393
+ interface TagTreeRow<T extends TagNode = TagNode> {
14394
+ tag: T;
14395
+ /** 0 for a top-level tag, 1 for its child, and so on. */
14396
+ depth: number;
14397
+ /** Direct children of this tag that are present in the same list. */
14398
+ childCount: number;
14399
+ }
14400
+ /** Direct children of `tagId` that are present in `tags`. */
14401
+ declare function getChildTags<T extends TagNode>(tags: T[], tagId: string): T[];
14402
+ /**
14403
+ * Every tag beneath `tagId`, at any depth. Terminates on a pre-existing cycle
14404
+ * because an id is only expanded the first time it is seen.
14405
+ */
14406
+ declare function getTagDescendantIds<T extends TagNode>(tags: T[], tagId: string): Set<string>;
14407
+ /**
14408
+ * Flatten the tags into render order: every tag immediately followed by its
14409
+ * children, with the caller's ordering preserved among siblings.
14410
+ *
14411
+ * This is what keeps a child next to its parent no matter how the list was
14412
+ * sorted upstream — sorting the flat array would scatter them.
14413
+ */
14414
+ declare function flattenTagTree<T extends TagNode>(tags: T[]): TagTreeRow<T>[];
14415
+ /**
14416
+ * Tags that may be chosen as `tagId`'s parent (omit `tagId` when creating).
14417
+ *
14418
+ * Excludes the tag itself and all of its descendants — that is the cycle
14419
+ * guard — and any tag that is already nested, which is the
14420
+ * `TAG_NESTING_MAX_DEPTH` cap seen from the parent's side.
14421
+ */
14422
+ /** Issues, people and organisations are flat: no parent, no children. */
14423
+ declare const isFlatKind: (kind: TagKind) => boolean;
14424
+ declare function getEligibleParentTags<T extends TagNode>(tags: T[], tagId?: string): T[];
14425
+ /**
14426
+ * Whether nesting `tagId` under `parentId` would make the tag its own
14427
+ * ancestor. `getEligibleParentTags` already withholds those options; this is
14428
+ * the assertion for callers that did not come through the picker.
14429
+ */
14430
+ declare function wouldCreateTagCycle<T extends TagNode>(tags: T[], tagId: string, parentId: string | null | undefined): boolean;
14431
+ /**
14432
+ * Whether `tagId` may be nested at all. A tag that already has children cannot
14433
+ * be, since that would make a three-level tree — `TAG_NESTING_MAX_DEPTH` seen
14434
+ * from the child's side.
14435
+ */
14436
+ declare function canTagHaveParent<T extends TagNode>(tags: T[], tagId: string): boolean;
14437
+
12812
14438
  /**
12813
14439
  * Session operations — list, end one, sign out of all.
12814
14440
  */
@@ -12911,4 +14537,4 @@ declare namespace identity {
12911
14537
  export { type identity_IdentityErrorCode as IdentityErrorCode, type identity_IdentityPurchase as IdentityPurchase, type identity_IdentityState as IdentityState, type identity_IdentityStatus as IdentityStatus, identity_acceptName as acceptName, identity_getStatus as getStatus, identity_identityErrorCode as identityErrorCode, identity_purchase as purchase, identity_refresh as refresh, identity_remove as remove, identity_startSession as startSession };
12912
14538
  }
12913
14539
 
12914
- export { type CliCredentials as $, ACCOUNT_VENDOR as A, type BookingConfirmation as B, type CalDavConnectBody as C, type CalDavProfile as D, type CalendarAccount as E, type CalendarAccountKind as F, type CalendarCreateBody as G, type CalendarEvent as H, type CalendarKeys as I, type CalendarRead as J, type CalendarSettings as K, type CalendarSettingsBody as L, type CalendarUpdate as M, type CalendarWindow as N, type ChatAttachmentFile as O, type ChatAttachmentInput as P, type ChatCryptoContext as Q, type ChatKeyRing as R, type ChatKind as S, type ChatMemberKey as T, type ChatMemberResponse as U, type ChatMessageResponse as V, type ChatResponse as W, type ChatSession as X, type CitationSummary as Y, type CitationToolSources as Z, type CliConfig as _, type AccountSyncResult as a, type MessageLevel as a$, type CommandDescriptor as a0, type ConfigStore as a1, type ConnectOptions as a2, type ConnectorCatalogEntry as a3, type ConnectorFolder as a4, type ConnectorSyncProgress as a5, type ConnectorSyncStatus as a6, type ConnectorVendorKey as a7, type ConnectorVisibilitySettings as a8, type ConversationResponse as a9, type FactResponse as aA, type FactSearchRequest as aB, type FactSearchResponse as aC, type FeedCreateBody as aD, type FeedLevel as aE, type FindTimeParams as aF, type FormattedWsMessage as aG, type FreeBusyEntry as aH, GOOGLE_VENDORS as aI, type HolidayCountry as aJ, type HouseTemplateCandidate as aK, IMANAGE_VENDORS as aL, type IdentityErrorCode as aM, type IdentityPurchase as aN, type IdentityState as aO, type IdentityStatus as aP, type ImportResult as aQ, type InvitationRead as aR, type LinkedRun as aS, type ListAllOptions as aT, type ListEventsParams as aU, type ListFactsOptions as aV, type ListPaginatedOptions as aW, MAILBOX_SYNC_VENDORS as aX, MICROSOFT_VENDORS as aY, type MailAttachment as aZ, type MailDraftSSEEvent as a_, type ConversationUsageResponse as aa, type CreateFactRequest as ab, type CreateFactsRequest as ac, type CreateWorkRequest as ad, type CreateWorkflowRequest as ae, DEFAULT_AI_USD_PER_GBP as af, DOC_TERMINAL_STATUSES as ag, DRIVE_SYNC_VENDORS as ah, type DateTimeSpec as ai, type DecryptedChat as aj, type DecryptedChatMessage as ak, type DeferredInterjectionEvent as al, type DeploymentHouseTemplate as am, type DocNameMap as an, type DocumentAutomationAction as ao, type DocumentListFields as ap, type DocumentListOrder as aq, type DocumentSelector as ar, type DocumentWaiter as as, type DocumentWaiterOptions as at, type DriveSyncProgress as au, type DriveSyncSummary as av, type EditScope as aw, type EventCreateBody as ax, type EventPatchBody as ay, FLAT_TAG_KINDS as az, type ActivityKind as b, type StepField as b$, type MessageMetadataPayload$1 as b0, type MessageQueuedEvent as b1, type OAuthAccountKind as b2, type OutputTokensDetails as b3, type OverlayItem as b4, type OverlayLayerName as b5, type ParsedSlashCommand as b6, type PendingAuthResponse as b7, type PersonKey as b8, PlanStepsError as b9, type ResponseOutputItemDoneEvent as bA, type ResponseOutputTextDeltaEvent as bB, type ResponseOutputTextDoneEvent as bC, type ResponseUsage as bD, type RoomCreateBody as bE, type RoomQuery as bF, type RoomRead as bG, type RunProgress as bH, type RunStep as bI, type RunWaitingOn as bJ, SHAREPOINT_VENDORS as bK, type SSEEvent as bL, type SSEStreamCallbacks as bM, type SSEStreamResult as bN, type SSEStreamStartData as bO, STEP_FIELD_OPTION_TONES as bP, SUPPORTED_EXTENSIONS as bQ, type ScopedTarget as bR, type SendBack as bS, type ShareRead as bT, type ShareRole as bU, type SkillSummary as bV, type SkippedFile as bW, type SlackConnectionStatus as bX, type StepActionRequest as bY, type StepActivityEvent as bZ, type StepAssignee as b_, type PlanWorkRequest as ba, type ProbeAnswerEvent as bb, type ProjectBudget as bc, type ProjectConversationUsageResponse as bd, type ProjectDetails as be, type ProjectEventKind as bf, type ProjectEventResponse as bg, type ProjectInvoicesResponse as bh, type ProjectResponse as bi, type ProjectUpdateRequest as bj, type ProjectUsageResponse as bk, PublicBookingError as bl, type PublicBookingPage as bm, type QueryOptions as bn, type RaisedSignal as bo, type ReconnectOptions as bp, type ReconnectableWsConnection as bq, type ResolvedCitation as br, type ResolvedRecipient as bs, type RespondParams as bt, type RespondPartstat as bu, type ResponseCompletedEvent as bv, type ResponseContentPartAddedEvent as bw, type ResponseCreatedEvent as bx, type ResponseFailedEvent as by, type ResponseOutputItemAddedEvent as bz, type ActivityResponse as c, connectErrorMessage as c$, type StepFieldOption as c0, type StepFieldOptionTone as c1, type StepKind as c2, type StepPhase as c3, type StepSignal as c4, type StepSignalWhen as c5, type StepState as c6, type StepStatus as c7, type SubmitBackgroundQueryOptions as c8, type SubscribeParams as c9, type UserInfo as cA, type UserInputRequestEvent as cB, type UserMessageEvent as cC, WebSocketAuthError as cD, type WeeklyHoursSpec as cE, type WorkStatus as cF, type WorkflowAuthMode as cG, type WorkflowResponse as cH, type WorkflowRunHistoryResponse as cI, type WorkflowRunResponse as cJ, type WorkspaceContext as cK, type WsConnection as cL, account as cM, agentconfig as cN, agents as cO, assistant as cP, authenticatedFetch as cQ, bookPublicSlot as cR, buildCitationChunkData as cS, buildDocNameMap as cT, buildFactsContextTool as cU, buildRetrievalChunkTool as cV, buildRetrievalFullContextTool as cW, buildRetrievalTocTool as cX, calendar as cY, cancelPublicBooking as cZ, chats as c_, type SyncTriggerResult as ca, TAG_KINDS as cb, type TagChange as cc, type TagFieldDefinition as cd, type TagKind as ce, type TagKindField as cf, type TagKindSchema as cg, type TagLinks as ch, type TagListQuery as ci, type TagResponse as cj, type TaskPlan as ck, type TaskPlanStep as cl, type TimeSuggestion as cm, type TokenBudgetContext as cn, type UpdateConversationRequest as co, type UpdateFactRequest as cp, type UpdateWorkflowRequest as cq, type UploadBatchResult as cr, type UploadDirectOptions as cs, type UploadDirectResult as ct, type UploadDocumentsOptions as cu, type UploadOptions as cv, type UploadResult as cw, type UsageBreakdown as cx, type UserConnectorEntry as cy, type UserDailyUsageResponse as cz, type AgentControlStateEvent as d, summarizeCitations as d$, connectWebSocket as d0, connectWithReconnect as d1, connectors as d2, consumeSSEStream as d3, contacts as d4, conversations as d5, countCitations as d6, createAuthenticatedClient as d7, createDocumentWaiter as d8, doctags as d9, isMailboxSyncVendor as dA, isSharePointVendor as dB, isSharedSkill as dC, mail as dD, notifications as dE, parseSSEEvents as dF, parseSlashCommand as dG, parseSlashTokenInProgress as dH, performPasswordLogin as dI, performSigningKeyLogin as dJ, performSsoDeviceFlowLogin as dK, profile as dL, projects as dM, requireData as dN, requireOk as dO, resolveAuth as dP, resolveCitations as dQ, resolveWorkspace as dR, responses as dS, selectWorkspace as dT, selectWorkspaceById as dU, sessions as dV, settings as dW, signatureRequests as dX, splitAppPasswords as dY, streamSSE as dZ, stripCitationMarkdown as d_, documents as da, facts as db, files as dc, filterSkills as dd, formatAgentStepLabel as de, formatFileSize as df, formatGbp as dg, formatGbpPerMillionTokens as dh, formatItemLabel as di, formatStreamSummary as dj, formatUserName as dk, formatWorkspaceChoices as dl, formatWsMessage as dm, generateEncryptedWorkspaceKey as dn, generateNewWorkspaceKey as dp, getErrorCode as dq, getErrorMessage as dr, getPublicBookingPage as ds, getRawWorkspaceKey as dt, health as du, houseTemplate as dv, identity as dw, identityErrorCode as dx, isConnectorVendorVisible as dy, isDriveSyncVendor as dz, type AgentStepDeltaEvent as e, tags as e0, uploadSkill as e1, usdToGbp as e2, work as e3, workflowSteps as e4, workflows as e5, workspaces as e6, type AgentStepEvent as f, type AppPassword as g, type AppPasswordCreateBody as h, type AppPasswordCreated as i, Arbi as j, ArbiApiError as k, ArbiError as l, type ArbiErrorEvent as m, type ArbiHostSession as n, type ArbiOptions as o, ArbiSessionExpiredError as p, type ArtifactEvent as q, type AttendeeRead as r, type AuthContext as s, type AuthHeaders as t, type AuthMode as u, type AuthenticatedClient as v, type BookingPage as w, type BookingPageWriteBody as x, type BookingRequestBody as y, type BridgeTokensOptions as z };
14540
+ export { type ConnectOptions as $, ACCOUNT_VENDOR as A, type BookingConfirmation as B, type CalDavConnectBody as C, type CalendarCreateBody as D, type CalendarEvent as E, type CalendarKeys as F, type CalendarRead as G, type CalendarSettings as H, type CalendarSettingsBody as I, type CalendarUpdate as J, type CalendarWindow as K, type ChatAttachmentFile as L, type ChatAttachmentInput as M, type ChatCryptoContext as N, type ChatKeyRing as O, type ChatKind as P, type ChatMemberKey as Q, type ChatMemberResponse as R, type ChatMessageResponse as S, type ChatResponse as T, type ChatSession as U, type CitationSummary as V, type CitationToolSources as W, type CliConfig as X, type CliCredentials as Y, type CommandDescriptor as Z, type ConfigStore as _, type AccountSyncResult as a, type MessageQueuedEvent as a$, type ConnectorCatalogEntry as a0, type ConnectorFolder as a1, type ConnectorSyncProgress as a2, type ConnectorSyncStatus as a3, type ConnectorVendorKey as a4, type ConnectorVisibilitySettings as a5, type ConversationResponse as a6, type ConversationUsageResponse as a7, type CreateFactRequest as a8, type CreateFactsRequest as a9, type FactSearchRequest as aA, type FactSearchResponse as aB, type FindTimeParams as aC, type FormattedWsMessage as aD, type FreeBusyEntry as aE, GOOGLE_VENDORS as aF, type HolidayCountry as aG, type HouseTemplateCandidate as aH, IMANAGE_VENDORS as aI, type IdentityErrorCode as aJ, type IdentityPurchase as aK, type IdentityState as aL, type IdentityStatus as aM, type ImportResult as aN, type InvitationRead as aO, type LinkedRun as aP, type ListAllOptions as aQ, type ListEventsParams as aR, type ListFactsOptions as aS, type ListPaginatedOptions as aT, MAILBOX_SYNC_VENDORS as aU, MAX_RETRIEVE_DOC_IDS as aV, MICROSOFT_VENDORS as aW, type MailAttachment as aX, type MailDraftSSEEvent as aY, type MessageLevel as aZ, type MessageMetadataPayload$1 as a_, type CreateWorkRequest as aa, type CreateWorkflowRequest as ab, DEFAULT_AI_USD_PER_GBP as ac, DOC_TERMINAL_STATUSES as ad, DRIVE_SYNC_VENDORS as ae, type DateTimeSpec as af, type DecryptedChat as ag, type DecryptedChatMessage as ah, type DeferredInterjectionEvent as ai, type DeploymentHouseTemplate as aj, type DocNameMap as ak, type DocumentAutomationAction as al, type DocumentListFields as am, type DocumentListOrder as an, type DocumentSelector as ao, type DocumentWaiter as ap, type DocumentWaiterOptions as aq, type DriveSyncProgress as ar, type DriveSyncSummary as as, ENTITY_KINDS as at, type EditScope as au, type EntityKind as av, type EventCreateBody as aw, type EventPatchBody as ax, FLAT_TAG_KINDS as ay, type FactResponse as az, type ActivityKind as b, type ShareRead as b$, type OAuthAccountKind as b0, type OutputTokensDetails as b1, type OverlayItem as b2, type OverlayLayerName as b3, PRESENCE_KINDS as b4, type ParsedSlashCommand as b5, type PendingAuthResponse as b6, type PersonKey as b7, PlanStepsError as b8, type PlanWorkRequest as b9, type RespondParams as bA, type RespondPartstat as bB, type ResponseCompletedEvent as bC, type ResponseContentPartAddedEvent as bD, type ResponseCreatedEvent as bE, type ResponseFailedEvent as bF, type ResponseOutputItemAddedEvent as bG, type ResponseOutputItemDoneEvent as bH, type ResponseOutputTextDeltaEvent as bI, type ResponseOutputTextDoneEvent as bJ, type ResponseUsage as bK, type RoomCreateBody as bL, type RoomQuery as bM, type RoomRead as bN, type RunProgress as bO, type RunStep as bP, type RunWaitingOn as bQ, SHAREPOINT_VENDORS as bR, type SSEEvent as bS, type SSEStreamCallbacks as bT, type SSEStreamResult as bU, type SSEStreamStartData as bV, STEP_FIELD_OPTION_TONES as bW, SUPPORTED_EXTENSIONS as bX, type ScopedTarget as bY, type SearchChunk as bZ, type SendBack as b_, type ProbeAnswerEvent as ba, type ProductResponse as bb, type ProjectAddonKind as bc, type ProjectAddonSettingsRequest as bd, type ProjectBudget as be, type ProjectCheckoutRequest as bf, type ProjectConversationUsageResponse as bg, type ProjectCreateOptions as bh, type ProjectDetails as bi, type ProjectEventKind as bj, type ProjectEventResponse as bk, type ProjectInvoicesResponse as bl, type ProjectNextPeriodAddonsRequest as bm, type ProjectPlanChangeRequest as bn, type ProjectQuoteRequest as bo, type ProjectResponse as bp, type ProjectUpdateRequest as bq, type ProjectUsageResponse as br, PublicBookingError as bs, type PublicBookingPage as bt, type QueryOptions as bu, type RaisedSignal as bv, type ReconnectOptions as bw, type ReconnectableWsConnection as bx, type ResolvedCitation as by, type ResolvedRecipient as bz, type ActivityResponse as c, agentconfig as c$, type ShareRole as c0, type SkillSummary as c1, type SkippedFile as c2, type SlackConnectionStatus as c3, type StepActionRequest as c4, type StepActivityEvent as c5, type StepAssignee as c6, type StepField as c7, type StepFieldOption as c8, type StepFieldOptionTone as c9, type TimeSuggestion as cA, type TokenBudgetContext as cB, type UpdateConversationRequest as cC, type UpdateFactRequest as cD, type UpdateWorkflowRequest as cE, type UploadBatchResult as cF, type UploadDirectOptions as cG, type UploadDirectResult as cH, type UploadDocumentsOptions as cI, type UploadOptions as cJ, type UploadResult as cK, type UsageBreakdown as cL, type UserConnectorEntry as cM, type UserDailyUsageResponse as cN, type UserInfo as cO, type UserInputRequestEvent as cP, type UserMessageEvent as cQ, WebSocketAuthError as cR, type WeeklyHoursSpec as cS, type WorkStatus as cT, type WorkflowAuthMode as cU, type WorkflowResponse as cV, type WorkflowRunHistoryResponse as cW, type WorkflowRunResponse as cX, type WorkspaceContext as cY, type WsConnection as cZ, account as c_, type StepKind as ca, type StepPhase as cb, type StepSignal as cc, type StepSignalWhen as cd, type StepState as ce, type StepStatus as cf, type SubmitBackgroundQueryOptions as cg, type SubscribeParams as ch, type SyncTriggerResult as ci, TAG_KINDS as cj, TAG_NESTING_MAX_DEPTH as ck, type TagChange as cl, type TagFieldDefinition as cm, type TagGroup as cn, type TagKind as co, type TagKindField as cp, type TagKindSchema as cq, type TagLinks as cr, type TagListQuery as cs, type TagNode as ct, type TagResponse as cu, type TagScope as cv, type TagTreeRow as cw, type TaskPlan as cx, type TaskPlanStep as cy, type TaxQuoteResponse as cz, type AgentControlStateEvent as d, isSharePointVendor as d$, agents as d0, assistant as d1, authenticatedFetch as d2, bookPublicSlot as d3, buildCitationChunkData as d4, buildDocNameMap as d5, buildFactsContextTool as d6, buildRetrievalChunkTool as d7, buildRetrievalFullContextTool as d8, buildRetrievalTocTool as d9, formatGbpPerMillionTokens as dA, formatItemLabel as dB, formatStreamSummary as dC, formatUserName as dD, formatWorkspaceChoices as dE, formatWsMessage as dF, generateEncryptedWorkspaceKey as dG, generateNewWorkspaceKey as dH, getChildTags as dI, getEligibleParentTags as dJ, getErrorCode as dK, getErrorMessage as dL, getPublicBookingPage as dM, getRawWorkspaceKey as dN, getTagDescendantIds as dO, health as dP, houseTemplate as dQ, identity as dR, identityErrorCode as dS, isAnnotationTag as dT, isConnectorVendorVisible as dU, isDriveSyncVendor as dV, isEntityTag as dW, isFlatKind as dX, isLabelTag as dY, isMailboxSyncVendor as dZ, isPresenceTag as d_, calendar as da, canTagHaveParent as db, cancelPublicBooking as dc, chats as dd, connectErrorMessage as de, connectWebSocket as df, connectWithReconnect as dg, connectors as dh, consumeSSEStream as di, contacts as dj, conversations as dk, countCitations as dl, createAuthenticatedClient as dm, createDocumentWaiter as dn, defaultKindForFormat as dp, doctags as dq, documents as dr, facts as ds, files as dt, filterDocumentTags as du, filterSkills as dv, flattenTagTree as dw, formatAgentStepLabel as dx, formatFileSize as dy, formatGbp as dz, type AgentStepDeltaEvent as e, isSharedSkill as e0, mail as e1, notifications as e2, parseSSEEvents as e3, parseSlashCommand as e4, parseSlashTokenInProgress as e5, performPasswordLogin as e6, performSigningKeyLogin as e7, performSsoDeviceFlowLogin as e8, profile as e9, workspaces as eA, wouldCreateTagCycle as eB, projects as ea, refusalReason as eb, requireData as ec, requireOk as ed, resolveAuth as ee, resolveCitations as ef, resolveWorkspace as eg, responses as eh, searchChunks as ei, selectWorkspace as ej, selectWorkspaceById as ek, sessions as el, settings as em, signatureRequests as en, streamSSE as eo, stripCitationMarkdown as ep, summarizeCitations as eq, tagUseCount as er, tags as es, tagsForScope as et, tagsOfGroup as eu, uploadSkill as ev, usdToGbp as ew, work as ex, workflowSteps as ey, workflows as ez, type AgentStepEvent as f, Arbi as g, ArbiApiError as h, ArbiError as i, type ArbiErrorEvent as j, type ArbiHostSession as k, type ArbiOptions as l, ArbiSessionExpiredError as m, type ArtifactEvent as n, type AttendeeRead as o, type AuthContext as p, type AuthHeaders as q, type AuthMode as r, type AuthenticatedClient as s, type BookingPage as t, type BookingPageWriteBody as u, type BookingRequestBody as v, type BridgeTokensOptions as w, type CalDavProfile as x, type CalendarAccount as y, type CalendarAccountKind as z };