@getmodus/sdk 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/dist/_client-base-DQgSSU83.d.cts +71876 -0
- package/dist/_client-base-DQgSSU83.d.ts +71876 -0
- package/dist/{chunk-QHA3LF2Q.cjs → chunk-QNATP2BM.cjs} +2625 -406
- package/dist/chunk-QNATP2BM.cjs.map +1 -0
- package/dist/{chunk-3CKUUDEJ.js → chunk-SDGHNRZY.js} +2628 -409
- package/dist/chunk-SDGHNRZY.js.map +1 -0
- package/dist/index.cjs +559 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +337 -37
- package/dist/index.d.ts +337 -37
- package/dist/index.js +434 -46
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +5112 -2114
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +3940 -1400
- package/dist/management/index.d.ts +3940 -1400
- package/dist/management/index.js +5049 -2051
- package/dist/management/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/_client-base-DvrAQWuU.d.cts +0 -30305
- package/dist/_client-base-DvrAQWuU.d.ts +0 -30305
- package/dist/chunk-3CKUUDEJ.js.map +0 -1
- package/dist/chunk-QHA3LF2Q.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/_generated/resources/management/workflows.ts","../../src/_query.ts","../../src/_generated/resources/management/workflows/interfaces.ts","../../src/management/workflows/interfaces.ts","../../src/management/workflows/agents.ts","../../src/types/context.ts","../../src/management/context/_content-merge.ts","../../src/_generated/resources/management/context/dashboards.ts","../../src/_generated/resources/management/context/dashboards/elements.ts","../../src/management/context/dashboards.ts","../../src/management/context/files.ts","../../src/_generated/resources/management/context/files.ts","../../src/management/context/items.ts","../../src/management/context/context.ts","../../src/_generated/resources/management/scopes.ts","../../src/management/_access-config.ts","../../src/_generated/resources/management/scopes/memories.ts","../../src/management/scopes/memories.ts","../../src/management/scopes/evaluations.ts","../../src/_generated/resources/management/scopes/evaluations.ts","../../src/_generated/resources/management/scopes/interfaces.ts","../../src/management/scopes/interfaces.ts","../../src/_generated/resources/management/scopes/supervision.ts","../../src/management/scopes/supervision.ts","../../src/management/scopes/skills.ts","../../src/_generated/resources/management/usage.ts","../../src/management/usage.ts","../../src/_generated/resources/management/tools.ts","../../src/management/tools.ts","../../src/management/users.ts","../../src/management/index.ts"],"sourcesContent":["// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../_pagination.js'\nimport { asRecord, invokeWithRetry } from '../../../_request.js'\nimport { validateId, validatePageSize } from '../../../_validation.js'\nimport type { VariationView } from '../../../types/views.js'\nimport type { Workflow, WorkflowType } from '../../../types/workflows.js'\n\n/** Generated base for the management `workflows` resource. */\nexport class WorkflowsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List workflows.\n *\n * Returns a paginated page of workflows the caller can at least `use`. Workflows the caller\n * cannot see are filtered out. Pagination uses an opaque token returned in `nextPageToken`.\n *\n * **Requires:** `workflows:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @param options.search - Case-insensitive substring filter on workflow name.\n * @param options.type - Filter by workflow type.\n * @param options.view - Variation view. `active` reads the deployed version. `draft` reads the\n * latest builder snapshot. `published` reads only a published workflow of type workflow that\n * you can use; tasks are excluded.\n * @param options.includeVariation - Include the requested variation payload (`trigger`,\n * `workflowStructure`, `agentSelection`) on list rows.\n * @returns A page of workflows.\n *\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * for await (const wf of (await mgmt.workflows.list({ search: 'digest' })).autoPagingIter()) {\n * console.log(wf.id, wf.name, wf.status)\n * }\n * ```\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n search?: string\n type?: WorkflowType\n view?: VariationView\n includeVariation?: boolean\n } = {}): Promise<Page<Workflow>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken, options.search, options.type, options.view, options.includeVariation)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n search?: string,\n type?: WorkflowType,\n view?: VariationView,\n includeVariation?: boolean,\n ): Promise<Page<Workflow>> {\n const extra: Record<string, string | boolean> = {}\n if (search !== undefined) extra.search = search\n if (type !== undefined) extra.type = type\n if (view !== undefined) extra.view = view\n if (includeVariation !== undefined) extra.includeVariation = includeVariation\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'WorkflowsController_list', {\n query: aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'workflows',\n (raw) => raw as Workflow,\n (token) => this.listPage(pageSize, token, search, type, view, includeVariation),\n )\n }\n\n /**\n * Delete a workflow.\n *\n * Deletes a workflow and stops its schedule. The workflow can be restored later with POST\n * /workflows/{id}/restore. Returns 404 if the workflow does not exist or is already deleted.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n *\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * await mgmt.workflows.delete('PLACEHOLDER_WORKFLOW_ID')\n * ```\n */\n async delete(workflowId: number | string): Promise<void> {\n validateId(workflowId, 'workflow_id')\n await invokeWithRetry(this.config, this.http, 'WorkflowsController_delete', {\n pathParams: { id: workflowId },\n })\n }\n\n /**\n * Restore a deleted workflow.\n *\n * Restores a previously deleted workflow and returns it. The workflow’s schedule is not resumed\n * automatically — re-enable it if it should run again. Restoring an active workflow returns it\n * unchanged.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n */\n async restore(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowsController_restore', {\n pathParams: { id: workflowId },\n jsonBody: {},\n })\n return data as Workflow\n }\n\n /**\n * Cancel ownership transfer.\n *\n * Cancels a pending ownership transfer. The current owner may cancel; the pending recipient may\n * decline.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n */\n async cancelOwnershipTransfer(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowsController_cancelOwnershipTransfer', {\n pathParams: { id: workflowId },\n })\n return data as Workflow\n }\n\n /**\n * Accept ownership transfer.\n *\n * Accepts a pending ownership transfer. Only the pending recipient may invoke this action.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n */\n async acceptOwnershipTransfer(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowsController_acceptOwnershipTransfer', {\n pathParams: { id: workflowId },\n jsonBody: {},\n })\n return data as Workflow\n }\n}\n","import { ValidationError } from './_exceptions.js'\n\nexport function updateMaskQuery(\n updateMask?: string,\n): Record<string, string> | undefined {\n if (updateMask === undefined) return undefined\n if (!updateMask.trim()) {\n throw new ValidationError('update_mask must be a non-empty comma-separated list of field names')\n }\n return { updateMask }\n}\n\n/**\n * A PATCH body: the fields the caller set, plus `null` for each masked field left unset.\n *\n * The server writes only fields that are both in the mask and present in the body, so a masked\n * field left unset must go on the wire as `null` to be cleared. A nested mask path\n * (`accessConfig.visibility`) never nulls its root object.\n */\nexport function updateBody(fields: object, updateMask?: string): Record<string, unknown> {\n const body: Record<string, unknown> = Object.fromEntries(\n Object.entries(fields).filter(([, value]) => value !== undefined),\n )\n for (const field of updateMask?.split(',') ?? []) {\n const name = field.trim()\n if (name && !name.includes('.') && !(name in body)) body[name] = null\n }\n return body\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type { AgentInterface } from '../../../../management/workflows/interfaces.js'\n\n/** Generated base for the management `workflows.interfaces` resource. */\nexport class WorkflowsInterfacesResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly workflowId: number | string,\n ) {}\n\n /**\n * List interfaces attached to a workflow.\n *\n * Returns every Slack, MCP, or Teams interface bound to the workflow. Requires manage permission\n * on the workflow: returns 403 if you can only use it, and 404 if you cannot access it.\n *\n * **Requires:** `workflows:read`\n */\n async list(): Promise<AgentInterface[]> {\n validateId(this.workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowInterfacesController_list', {\n pathParams: { id: this.workflowId },\n })\n return (data as { interfaces: AgentInterface[] }).interfaces\n }\n\n /**\n * Remove every interface from a workflow.\n *\n * Deletes all interface rows attached to the workflow. Useful when recreating the interface set\n * from scratch.\n *\n * **Requires:** `workflows:write`\n */\n async deleteAll(): Promise<void> {\n validateId(this.workflowId, 'workflow_id')\n await invokeWithRetry(this.config, this.http, 'WorkflowInterfacesController_deleteAll', {\n pathParams: { id: this.workflowId },\n })\n }\n\n /**\n * Remove a workflow interface.\n *\n * Deletes one interface row. For MCP interfaces, bound MCP tokens are revoked best-effort.\n *\n * **Requires:** `workflows:write`\n *\n * @param interfaceId - Interface row id (UUID).\n */\n async delete(interfaceId: string): Promise<void> {\n validateId(this.workflowId, 'workflow_id')\n validateId(interfaceId, 'interface_id')\n await invokeWithRetry(this.config, this.http, 'WorkflowInterfacesController_delete', {\n pathParams: { id: this.workflowId, interfaceId },\n })\n }\n}\n","import { WorkflowsInterfacesResourceBase } from '../../_generated/resources/management/workflows/interfaces.js'\nimport { updateBody, updateMaskQuery } from '../../_query.js'\nimport { invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type { components } from '../../_generated/v1.js'\n\nexport type AgentInterface = components['schemas']['AgentInterfaceDto']\nexport type AddAgentInterface = components['schemas']['AddAgentInterfaceDto']\nexport type UpdateAgentInterface = components['schemas']['UpdateAgentInterfaceDto']\n\nexport class WorkflowInterfacesResource extends WorkflowsInterfacesResourceBase {\n\n /**\n * Add an interface to this workflow.\n *\n * @param options - Interface configuration to attach.\n * @returns The created interface.\n */\n async create(options: AddAgentInterface): Promise<AgentInterface> {\n validateId(this.workflowId, 'workflow_id')\n return await invokeWithRetry(this.config, this.http, 'WorkflowInterfacesController_add', {\n pathParams: { id: this.workflowId },\n jsonBody: omitUndefined(options),\n }) as AgentInterface\n }\n\n /**\n * Update an interface attached to this workflow.\n *\n * @param interfaceId - Interface id.\n * @param options - Updated interface values.\n * @param updateMask - Optional comma-separated field names to update.\n * @returns The updated interface.\n */\n async update(interfaceId: string, options: UpdateAgentInterface, updateMask?: string): Promise<AgentInterface> {\n validateId(this.workflowId, 'workflow_id')\n validateId(interfaceId, 'interface_id')\n return await invokeWithRetry(this.config, this.http, 'WorkflowInterfacesController_update', {\n pathParams: { id: this.workflowId, interfaceId },\n query: updateMaskQuery(updateMask),\n jsonBody: updateBody(options, updateMask),\n }) as AgentInterface\n }\n}\n","import { WorkflowsResourceBase } from '../../_generated/resources/management/workflows.js'\nimport type { OperationId } from '../../_generated/operations.js'\nimport { updateBody, updateMaskQuery } from '../../_query.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type { Workflow, WorkflowType } from '../../types/workflows.js'\nimport type { VariationView } from '../../types/views.js'\nimport { WorkflowInterfacesResource } from './interfaces.js'\n\nexport type TriggerInput = Record<string, unknown>\nexport type AgentSelectionInput = Record<string, unknown>\nexport type WorkflowGraphInput = Record<string, unknown>\n\n/** The canonical `/api/v1/workflows` management operationIds. */\ninterface ManagementWorkflowsOperations {\n readonly list: OperationId\n readonly get: OperationId\n readonly create: OperationId\n readonly update: OperationId\n readonly deploy: OperationId\n readonly delete: OperationId\n readonly restore: OperationId\n readonly requestOwnershipTransfer: OperationId\n readonly cancelOwnershipTransfer: OperationId\n readonly acceptOwnershipTransfer: OperationId\n readonly toggle: OperationId\n}\n\nconst MANAGEMENT_WORKFLOW_OPERATIONS: ManagementWorkflowsOperations = {\n list: 'WorkflowsController_list',\n get: 'WorkflowsController_get',\n create: 'WorkflowsController_create',\n update: 'WorkflowsController_update',\n deploy: 'WorkflowsController_deploy',\n delete: 'WorkflowsController_delete',\n restore: 'WorkflowsController_restore',\n requestOwnershipTransfer: 'WorkflowsController_requestOwnershipTransfer',\n cancelOwnershipTransfer: 'WorkflowsController_cancelOwnershipTransfer',\n acceptOwnershipTransfer: 'WorkflowsController_acceptOwnershipTransfer',\n toggle: 'WorkflowsController_toggle',\n}\n\nfunction parseWorkflow(raw: unknown): Workflow {\n return raw as Workflow\n}\n\nexport interface CreateWorkflowOptions {\n name: string\n type: WorkflowType\n description?: string\n trigger?: TriggerInput\n agentSelection?: AgentSelectionInput\n workflowStructure?: WorkflowGraphInput\n}\n\n/** @deprecated Use `CreateWorkflowOptions` instead. */\nexport type CreateAgentOptions = CreateWorkflowOptions\n\nexport interface UpdateWorkflowOptions {\n name?: string\n type?: WorkflowType\n description?: string\n trigger?: TriggerInput\n agentSelection?: AgentSelectionInput\n workflowStructure?: WorkflowGraphInput\n updateMask?: string\n}\n\n/** @deprecated Use `UpdateWorkflowOptions` instead. */\nexport type UpdateAgentOptions = UpdateWorkflowOptions\n\nexport class ManagementWorkflowsResource extends WorkflowsResourceBase {\n protected readonly ops: ManagementWorkflowsOperations = MANAGEMENT_WORKFLOW_OPERATIONS\n\n /**\n * Retrieve a workflow with full configuration.\n *\n * @param workflowId - Numeric workflow id.\n * @param options.view - Variation view: `\"active\"` (deployed), `\"draft\"`, or `\"published\"` (published workflow you can use).\n * @returns The workflow.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const [first] = (await mgmt.workflows.list()).items\n * const wf = await mgmt.workflows.get(first.id)\n * console.log(wf.name, wf.status)\n * ```\n */\n async get(workflowId: number | string, options: { view?: VariationView } = {}): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const query = options.view !== undefined ? { view: options.view } : undefined\n const data = await invokeWithRetry(this.config, this.http, this.ops.get, {\n pathParams: { id: workflowId },\n query,\n })\n return parseWorkflow(data)\n }\n\n /**\n * Interfaces attached to a workflow.\n *\n * @param workflowId - Workflow id.\n * @returns An interfaces resource scoped to the workflow.\n */\n interfaces(workflowId: number | string): WorkflowInterfacesResource {\n return new WorkflowInterfacesResource(this.http, this.config, workflowId)\n }\n\n /**\n * Create a new workflow in the organization.\n *\n * @param options.name - Display name for the workflow.\n * @param options.type - `\"workflow\"`. `\"task\"` is a deprecated alias the server stores as `\"workflow\"`.\n * @param options.trigger - Optional trigger configuration.\n * @returns The created workflow (draft).\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const wf = await mgmt.workflows.create({ name: 'Daily report', type: 'workflow' })\n * ```\n */\n async create(options: CreateWorkflowOptions): Promise<Workflow> {\n const body = omitUndefined({\n name: options.name,\n type: options.type,\n description: options.description,\n trigger: options.trigger,\n agentSelection: options.agentSelection,\n workflowStructure: options.workflowStructure,\n })\n const data = await invokeWithRetry(this.config, this.http, this.ops.create, {\n jsonBody: body,\n })\n return parseWorkflow(data)\n }\n\n /**\n * Update a workflow's configuration.\n *\n * Only the fields you pass are changed. To clear a field, name it in\n * `updateMask` and leave its argument unset: it is sent as `null`.\n *\n * @param workflowId - Numeric workflow id.\n * @param options.type - Only `\"workflow\"` is accepted; `\"task\"` is rejected with a 422.\n * @param options.updateMask - Comma-separated field names to update or clear.\n * @returns The updated workflow.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const wf = await mgmt.workflows.update('PLACEHOLDER_WORKFLOW_ID', { description: 'Runs every morning' })\n * ```\n */\n async update(workflowId: number | string, options: UpdateWorkflowOptions = {}): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const fields = {\n name: options.name,\n type: options.type,\n description: options.description,\n trigger: options.trigger,\n agentSelection: options.agentSelection,\n workflowStructure: options.workflowStructure,\n }\n const body = updateBody(fields, options.updateMask)\n const data = await invokeWithRetry(this.config, this.http, this.ops.update, {\n pathParams: { id: workflowId },\n query: updateMaskQuery(options.updateMask),\n jsonBody: body,\n })\n return parseWorkflow(data)\n }\n\n /**\n * Publish the current draft of a workflow.\n *\n * @param workflowId - Workflow id.\n * @returns The published workflow.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * await mgmt.workflows.update('PLACEHOLDER_WORKFLOW_ID', { description: 'Runs every morning' })\n * const published = await mgmt.workflows.deploy('PLACEHOLDER_WORKFLOW_ID')\n * ```\n */\n async deploy(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.deploy, {\n pathParams: { id: workflowId },\n jsonBody: {},\n }),\n )\n return parseWorkflow(data.workflow)\n }\n\n /**\n * Enable or disable a workflow without deleting it.\n *\n * @param workflowId - Workflow id.\n * @param options.active - `true` to activate, `false` to deactivate.\n * @returns The updated workflow.\n */\n async toggle(workflowId: number | string, options: { active: boolean }): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, this.ops.toggle, {\n pathParams: { id: workflowId },\n jsonBody: { active: options.active },\n })\n return parseWorkflow(data)\n }\n\n /**\n * Start transferring ownership of a workflow to another organization member.\n *\n * @param workflowId - Workflow id.\n * @param options.newOwnerUserId - User id of the proposed new owner.\n * @returns The workflow with a pending ownership transfer.\n */\n async requestOwnershipTransfer(\n workflowId: number | string,\n options: { newOwnerUserId: string },\n ): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.requestOwnershipTransfer,\n {\n pathParams: { id: workflowId },\n jsonBody: omitUndefined({ newOwnerUserId: options.newOwnerUserId }),\n },\n )\n return parseWorkflow(data)\n }\n}\n","import type { components } from '../_generated/v1.js'\n\nexport type ContextItem = components['schemas']['ContextItemDto']\nexport type ContextItemAncestor = components['schemas']['ContextItemAncestorDto']\nexport type ContextItemLookupRow = components['schemas']['LookupContextItemRowDto']\nexport type ContextItemsQuery = components['schemas']['QueryContextItemsRequestDto']\nexport type ContextItemsQueryResult = components['schemas']['QueryContextItemsResponseDto']\nexport type ContextItemDeletion = components['schemas']['DeleteContextItemResponseDto']\nexport type ContextItemMove = components['schemas']['MoveContextItemResponseDto']\n/** Input for `updateAccess()`; all three settings replace the current ones. */\nexport type UpdateContextItemAccessInput = components['schemas']['UpdateContextItemAccessDto']\n/** Who can view and manage an item after `updateAccess()`. */\nexport type ContextItemAccessUpdate = components['schemas']['ContextItemAccessResponseDto']\n/** Create response; ``uid`` mirrors ``contextItemId`` for list/get parity. */\nexport type CreatedContextItem = components['schemas']['CreatedContextItemResponseDto'] & {\n uid: string\n}\nexport type ContextType = string\n\nexport function withCreatedUid(\n data: components['schemas']['CreatedContextItemResponseDto'],\n): CreatedContextItem {\n return { ...data, uid: data.contextItemId }\n}\n","import { ValidationError } from '../../_exceptions.js'\nimport type { ContextItem } from '../../types/context.js'\nimport type { ManagementContextItemsResource } from './items.js'\n\nexport type UserFeedback = 'positive' | 'neutral' | 'negative'\n\nfunction requireContentDict(item: ContextItem, contextType: string): Record<string, unknown> {\n if (item.contextType !== contextType) {\n throw new ValidationError(`Expected contextType ${contextType}, got ${item.contextType}.`)\n }\n if (!item.content || typeof item.content !== 'object' || Array.isArray(item.content)) {\n throw new ValidationError(`Context item ${item.uid} has no object content; cannot merge ${contextType} fields.`)\n }\n return item.content as Record<string, unknown>\n}\n\nexport function mergeNoteContent(\n existing: Record<string, unknown>,\n options: { title: string; body: string },\n): Record<string, unknown> {\n return { ...existing, title: options.title, content: options.body }\n}\n\nexport function mergeLinkContent(\n existing: Record<string, unknown>,\n options: { title?: string; url?: string },\n): Record<string, unknown> {\n const merged = { ...existing }\n if (options.title !== undefined) merged.title = options.title\n if (options.url !== undefined) merged.url = options.url\n return merged\n}\n\nexport function mergeSavedQueryContent(\n existing: Record<string, unknown>,\n options: {\n name: string\n query: string\n connectionId?: string\n path?: string[]\n },\n): Record<string, unknown> {\n const merged: Record<string, unknown> = { ...existing, name: options.name, query: options.query }\n if (options.connectionId !== undefined) merged.connectionId = options.connectionId\n if (options.path !== undefined) merged.path = options.path\n return merged\n}\n\nasync function resolveExistingContent(\n items: ManagementContextItemsResource,\n uid: string,\n contextType: string,\n existing?: ContextItem,\n): Promise<Record<string, unknown>> {\n const item = existing ?? (await items.get(uid))\n return requireContentDict(item, contextType)\n}\n\nexport async function updateWithMergedContent(\n items: ManagementContextItemsResource,\n uid: string,\n options: {\n contextType: string\n mergedContent: Record<string, unknown>\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n): Promise<ContextItem> {\n if (options.existing) requireContentDict(options.existing, options.contextType)\n return items.update(uid, {\n contextType: options.contextType,\n content: options.mergedContent,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\n}\n\nexport async function resolveAndUpdateNote(\n items: ManagementContextItemsResource,\n uid: string,\n options: {\n title: string\n body: string\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n): Promise<ContextItem> {\n const content = await resolveExistingContent(items, uid, 'note', options.existing)\n return updateWithMergedContent(items, uid, {\n contextType: 'note',\n mergedContent: mergeNoteContent(content, { title: options.title, body: options.body }),\n existing: options.existing,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\n}\n\nexport async function resolveAndUpdateSavedQuery(\n items: ManagementContextItemsResource,\n uid: string,\n options: {\n name: string\n query: string\n connectionId?: string\n path?: string[]\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n): Promise<ContextItem> {\n const content = await resolveExistingContent(items, uid, 'saved_query', options.existing)\n return updateWithMergedContent(items, uid, {\n contextType: 'saved_query',\n mergedContent: mergeSavedQueryContent(content, options),\n existing: options.existing,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\n}\n\nexport async function resolveAndUpdateLink(\n items: ManagementContextItemsResource,\n uid: string,\n options: {\n title?: string\n url?: string\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n): Promise<ContextItem> {\n if (\n options.title === undefined &&\n options.url === undefined &&\n options.description === undefined &&\n options.userFeedback === undefined &&\n options.topics === undefined\n ) {\n throw new ValidationError('Provide at least one field to update.')\n }\n if (options.title === undefined && options.url === undefined) {\n return items.update(uid, {\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\n }\n const content = await resolveExistingContent(items, uid, 'link', options.existing)\n return updateWithMergedContent(items, uid, {\n contextType: 'link',\n mergedContent: mergeLinkContent(content, { title: options.title, url: options.url }),\n existing: options.existing,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { asRecord, invokeWithRetry } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type {\n Dashboard,\n DashboardDraftSnapshot,\n DashboardVersion,\n} from '../../../../types/context-dashboards.js'\n\n/** Generated base for the management `context.dashboards` resource. */\nexport class ContextDashboardsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * Delete a dashboard.\n *\n * Removes the dashboard from every listing and deletes its alert workflows. It cannot be restored\n * through the API.\n *\n * **Requires:** `context:write`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * ```ts\n * await mgmt.context.dashboards.delete('DASHBOARD_ID')\n * ```\n */\n async delete(dashboardId: string): Promise<void> {\n validateId(dashboardId, 'dashboardId')\n await invokeWithRetry(this.config, this.http, 'DashboardsController_delete', {\n pathParams: { dashboardId },\n })\n }\n\n /**\n * List dashboard draft snapshots.\n *\n * Returns ids and timestamps of the most recent draft snapshots. Editors only.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * ```ts\n * const snapshots = await mgmt.context.dashboards.listDraftSnapshots('DASHBOARD_ID')\n * snapshots.map((snapshot) => snapshot.uid)\n * ```\n */\n async listDraftSnapshots(dashboardId: string): Promise<DashboardDraftSnapshot[]> {\n validateId(dashboardId, 'dashboardId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_listDraftSnapshots', {\n pathParams: { dashboardId },\n })\n return asRecord(data).snapshots as DashboardDraftSnapshot[]\n }\n\n /**\n * Cancel an ownership transfer.\n *\n * Owner only. Clears the pending transfer and returns the dashboard.\n *\n * **Requires:** `context:write`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * ```ts\n * await mgmt.context.dashboards.cancelOwnershipTransfer('DASHBOARD_ID')\n * ```\n */\n async cancelOwnershipTransfer(dashboardId: string): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_cancelOwnership', {\n pathParams: { dashboardId },\n })\n return asRecord(data) as unknown as Dashboard\n }\n\n /**\n * Accept an ownership transfer.\n *\n * Recipient only. Makes you the owner and clears the pending transfer.\n *\n * **Requires:** `context:write`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * ```ts\n * await mgmt.context.dashboards.acceptOwnershipTransfer('DASHBOARD_ID')\n * ```\n */\n async acceptOwnershipTransfer(dashboardId: string): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_acceptOwnership', {\n pathParams: { dashboardId },\n })\n return asRecord(data) as unknown as Dashboard\n }\n\n /**\n * List dashboard versions.\n *\n * Returns the published versions, newest first, each with its full definition. Draft snapshots\n * are not included. The response is not paginated and can be large.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * ```ts\n * const versions = await mgmt.context.dashboards.listVersions('DASHBOARD_ID')\n * versions.map((version) => [version.uid, version.versionNumber])\n * ```\n */\n async listVersions(dashboardId: string): Promise<DashboardVersion[]> {\n validateId(dashboardId, 'dashboardId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_listVersions', {\n pathParams: { dashboardId },\n })\n return asRecord(data).versions as DashboardVersion[]\n }\n\n /**\n * Get a dashboard version.\n *\n * Returns the dashboard as it was in the given version. For a draft snapshot (editors only) the\n * view is reported as active and selectedVersion.versionNumber is null.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n * @param versionId - Version id, or a draft snapshot id for editors.\n *\n * @example\n * ```ts\n * const old = await mgmt.context.dashboards.getVersion('DASHBOARD_ID', 'VERSION_ID')\n * old.selectedVersion.versionNumber\n * ```\n */\n async getVersion(\n dashboardId: string,\n versionId: string,\n ): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n validateId(versionId, 'versionId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_getVersion', {\n pathParams: { dashboardId, versionId },\n })\n return asRecord(data) as unknown as Dashboard\n }\n\n /**\n * Restore a dashboard version.\n *\n * Replaces the current draft with the content of the given version. The outgoing draft is kept as\n * a draft snapshot. Returns the draft view.\n *\n * **Requires:** `context:write`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n * @param versionId - Version id, or a draft snapshot id for editors.\n *\n * @example\n * ```ts\n * await mgmt.context.dashboards.restoreVersion('DASHBOARD_ID', 'VERSION_ID')\n * ```\n */\n async restoreVersion(\n dashboardId: string,\n versionId: string,\n ): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n validateId(versionId, 'versionId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_restore', {\n pathParams: { dashboardId, versionId },\n })\n return asRecord(data) as unknown as Dashboard\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../../_config.js'\nimport type { HttpClient } from '../../../../../_http.js'\nimport { asRecord, invokeWithRetry } from '../../../../../_request.js'\nimport { validateId } from '../../../../../_validation.js'\nimport type {\n DashboardElementResult,\n DashboardElementsList,\n} from '../../../../../types/context-dashboards.js'\n\n/** Generated base for the management `context.dashboards.elements` resource. */\nexport class ContextDashboardsElementsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly dashboardId: number | string,\n ) {}\n\n /**\n * List dashboard elements.\n *\n * Lists every tile and filter on the dashboard draft with id, kind, title and layout. Filters\n * also carry sqlReferences, the exact templates tile SQL must use to reference them. Returns the\n * current draftRevision.\n *\n * **Requires:** `context:read`\n *\n * @example\n * ```ts\n * const listed = await mgmt.context.dashboards.elements('DASHBOARD_ID').list()\n * listed.elements.map((element) => element.id)\n * ```\n */\n async list(): Promise<DashboardElementsList> {\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_listElements', {\n pathParams: { dashboardId: this.dashboardId },\n })\n return asRecord(data) as unknown as DashboardElementsList\n }\n\n /**\n * Get a dashboard element.\n *\n * Returns the full draft configuration of one dashboard element, including SQL, chart settings\n * and filter options, with the current draftRevision.\n *\n * **Requires:** `context:read`\n *\n * @param elementId - The dashboard element id to read.\n *\n * @example\n * ```ts\n * const result = await mgmt.context.dashboards.elements('DASHBOARD_ID').get('ELEMENT_ID')\n * result.element.title\n * ```\n */\n async get(elementId: string): Promise<DashboardElementResult> {\n validateId(elementId, 'elementId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_getElement', {\n pathParams: { dashboardId: this.dashboardId, elementId },\n })\n return asRecord(data) as unknown as DashboardElementResult\n }\n}\n","import type { ModusConfig } from '../../_config.js'\nimport { ContextDashboardsResourceBase } from '../../_generated/resources/management/context/dashboards.js'\nimport { ContextDashboardsElementsResourceBase } from '../../_generated/resources/management/context/dashboards/elements.js'\nimport type { HttpClient } from '../../_http.js'\nimport { asRecord, invokeWithRetry } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type {\n CreateDashboardElementInput,\n CreateDashboardInput,\n Dashboard,\n DashboardElementResult,\n DashboardPublishResult,\n DashboardView,\n PublishDashboardInput,\n TransferDashboardOwnershipInput,\n UpdateDashboardAccessInput,\n UpdateDashboardDraftInput,\n UpdateDashboardElementInput,\n UpdateDashboardLayoutInput,\n} from '../../types/context-dashboards.js'\n\n/**\n * Tiles and filters on one dashboard draft.\n *\n * Call path: `mgmt.context.dashboards.elements(dashboardId)`.\n *\n * Every change takes the `draftRevision` it is based on as `expectedRevision`;\n * a stale value is rejected with a `ConflictError`.\n */\nexport class ManagementDashboardElementsResource extends ContextDashboardsElementsResourceBase {\n /** @internal */\n constructor(\n http: HttpClient,\n config: ModusConfig,\n dashboardId: string,\n ) {\n super(http, config, dashboardId)\n }\n\n /**\n * Add a blank tile or filter to the dashboard draft.\n *\n * Modus assigns the new element's id; configure it afterwards with `update()`.\n *\n * @param input.expectedRevision - The `draftRevision` your change is based on.\n * @param input.kind - `chart`, `kpi`, `table`, `markdown` or `filter`.\n * @param input.title - Title shown on the element.\n * @param input.layout - Grid position with `x` (0-11), `y`, `w` (1-12) and `h`.\n * @returns The created element and the new `draftRevision`.\n * @throws ConflictError - The draft changed since `expectedRevision`; list the\n * elements again and retry with the new revision.\n * @example\n * ```ts\n * const created = await mgmt.context.dashboards.elements('DASHBOARD_ID').create({\n * expectedRevision: 3,\n * kind: 'chart',\n * title: 'Sales by region',\n * layout: { x: 0, y: 4, w: 6, h: 4 },\n * })\n * ```\n */\n async create(input: CreateDashboardElementInput): Promise<DashboardElementResult> {\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_createElement', {\n pathParams: { dashboardId: this.dashboardId },\n jsonBody: {\n expectedRevision: input.expectedRevision,\n kind: input.kind,\n title: input.title,\n layout: input.layout,\n },\n }),\n ) as unknown as DashboardElementResult\n }\n\n /**\n * Change settings of one tile or filter on the dashboard draft.\n *\n * @param elementId - Id of the tile or filter to change.\n * @param input.expectedRevision - The `draftRevision` your change is based on.\n * @param input.patch - The settings to change, for example `{ title: 'Sales' }`\n * or `{ defaultValue: null }`. `null` clears a setting that supports clearing.\n * @returns The whole dashboard after the change, including the new `draftRevision`.\n * @throws ConflictError - The draft changed since `expectedRevision`.\n * @throws NotFoundError - The dashboard or the element does not exist, or you cannot\n * edit the dashboard.\n * @example\n * ```ts\n * const dashboard = await mgmt.context.dashboards\n * .elements('DASHBOARD_ID')\n * .update('ELEMENT_ID', { expectedRevision: 3, patch: { title: 'Revenue' } })\n * ```\n */\n async update(elementId: string, input: UpdateDashboardElementInput): Promise<Dashboard> {\n validateId(elementId, 'elementId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_updateElement', {\n pathParams: { dashboardId: this.dashboardId, elementId },\n jsonBody: { expectedRevision: input.expectedRevision, patch: input.patch },\n }),\n ) as unknown as Dashboard\n }\n}\n\n/**\n * Dashboards in the Modus knowledge base.\n *\n * Call path: `mgmt.context.dashboards` after `new ModusManagement(...)`.\n *\n * - `list()`, `get()`, `create()`, `updateDraft()`, `publish()`, `delete()` — dashboards.\n * - `listVersions()`, `getVersion()`, `restoreVersion()`, `listDraftSnapshots()` — history.\n * - `updateAccess()` — who can open and edit a dashboard.\n * - `requestOwnershipTransfer()`, `acceptOwnershipTransfer()`, `cancelOwnershipTransfer()`.\n * - `elements(dashboardId)` — list, get, create and update tiles and filters.\n * - `updateLayout(dashboardId, input)` — move or resize several elements at once.\n */\nexport class ManagementDashboardsResource extends ContextDashboardsResourceBase {\n /** @internal */\n constructor(\n http: HttpClient,\n config: ModusConfig,\n ) {\n super(http, config)\n }\n\n /**\n * List dashboards with their full definitions.\n *\n * @param options.view - `active` (default) lists published dashboards you can open;\n * `draft` lists the drafts of dashboards you can edit.\n * @returns Every matching dashboard. The list is not paginated.\n * @example\n * ```ts\n * const drafts = await mgmt.context.dashboards.list({ view: 'draft' })\n * drafts.map((dashboard) => [dashboard.id, dashboard.draftRevision])\n * ```\n */\n async list(options: { view?: DashboardView } = {}): Promise<Dashboard[]> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_list', {\n query: { view: options.view },\n }),\n )\n return data.dashboards as Dashboard[]\n }\n\n /**\n * Get one dashboard with its full definition.\n *\n * @param dashboardId - Id of the dashboard.\n * @param options.view - `active` (default) returns the published version; `draft`\n * returns the working draft and requires edit access.\n * @returns The dashboard, including `draftRevision` for the next change.\n * @throws NotFoundError - The dashboard does not exist or you cannot open it.\n * @example\n * ```ts\n * const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })\n * draft.draftRevision\n * ```\n */\n async get(dashboardId: string, options: { view?: DashboardView } = {}): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_get', {\n pathParams: { dashboardId },\n query: { view: options.view },\n }),\n ) as unknown as Dashboard\n }\n\n /**\n * Create a dashboard draft.\n *\n * The new dashboard is not visible to others until you `publish()` it.\n *\n * @param input.title - Dashboard title.\n * @param input.definition - Tiles, filters and layout, for example\n * `{ tiles: [], filters: [] }`. Element ids must be unique.\n * @param input.description - Optional dashboard description.\n * @param input.access - Optional `visibility`, `groupPermissions` and `sharedWith`.\n * Defaults to private.\n * @returns The created dashboard in its draft view.\n * @throws ModusError - The definition or access settings are invalid.\n * @example\n * ```ts\n * const dashboard = await mgmt.context.dashboards.create({\n * title: 'Revenue',\n * definition: { tiles: [], filters: [] },\n * })\n * dashboard.id\n * ```\n */\n async create(input: CreateDashboardInput): Promise<Dashboard> {\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_create', {\n jsonBody: {\n title: input.title,\n description: input.description,\n definition: input.definition,\n access: input.access,\n },\n }),\n ) as unknown as Dashboard\n }\n\n /**\n * Replace the whole draft definition, and optionally the title and description.\n *\n * @param dashboardId - Id of the dashboard.\n * @param input.expectedRevision - The `draftRevision` your change is based on.\n * @param input.definition - The complete new definition. Tiles and filters left\n * out are removed.\n * @param input.title - New title; unchanged when omitted.\n * @param input.description - New description; unchanged when omitted.\n * @returns The dashboard draft after the change, including the new `draftRevision`.\n * @throws ConflictError - The draft changed since `expectedRevision`; get the draft\n * again and retry with the new revision.\n * @throws NotFoundError - The dashboard does not exist or you cannot edit it.\n * @example\n * ```ts\n * const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })\n * await mgmt.context.dashboards.updateDraft('DASHBOARD_ID', {\n * expectedRevision: draft.draftRevision,\n * definition: draft.definition,\n * title: 'Revenue',\n * })\n * ```\n */\n async updateDraft(dashboardId: string, input: UpdateDashboardDraftInput): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_updateDraft', {\n pathParams: { dashboardId },\n jsonBody: {\n expectedRevision: input.expectedRevision,\n title: input.title,\n description: input.description,\n definition: input.definition,\n },\n }),\n ) as unknown as Dashboard\n }\n\n /**\n * Publish the draft as a new version that everyone with access sees.\n *\n * Alert workflows defined on the dashboard are updated to match.\n *\n * @param dashboardId - Id of the dashboard.\n * @param input.expectedRevision - The `draftRevision` you reviewed and want to publish.\n * @returns The published `dashboard` and the new `version`.\n * @throws ConflictError - The draft changed since `expectedRevision`.\n * @throws NotFoundError - The dashboard does not exist or you cannot edit it.\n * @example\n * ```ts\n * const result = await mgmt.context.dashboards.publish('DASHBOARD_ID', { expectedRevision: 4 })\n * result.version.versionNumber\n * ```\n */\n async publish(dashboardId: string, input: PublishDashboardInput): Promise<DashboardPublishResult> {\n validateId(dashboardId, 'dashboardId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_publish', {\n pathParams: { dashboardId },\n jsonBody: { expectedRevision: input.expectedRevision },\n }),\n ) as unknown as DashboardPublishResult\n }\n\n /**\n * Replace who can open and edit a dashboard.\n *\n * All three settings are required and replace the current ones.\n *\n * @param dashboardId - Id of the dashboard.\n * @param input.visibility - `shared` (the owner plus the groups in\n * `groupPermissions`) or `private` (the owner plus the users in `sharedWith`).\n * @param input.groupPermissions - Group id to `{ use, manage }`. Used only when shared.\n * @param input.sharedWith - Users such as `{ email: 'ana@example.com', permission: 'use' }`.\n * Used only when private.\n * @returns The dashboard with its new access settings.\n * @throws NotFoundError - The dashboard does not exist or you cannot edit it.\n * @throws ModusError - A group, user or permission is invalid.\n * @example\n * ```ts\n * await mgmt.context.dashboards.updateAccess('DASHBOARD_ID', {\n * visibility: 'private',\n * groupPermissions: {},\n * sharedWith: [{ email: 'ana@example.com', permission: 'use' }],\n * })\n * ```\n */\n async updateAccess(dashboardId: string, input: UpdateDashboardAccessInput): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_updateAccess', {\n pathParams: { dashboardId },\n jsonBody: {\n visibility: input.visibility,\n groupPermissions: input.groupPermissions,\n sharedWith: input.sharedWith,\n },\n }),\n ) as unknown as Dashboard\n }\n\n /**\n * Ask another member of your organization to take ownership of a dashboard.\n *\n * Only the owner can request a transfer. Ownership moves when the recipient\n * calls `acceptOwnershipTransfer()`.\n *\n * @param dashboardId - Id of the dashboard.\n * @param input.newOwnerUserId - User id of the member who should become the owner.\n * @returns The dashboard with `pendingOwnershipTransfer` set.\n * @throws PermissionDeniedError - You are not the owner.\n * @throws NotFoundError - The dashboard does not exist or you cannot open it.\n * @example\n * ```ts\n * await mgmt.context.dashboards.requestOwnershipTransfer('DASHBOARD_ID', {\n * newOwnerUserId: 'USER_ID',\n * })\n * ```\n */\n async requestOwnershipTransfer(\n dashboardId: string,\n input: TransferDashboardOwnershipInput,\n ): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n validateId(input.newOwnerUserId, 'newOwnerUserId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_transferOwnership', {\n pathParams: { dashboardId },\n jsonBody: { newOwnerUserId: input.newOwnerUserId },\n }),\n ) as unknown as Dashboard\n }\n\n /**\n * Work with the tiles and filters of one dashboard draft.\n *\n * @param dashboardId - Id of the dashboard.\n * @returns A resource bound to that dashboard.\n * @example\n * ```ts\n * await mgmt.context.dashboards.elements('DASHBOARD_ID').list()\n * ```\n */\n elements(dashboardId: string): ManagementDashboardElementsResource {\n validateId(dashboardId, 'dashboardId')\n return new ManagementDashboardElementsResource(this.http, this.config, dashboardId)\n }\n\n /**\n * Move or resize several tiles and filters in one change.\n *\n * @param dashboardId - Id of the dashboard.\n * @param input.expectedRevision - The `draftRevision` your change is based on.\n * @param input.elements - Every element to place, each with `elementId` and its\n * final `layout`.\n * @returns The whole dashboard after the change, including the new `draftRevision`.\n * @throws ConflictError - The draft changed since `expectedRevision`.\n * @example\n * ```ts\n * await mgmt.context.dashboards.updateLayout('DASHBOARD_ID', {\n * expectedRevision: 3,\n * elements: [{ elementId: 'ELEMENT_ID', layout: { x: 0, y: 0, w: 12, h: 2 } }],\n * })\n * ```\n */\n async updateLayout(dashboardId: string, input: UpdateDashboardLayoutInput): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_updateLayout', {\n pathParams: { dashboardId },\n jsonBody: { expectedRevision: input.expectedRevision, elements: input.elements },\n }),\n ) as unknown as Dashboard\n }\n}\n","import { readdir, readFile, stat } from 'node:fs/promises'\nimport { dirname, join, relative } from 'node:path'\nimport type { ModusConfig } from '../../_config.js'\nimport { ModusError, ValidationError } from '../../_exceptions.js'\nimport { ContextFilesResourceBase } from '../../_generated/resources/management/context/files.js'\nimport type { HttpClient } from '../../_http.js'\nimport { asRecord, invokeWithRetry } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type {\n BulkFinalizeResult,\n BulkUploadFromUrlsResult,\n BulkUploadUrlsResult,\n FileUpload,\n FinalizeInput,\n UploadDirFailure,\n UploadDirResult,\n UploadFileInput,\n UploadFromUrlInput,\n UploadProgressCallback,\n UploadUrlInput,\n UploadUrlSlot,\n WaitUntil,\n} from '../../types/context-files.js'\n\n/** Bulk `createUploadUrls` / `uploadFromUrls` request cap — matches the backend. */\nexport const MAX_BULK_UPLOAD_FILES = 100\n\nconst DEFAULT_PUT_TIMEOUT_MS = 60_000\nconst DEFAULT_POLL_INTERVAL_MS = 500\nconst DEFAULT_UPLOAD_TIMEOUT_MS = 120_000\nconst DEFAULT_CONCURRENCY = 10\n// `pending` is gone from the public enum: an upload has no resource until it\n// is finalized. Kept at rank 0 so an older server still reporting it is\n// ordered below `processing` rather than treated as unknown.\nconst STATUS_ORDER: Record<string, number> = { pending: 0, processing: 1, ready: 2 }\nconst WAIT_UNTIL_VALUES = new Set<WaitUntil>(['processing', 'ready'])\n\n/**\n * The server owns the extension→MIME table (`EXTENSION_MIME_MAP` in\n * `@modus/file-uploads`) and resolves it whenever a client sends\n * `application/octet-stream`. Sending that instead of guessing locally keeps\n * one source of truth: a client-side table inevitably drifts from the server's\n * allow-list, and a guess the server rejects fails the upload for no reason.\n */\nconst DEFER_CONTENT_TYPE_TO_SERVER = 'application/octet-stream'\n\n/** A missing path (or one under a regular file, ENOTDIR) is bad caller input, so it throws ValidationError like a wrong file type does. */\nasync function statInput(path: string) {\n try {\n return await stat(path)\n } catch (error) {\n const code = (error as { code?: unknown }).code\n if (code === 'ENOENT' || code === 'ENOTDIR') throw new ValidationError(`No such file or directory: ${path}`)\n throw error\n }\n}\n\nfunction validateWaitUntil(waitUntil: string): asserts waitUntil is WaitUntil {\n if (!WAIT_UNTIL_VALUES.has(waitUntil as WaitUntil)) {\n throw new ValidationError(`waitUntil must be one of ${[...WAIT_UNTIL_VALUES].join(', ')}, got ${waitUntil}`)\n }\n}\n\nfunction validateBulkSize(count: number, name: string): void {\n if (count === 0) throw new ValidationError(`${name} must not be empty`)\n if (count > MAX_BULK_UPLOAD_FILES) {\n throw new ValidationError(`${name} must have at most ${MAX_BULK_UPLOAD_FILES} entries, got ${count}`)\n }\n}\n\nfunction statusSatisfies(status: string, waitUntil: WaitUntil): boolean {\n if (status === 'failed') return true\n return (STATUS_ORDER[status] ?? 0) >= STATUS_ORDER[waitUntil]\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\nfunction chunked<T>(items: readonly T[], size: number): T[][] {\n const out: T[][] = []\n for (let i = 0; i < items.length; i += size) out.push(items.slice(i, i + size))\n return out\n}\n\n/** Join an optional destination prefix onto a walk-relative folder label. Empty prefix is a no-op. */\nfunction joinDestination(prefix: string | undefined, relative: string | undefined): string | undefined {\n const head = prefix === undefined || prefix.length === 0 ? undefined : prefix\n const tail =\n relative === undefined || relative.length === 0\n ? undefined\n : relative\n if (head !== undefined && tail !== undefined) return `${head}/${tail}`\n return head ?? tail\n}\n\nexport type BatchUploadOptions = {\n concurrency?: number\n waitUntil?: WaitUntil\n onProgress?: UploadProgressCallback\n folderPath?: string\n}\n\n/** Bounded-concurrency map, preserving input order — the async twin of a thread pool. */\nasync function mapWithConcurrency<T, R>(\n items: readonly T[],\n concurrency: number,\n worker: (item: T) => Promise<R>,\n onItemDone?: (result: R) => void,\n): Promise<R[]> {\n const results: R[] = new Array(items.length)\n let cursor = 0\n async function run(): Promise<void> {\n for (;;) {\n const index = cursor++\n if (index >= items.length) return\n const result = await worker(items[index] as T)\n results[index] = result\n onItemDone?.(result)\n }\n }\n await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, run))\n return results\n}\n\nasync function walkFiles(root: string, recursive: boolean): Promise<string[]> {\n const out: string[] = []\n async function walk(dir: string): Promise<void> {\n const entries = await readdir(dir, { withFileTypes: true })\n entries.sort((a, b) => a.name.localeCompare(b.name))\n for (const entry of entries) {\n if (entry.name.startsWith('.') || entry.isSymbolicLink()) continue\n const full = join(dir, entry.name)\n if (entry.isDirectory()) {\n if (recursive) await walk(full)\n } else if (entry.isFile()) {\n out.push(full)\n }\n }\n }\n await walk(root)\n return out\n}\n\n// Servers released before `headers` existed omit it; their PUT needs only Content-Type.\ntype PutSlot = Pick<UploadUrlSlot, 'uploadUrl' | 'contentType'> & { headers?: Record<string, string> }\n\nasync function putBytes(fetchImpl: typeof fetch, slot: PutSlot, data: Uint8Array, timeoutMs: number): Promise<void> {\n const response = await fetchImpl(slot.uploadUrl, {\n method: 'PUT',\n body: data,\n headers: { 'Content-Type': slot.contentType, ...slot.headers },\n signal: AbortSignal.timeout(timeoutMs),\n })\n if (!response.ok) {\n const text = await response.text().catch(() => '')\n throw new ModusError(`Upload PUT to presigned URL failed with HTTP ${response.status}.`, {\n statusCode: response.status,\n body: text ? text.slice(0, 500) : undefined,\n })\n }\n}\n\nfunction createSlotsPayload(files: readonly UploadUrlInput[]): Record<string, unknown> {\n return {\n files: files.map((f) => ({ fileName: f.fileName, contentType: f.contentType, fileSize: f.fileSize })),\n }\n}\n\nfunction uploadFromUrlsPayload(urls: readonly UploadFromUrlInput[]): Record<string, unknown> {\n return {\n urls: urls.map((u) => ({\n url: u.url,\n ...(u.fileName !== undefined ? { fileName: u.fileName } : {}),\n ...(u.folderPath !== undefined ? { folderPath: u.folderPath } : {}),\n })),\n }\n}\n\ntype UploadPath = UploadFileInput\ntype SlotAssignment = UploadPath & { slot: UploadUrlSlot }\n\nfunction assignSlots(\n batch: readonly UploadPath[],\n result: BulkUploadUrlsResult,\n failed: UploadDirFailure[],\n): SlotAssignment[] {\n const failedIndices = new Set(result.failed.map((f) => f.index))\n for (const f of result.failed) {\n failed.push({ path: batch[f.index]?.path ?? '', error: f.error })\n }\n const remaining = batch.filter((_, i) => !failedIndices.has(i))\n const uploaded = result.uploaded\n if (uploaded.length < remaining.length) {\n for (const file of remaining.slice(uploaded.length)) {\n failed.push({ path: file.path, error: 'Server returned fewer upload slots than requested files.' })\n }\n }\n const paired = Math.min(remaining.length, uploaded.length)\n const assignments: SlotAssignment[] = []\n for (let i = 0; i < paired; i++) {\n assignments.push({ ...(remaining[i] as UploadPath), slot: uploaded[i] as UploadUrlSlot })\n }\n return assignments\n}\n\n/**\n * Durable file uploads for `ModusManagement`.\n *\n * Call path: `mgmt.context.files` after `new ModusManagement(...)`.\n *\n * - `upload(path)` / `uploadDir(dirPath)` — presign + PUT + poll convenience helpers.\n * - `createUploadUrl(s)`, `uploadFromUrl(s)`, `get`, `list` — raw operations.\n * Hierarchy browsing is available through `mgmt.context.items.list`.\n */\nexport class ManagementContextFilesResource extends ContextFilesResourceBase {\n /** @internal */\n constructor(\n http: HttpClient,\n config: ModusConfig,\n ) {\n super(http, config)\n }\n\n /**\n * Get a presigned S3 PUT URL for one file.\n *\n * @param input.fileName - Original file name — used to build the S3 object key.\n * @param input.contentType - MIME type. Allowed categories: PDF, images, text,\n * Office/OpenDocument documents, audio, and video.\n * @param input.fileSize - File size in bytes. Rejected above 50MB.\n * @returns Presigned upload slot. PUT the raw bytes to `uploadUrl` within 15\n * minutes, sending `headers` unchanged, then call `finalize(slot.uploadId, slot.fileName)`. Pass the\n * slot's own `fileName` rather than your local basename — the server may\n * sanitize the requested name when it mints the key, and finalization\n * re-derives the key from `uploadId` and `fileName`.\n */\n async createUploadUrl(input: UploadUrlInput): Promise<UploadUrlSlot> {\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_uploadUrl', {\n jsonBody: { fileName: input.fileName, contentType: input.contentType, fileSize: input.fileSize },\n }),\n ) as unknown as UploadUrlSlot\n }\n\n /**\n * Get presigned S3 PUT URLs for up to 100 files in one call.\n *\n * @param files - Files to create upload slots for (max 100).\n * @returns Slots for every file that passed validation, plus per-index\n * failures (bad MIME type, oversize) for the rest — never a partial 4xx.\n */\n async createUploadUrls(files: readonly UploadUrlInput[]): Promise<BulkUploadUrlsResult> {\n validateBulkSize(files.length, 'files')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_uploadUrls', {\n jsonBody: createSlotsPayload(files),\n }),\n ) as unknown as BulkUploadUrlsResult\n }\n\n /**\n * Fetch one file from a URL and land it as durable context.\n *\n * @param url - Source URL to fetch (SSRF-guarded, 50MB cap, same MIME\n * allow-list as `createUploadUrl`).\n * @param options.fileName - Override file name. Inferred from the URL path when omitted.\n * @param options.folderPath - Root-relative folder to upload under.\n * @returns File upload resource with status `processing` — parsing continues async.\n */\n async uploadFromUrl(url: string, options: { fileName?: string; folderPath?: string } = {}): Promise<FileUpload> {\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_uploadFromUrl', {\n jsonBody: {\n url,\n ...(options.fileName !== undefined ? { fileName: options.fileName } : {}),\n ...(options.folderPath !== undefined ? { folderPath: options.folderPath } : {}),\n },\n }),\n ) as unknown as FileUpload\n }\n\n /**\n * Fetch up to 100 files from URLs in one call.\n *\n * @param urls - URLs to fetch and upload (max 100).\n * @returns File upload resources for every URL that landed, plus per-index\n * failures for the rest — never a partial 4xx.\n */\n async uploadFromUrls(urls: readonly UploadFromUrlInput[]): Promise<BulkUploadFromUrlsResult> {\n validateBulkSize(urls.length, 'urls')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_uploadFromUrls', {\n jsonBody: uploadFromUrlsPayload(urls),\n }),\n ) as unknown as BulkUploadFromUrlsResult\n }\n\n /**\n * Turn a file already PUT to a presigned URL into durable context.\n *\n * Call this once the PUT completes. The server locates the object from\n * `uploadId` + `fileName` and validates the bytes that actually arrived.\n * Safe to retry — a second call returns the same resource.\n *\n * @param uploadId - Upload id returned by `createUploadUrl`.\n * @param fileName - File name returned alongside it.\n * @returns The file upload resource, status `\"processing\"`.\n */\n async finalize(uploadId: string, fileName: string, options: { folderPath?: string } = {}): Promise<FileUpload> {\n validateId(uploadId, 'uploadId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_finalize', {\n pathParams: { uploadId },\n jsonBody: { fileName, ...(options.folderPath !== undefined ? { folderPath: options.folderPath } : {}) },\n }),\n ) as unknown as FileUpload\n }\n\n /**\n * Finalize up to 100 uploads in one call.\n *\n * What makes directory upload cheap: 2000 files cost 20 requests here rather\n * than 2000.\n *\n * @param uploads - Uploads to finalize (max 100).\n * @returns Resources for every upload that finalized, plus per-index\n * failures for the rest — never a partial 4xx.\n */\n async finalizeMany(uploads: readonly FinalizeInput[]): Promise<BulkFinalizeResult> {\n validateBulkSize(uploads.length, 'uploads')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_finalizeMany', {\n jsonBody: {\n uploads: uploads.map((u) => ({\n uploadId: u.uploadId,\n fileName: u.fileName,\n ...(u.folderPath !== undefined ? { folderPath: u.folderPath } : {}),\n })),\n },\n }),\n ) as unknown as BulkFinalizeResult\n }\n\n /**\n * Upload an explicit list of local files.\n *\n * Same machinery as `uploadDir`, without the directory walk — use it when\n * the caller already knows which files to send.\n *\n * @param paths - Paths to local files.\n * @param options.concurrency - Max concurrent PUTs (default 10).\n * @param options.waitUntil - `\"processing\"` (default) or `\"ready\"`.\n * @param options.onProgress - Optional progress callback after each file.\n * @param options.folderPath - Root-relative folder to upload under. Nested\n * files keep their existing relative folder labels under this prefix.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const result = await mgmt.context.files.uploadFiles(\n * ['./q3.pdf', './notes.md'],\n * { folderPath: 'reports/2026' },\n * )\n * ```\n */\n async uploadFiles(\n paths: readonly (string | UploadFileInput)[],\n options: BatchUploadOptions = {},\n ): Promise<UploadDirResult> {\n return this.uploadPaths(paths.map((input) => typeof input === 'string' ? { path: input } : input), options)\n }\n\n /**\n * Upload a local file and wait for it to reach `\"processing\"` or `\"ready\"`.\n *\n * Gets a presigned URL, PUTs the file bytes, then polls `get()`\n * until the upload leaves `\"pending\"` (or reaches `\"ready\"`/`\"failed\"`).\n *\n * @param path - Path to a local file.\n * @param options.waitUntil - `\"processing\"` (parsing started, default) or\n * `\"ready\"` (parsing finished).\n * @param options.pollIntervalMs - Milliseconds between status polls.\n * @param options.timeoutMs - Max milliseconds to wait before raising.\n * @param options.folderPath - Root-relative folder to upload under. Example:\n * `{ folderPath: 'reports/2026' }` places `./report.pdf` at `reports/2026`.\n * @returns The file upload resource once it reaches `waitUntil` (or `\"failed\"`).\n * @throws {ModusError} If the PUT fails, or polling times out.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const file = await mgmt.context.files.upload('./report.pdf', { folderPath: 'reports/2026' })\n * ```\n */\n async upload(\n path: string,\n options: {\n waitUntil?: WaitUntil\n pollIntervalMs?: number\n timeoutMs?: number\n folderPath?: string\n } = {},\n ): Promise<FileUpload> {\n const waitUntil = options.waitUntil ?? 'processing'\n validateWaitUntil(waitUntil)\n const fileStat = await statInput(path)\n if (!fileStat.isFile()) throw new ValidationError(`Not a file: ${path}`)\n const fileName = path.split(/[/\\\\]/).pop() as string\n const slot = await this.createUploadUrl({\n fileName,\n contentType: DEFER_CONTENT_TYPE_TO_SERVER,\n fileSize: fileStat.size,\n })\n const data = await readFile(path)\n await putBytes(this.config.fetch, slot, data, DEFAULT_PUT_TIMEOUT_MS)\n // Finalize returns the resource already at `processing`, so it replaces the\n // first poll rather than adding a round trip. Only `waitUntil: 'ready'`\n // needs to keep polling afterwards.\n const finalized = await this.finalize(slot.uploadId, slot.fileName, {\n ...(options.folderPath !== undefined ? { folderPath: options.folderPath } : {}),\n })\n if (statusSatisfies(finalized.status, waitUntil)) return finalized\n return this.pollUntil(\n slot.uploadId,\n waitUntil,\n options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS,\n options.timeoutMs ?? DEFAULT_UPLOAD_TIMEOUT_MS,\n )\n }\n\n private async pollUntil(\n uploadId: string,\n waitUntil: WaitUntil,\n pollIntervalMs: number,\n timeoutMs: number,\n ): Promise<FileUpload> {\n const deadline = Date.now() + timeoutMs\n for (;;) {\n const item = await this.get(uploadId)\n if (statusSatisfies(item.status, waitUntil)) return item\n if (Date.now() >= deadline) {\n throw new ModusError(\n `Timed out after ${timeoutMs}ms waiting for upload ${JSON.stringify(uploadId)} to reach ` +\n `status ${JSON.stringify(waitUntil)}; last status was ${JSON.stringify(item.status)}.`,\n )\n }\n await sleep(pollIntervalMs)\n }\n }\n\n /**\n * Upload every file in a local directory.\n *\n * Walks `path` (skipping hidden files/directories and symlinks), pages\n * through `createUploadUrls()` in batches of up to 100, then PUTs and polls\n * each file with up to `concurrency` in flight at once. A failure on one\n * file does not stop the others — check `result.failed`.\n *\n * @param path - Path to a local directory.\n * @param options.recursive - Recurse into subdirectories (default `true`).\n * @param options.concurrency - Max concurrent PUT+poll operations (default 10).\n * @param options.waitUntil - `\"processing\"` (default) or `\"ready\"` — same as `upload()`.\n * @param options.onProgress - Optional progress callback after each file.\n * @param options.folderPath - Root-relative folder to upload under. Nested\n * files keep their path relative to `path` under this prefix. Example:\n * `uploadDir('./docs', { folderPath: 'reports' })` places `./docs/a.txt` at\n * `reports` and `./docs/nested/b.txt` at `reports/nested`.\n * @returns `UploadDirResult` with every successful `FileUpload` and every\n * per-file failure (slot creation or PUT/poll), each tagged with its local path.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const result = await mgmt.context.files.uploadDir('./docs', { folderPath: 'reports' })\n * ```\n */\n async uploadDir(\n path: string,\n options: {\n recursive?: boolean\n concurrency?: number\n waitUntil?: WaitUntil\n onProgress?: UploadProgressCallback\n folderPath?: string\n } = {},\n ): Promise<UploadDirResult> {\n const waitUntil = options.waitUntil ?? 'processing'\n validateWaitUntil(waitUntil)\n const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY\n if (concurrency < 1) throw new ValidationError(`concurrency must be >= 1, got ${concurrency}`)\n const dirStat = await statInput(path)\n if (!dirStat.isDirectory()) throw new ValidationError(`Not a directory: ${path}`)\n\n const files = await walkFiles(path, options.recursive ?? true)\n return this.uploadPaths(files.map((file) => {\n const folderPath = relative(path, dirname(file)).replace(/\\\\/g, '/')\n return { path: file, ...(folderPath.length > 0 ? { folderPath } : {}) }\n }), options)\n }\n\n /** Shared body of `uploadFiles` and `uploadDir`: presign in batches of 100,\n * PUT with bounded concurrency, then bulk-finalize the batch. */\n private async uploadPaths(\n files: readonly UploadPath[],\n options: BatchUploadOptions,\n ): Promise<UploadDirResult> {\n const waitUntil = options.waitUntil ?? 'processing'\n validateWaitUntil(waitUntil)\n const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY\n if (concurrency < 1) throw new ValidationError(`concurrency must be >= 1, got ${concurrency}`)\n\n const prefixed = files.map((file) => {\n const folderPath = joinDestination(options.folderPath, file.folderPath)\n return { path: file.path, ...(folderPath !== undefined ? { folderPath } : {}) }\n })\n\n const uploaded: FileUpload[] = []\n const failed: UploadDirFailure[] = []\n const total = files.length\n let completed = 0\n const emit = () => {\n completed += 1\n options.onProgress?.({\n completed,\n total,\n succeeded: uploaded.length,\n failed: failed.length,\n })\n }\n\n for (const batch of chunked(prefixed, MAX_BULK_UPLOAD_FILES)) {\n const failedBefore = failed.length\n const slots = await this.createSlots(batch, failed)\n // createSlots can report several failures from one synchronous call, so tick\n // `failed` up one at a time here — reusing `emit()` would report the final\n // `failed.length` on every tick and break the completed = succeeded + failed\n // invariant for all but the last of them.\n for (let reported = failedBefore + 1; reported <= failed.length; reported += 1) {\n completed += 1\n options.onProgress?.({ completed, total, succeeded: uploaded.length, failed: reported })\n }\n await this.uploadBatch(slots, waitUntil, concurrency, (result) => {\n if ('error' in result) failed.push(result)\n else uploaded.push(result)\n emit()\n })\n }\n return { uploaded, failed }\n }\n\n private async createSlots(batch: readonly UploadPath[], failed: UploadDirFailure[]): Promise<SlotAssignment[]> {\n const readable: UploadPath[] = []\n const inputs: UploadUrlInput[] = []\n for (const file of batch) {\n try {\n const fileStat = await stat(file.path)\n const fileName = file.path.split(/[/\\\\]/).pop() as string\n inputs.push({ fileName, contentType: DEFER_CONTENT_TYPE_TO_SERVER, fileSize: fileStat.size })\n readable.push(file)\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n failed.push({ path: file.path, error: message })\n }\n }\n if (inputs.length === 0) return []\n const result = await this.createUploadUrls(inputs)\n return assignSlots(readable, result, failed)\n }\n\n private async uploadBatch(\n slots: readonly SlotAssignment[],\n waitUntil: WaitUntil,\n concurrency: number,\n onOutcome?: (result: FileUpload | UploadDirFailure) => void,\n ): Promise<(FileUpload | UploadDirFailure)[]> {\n if (slots.length === 0) return []\n const out: (FileUpload | UploadDirFailure)[] = []\n\n // PUT everything first, collecting the ones whose bytes landed.\n type PutOutcome = { landed: SlotAssignment } | { failure: UploadDirFailure }\n const put = await mapWithConcurrency<SlotAssignment, PutOutcome>(\n slots,\n concurrency,\n async ({ path, folderPath, slot }) => {\n try {\n const data = await readFile(path)\n await putBytes(this.config.fetch, slot, data, DEFAULT_PUT_TIMEOUT_MS)\n return { landed: { path, ...(folderPath !== undefined ? { folderPath } : {}), slot } }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return { failure: { path, error: message } }\n }\n },\n (outcome) => {\n // Emit PUT failures as each concurrent worker finishes — do not wait for\n // the rest of the batch / finalize before progress moves.\n if ('failure' in outcome) {\n out.push(outcome.failure)\n onOutcome?.(outcome.failure)\n }\n },\n )\n const landed: SlotAssignment[] = []\n for (const entry of put) {\n if ('failure' in entry) {\n // already recorded + emitted in onItemDone\n continue\n }\n landed.push(entry.landed)\n }\n if (landed.length === 0) return out\n\n // One bulk finalize for the whole batch — the reason a 2000-file directory\n // costs 20 requests here instead of 2000.\n const result = await this.finalizeMany(\n landed.map(({ slot, folderPath }) => ({\n uploadId: slot.uploadId,\n fileName: slot.fileName,\n ...(folderPath !== undefined ? { folderPath } : {}),\n })),\n )\n const failedIndices = new Set(result.failed.map((f) => f.index))\n for (const f of result.failed) {\n const failure: UploadDirFailure = { path: landed[f.index]?.path ?? '', error: f.error }\n out.push(failure)\n onOutcome?.(failure)\n }\n const finalized = result.finalized\n const remaining = landed.filter((_, i) => !failedIndices.has(i))\n\n if (waitUntil !== 'ready') {\n for (const item of finalized) {\n out.push(item)\n onOutcome?.(item)\n }\n return out\n }\n\n // Only `ready` needs polling; `processing` is already satisfied by the\n // finalize response.\n await mapWithConcurrency(\n remaining,\n concurrency,\n async ({ path, slot }) => {\n try {\n return await this.pollUntil(slot.uploadId, waitUntil, DEFAULT_POLL_INTERVAL_MS, DEFAULT_UPLOAD_TIMEOUT_MS)\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return { path, error: message } satisfies UploadDirFailure\n }\n },\n (item) => {\n out.push(item)\n onOutcome?.(item)\n },\n )\n return out\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../../_pagination.js'\nimport { asRecord, invokeWithRetry } from '../../../../_request.js'\nimport { validateId, validatePageSize } from '../../../../_validation.js'\nimport type { FileUpload } from '../../../../types/context-files.js'\n\n/** Generated base for the management `context.files` resource. */\nexport class ContextFilesResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List file uploads.\n *\n * Returns a page of durable landed file uploads. Uploads that have not landed yet are visible via\n * `GET /context/files/{uploadId}`, not this list.\n *\n * **Requires:** `context:read`\n *\n * @param options.pageSize - Items per page. Defaults to 50.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @returns A page of files.\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n } = {}): Promise<Page<FileUpload>> {\n const pageSize = options.pageSize ?? 50\n validatePageSize(pageSize, 200)\n return this.listPage(pageSize, options.pageToken)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n ): Promise<Page<FileUpload>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_list', {\n query: aipListParams(pageSize, pageToken) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'files',\n (raw) => raw as FileUpload,\n (token) => this.listPage(pageSize, token),\n )\n }\n\n /**\n * Get a file upload.\n *\n * Returns status + metadata for one upload. Prefers the durable landed context item; falls back\n * to in-flight upload status while the object has not landed yet. 404 if neither exists.\n *\n * **Requires:** `context:read`\n *\n * @param uploadId - Upload id returned by `createUploadUrl` / `createUploadUrls`.\n */\n async get(uploadId: string): Promise<FileUpload> {\n validateId(uploadId, 'uploadId')\n const data = await invokeWithRetry(this.config, this.http, 'ContextFilesController_get', {\n pathParams: { uploadId },\n })\n return asRecord(data) as unknown as FileUpload\n }\n}\n","import type { OperationId } from '../../_generated/operations.js'\nimport type { ModusConfig } from '../../_config.js'\nimport type { HttpClient } from '../../_http.js'\nimport { updateBody, updateMaskQuery } from '../../_query.js'\nimport { aipListParams, buildAipPage, type Page } from '../../_pagination.js'\nimport { asRecord, invokeWithRetry } from '../../_request.js'\nimport { ValidationError } from '../../_exceptions.js'\nimport { validatePageSize } from '../../_validation.js'\nimport type {\n ContextItem,\n ContextItemAccessUpdate,\n ContextItemDeletion,\n ContextItemMove,\n UpdateContextItemAccessInput,\n} from '../../types/context.js'\nimport type { UserFeedback } from './_content-merge.js'\n\nfunction contextListParams(\n pageSize: number,\n pageToken: string | undefined,\n filters: ListContextItemsFilters = {},\n): Record<string, string | number | boolean | readonly string[] | undefined | null> {\n const extra: Record<string, string | readonly string[]> = {}\n if (filters.contextType !== undefined) extra.contextTypes = [filters.contextType]\n if (filters.parentUids !== undefined) {\n extra.parentUids = filters.parentUids.length === 0 ? '' : [...filters.parentUids]\n }\n if (filters.ancestorUids !== undefined) {\n extra.ancestorUids = filters.ancestorUids.length === 0 ? '' : [...filters.ancestorUids]\n }\n if (filters.connectionIds !== undefined) {\n extra.connectionIds = filters.connectionIds.length === 0 ? '' : [...filters.connectionIds]\n }\n return aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | readonly string[] | undefined | null\n >\n}\n\ntype ListContextItemsFilters = {\n contextType?: string\n parentUids?: readonly string[]\n ancestorUids?: readonly string[]\n connectionIds?: readonly string[]\n}\n\n/** The move request body; a caller sending both destinations gets an error instead of one being dropped. */\nfunction moveBody(options: { destinationFolderUid?: string | null; destinationFolderPath?: string }): Record<string, unknown> {\n if (options.destinationFolderPath === undefined) return { destinationFolderUid: options.destinationFolderUid }\n if (options.destinationFolderUid !== undefined) {\n throw new ValidationError('Pass destinationFolderUid or destinationFolderPath, not both')\n }\n return { destinationFolderPath: options.destinationFolderPath }\n}\n\nfunction parseContextItem(raw: unknown): ContextItem {\n return raw as ContextItem\n}\n\nexport class ManagementContextItemsResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\n\n /**\n * List context items in the knowledge base.\n *\n * @param options.pageSize - Items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`.\n * @param options.contextType - Filter to one context type (for example `\"note\"`).\n * @param options.parentUids - Exact ordered native ancestry chain for direct\n * children. Omit to leave parent unrestricted; pass `[]` for the known-empty\n * root. Native UIDs are exact tokens; for a folder's children send ancestry\n * UIDs plus the last `dataPath` token, not the hashed context-item `uid`.\n * @param options.ancestorUids - Ordered UID ancestry prefix for strict\n * descendants. Omit to leave unrestricted; pass `[]` for every item with\n * non-null ancestry.\n * @param options.connectionIds - Restrict to these connection ids. Omit to\n * leave unfiltered; pass `[]` to match none. The Files root is\n * `connectionIds: ['files']` with `parentUids: []`.\n * @returns A page of context items.\n *\n * @example\n * ```ts\n * const rootFiles = await mgmt.context.items.list({\n * connectionIds: ['files'],\n * contextType: 'file_upload',\n * parentUids: [],\n * })\n * ```\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n contextType?: string\n parentUids?: readonly string[]\n ancestorUids?: readonly string[]\n connectionIds?: readonly string[]\n } = {}): Promise<Page<ContextItem>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken, {\n contextType: options.contextType,\n parentUids: options.parentUids,\n ancestorUids: options.ancestorUids,\n connectionIds: options.connectionIds,\n })\n }\n\n private async listPage(\n pageSize: number,\n pageToken: string | undefined,\n filters: ListContextItemsFilters,\n ): Promise<Page<ContextItem>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextItemsController_list', {\n query: contextListParams(pageSize, pageToken, filters),\n }),\n )\n return buildAipPage(data, 'contextItems', parseContextItem, (token) =>\n this.listPage(pageSize, token, filters),\n )\n }\n\n /**\n * Retrieve one context item by uid.\n *\n * @param uid - Context item uid.\n * @returns The context item.\n */\n async get(uid: string): Promise<ContextItem> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_get', {\n pathParams: { uid },\n })\n return parseContextItem(data)\n }\n\n /**\n * Update a context item.\n *\n * Only the fields you pass are changed. To clear a field, name it in\n * `updateMask` and leave its argument unset: it is sent as `null`.\n *\n * @param uid - Context item uid.\n * @param options.content - Replacement type-specific content.\n * @param options.contextType - Item type (for example `\"note\"`). Required when `content` is supplied.\n * @param options.description - New description.\n * @param options.userFeedback - Feedback verdict: `\"positive\"`, `\"neutral\"`, or `\"negative\"`.\n * @param options.topics - Replacement topic tags. Pass `[]` to clear all tags.\n * @param options.updateMask - Comma-separated field names to update or clear.\n * @returns The updated context item.\n */\n async update(\n uid: string,\n options: {\n content?: unknown\n contextType?: string\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n updateMask?: string\n } = {},\n ): Promise<ContextItem> {\n const body = updateBody({\n content: options.content,\n contextType: options.contextType,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n }, options.updateMask)\n await invokeWithRetry(this.config, this.http, 'ContextItemsController_update', {\n pathParams: { uid },\n query: updateMaskQuery(options.updateMask),\n jsonBody: body,\n })\n return this.get(uid)\n }\n\n /**\n * Delete a context item. Deleting a Files folder also deletes all its contents.\n *\n * @param uid - Context item uid.\n * @returns Deletion confirmation details.\n */\n async delete(uid: string): Promise<ContextItemDeletion> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_delete', {\n pathParams: { uid },\n })\n return data as ContextItemDeletion\n }\n\n /**\n * Move a live file or Files folder.\n *\n * Pass exactly one destination: `destinationFolderUid` (an existing folder,\n * or `null` for the Files root), or `destinationFolderPath` (a root-relative\n * path such as `reports/2026`; missing folders on it are created with the\n * move). Same-parent moves succeed as a no-op. Does not rename or merge folders.\n *\n * @param uid - Stored context-item uid of the file or folder to move.\n * @param options.destinationFolderUid - Stored context-item uid of the\n * destination folder, or `null` for the Files root.\n * @param options.destinationFolderPath - Root-relative destination folder path.\n * @returns How many items changed parent (`0` is a successful no-op).\n * @throws {NotFoundError} The source is missing or not visible.\n * @throws {ModusError} The destination is missing, not a Files folder, or\n * the move would create a cycle (HTTP 400).\n * @throws {PermissionDeniedError} The destination exists but is not writable\n * for this caller.\n * @throws {ConflictError} A sibling with the same name already exists.\n *\n * @example\n * ```ts\n * const moved = await mgmt.context.items.move('PLACEHOLDER_UID', {\n * destinationFolderUid: 'PLACEHOLDER_FOLDER_UID',\n * })\n * console.log(moved.movedItems)\n * ```\n */\n async move(\n uid: string,\n options:\n | { destinationFolderUid: string | null; destinationFolderPath?: never }\n | { destinationFolderPath: string; destinationFolderUid?: never },\n ): Promise<ContextItemMove> {\n const data = await invokeWithRetry(\n this.config,\n this.http,\n 'ContextItemsController_move' as OperationId,\n {\n pathParams: { uid },\n jsonBody: moveBody(options),\n },\n )\n return data as ContextItemMove\n }\n\n /**\n * Replace who can view and manage a note, saved query, link or uploaded file.\n *\n * All three settings are required and replace the current ones. You cannot\n * remove your own manage access. An item created before items had owners\n * becomes yours on the first change.\n *\n * @param uid - UUID of the context item.\n * @param input.visibility - `shared` (the owner plus the groups in\n * `groupPermissions`) or `private` (the owner plus the users in `sharedWith`).\n * @param input.groupPermissions - Group id to `{ use, manage }`. Used only when shared.\n * @param input.sharedWith - Users such as `{ email: 'ana@example.com', permission: 'use' }`.\n * Used only when private.\n * @returns The item's new access settings and whether you can still manage it.\n * @throws {NotFoundError} The item does not exist or you cannot view it.\n * @throws {PermissionDeniedError} You can view the item but not manage it.\n * @throws {ModusError} The item is another type, a group or user is invalid,\n * or the change would remove your own manage access.\n *\n * @example\n * ```ts\n * await mgmt.context.items.updateAccess('PLACEHOLDER_UID', {\n * visibility: 'private',\n * groupPermissions: {},\n * sharedWith: [{ email: 'ana@example.com', permission: 'use' }],\n * })\n * ```\n */\n async updateAccess(\n uid: string,\n input: UpdateContextItemAccessInput,\n ): Promise<ContextItemAccessUpdate> {\n const data = await invokeWithRetry(\n this.config,\n this.http,\n 'ContextItemAccessController_updateAccess' as OperationId,\n {\n pathParams: { uid },\n jsonBody: {\n visibility: input.visibility,\n groupPermissions: input.groupPermissions,\n sharedWith: input.sharedWith,\n },\n },\n )\n return data as ContextItemAccessUpdate\n }\n}\n","import type { OperationId } from '../../_generated/operations.js'\nimport type { ModusConfig } from '../../_config.js'\nimport type { HttpClient } from '../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../_request.js'\nimport type { ContextItem, CreatedContextItem } from '../../types/context.js'\nimport { withCreatedUid } from '../../types/context.js'\nimport { CustomContextItemsResource } from '../../resources/context/custom-items.js'\nimport {\n resolveAndUpdateLink,\n resolveAndUpdateNote,\n resolveAndUpdateSavedQuery,\n type UserFeedback,\n} from './_content-merge.js'\nimport { ManagementDashboardsResource } from './dashboards.js'\nimport { ManagementContextFilesResource } from './files.js'\nimport { ManagementContextItemsResource } from './items.js'\n\n/**\n * Create and update context items (notes, links, saved queries, file uploads).\n *\n * Call path: `mgmt.context` after `new ModusManagement(...)`.\n */\nexport class ManagementContextResource {\n readonly items: ManagementContextItemsResource\n readonly customItems: CustomContextItemsResource\n readonly files: ManagementContextFilesResource\n readonly dashboards: ManagementDashboardsResource\n\n /** @internal */\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {\n this.items = new ManagementContextItemsResource(http, config)\n this.customItems = new CustomContextItemsResource(http, config)\n this.files = new ManagementContextFilesResource(http, config)\n this.dashboards = new ManagementDashboardsResource(http, config)\n }\n\n /**\n * Add a free-form text note to the knowledge base.\n *\n * @param title - Note title.\n * @param content - Note body (markdown).\n * @returns The created context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const note = await mgmt.context.createNote('Runbook', '# Steps\\n1. Check logs')\n * ```\n */\n createNote(title: string, content: string): Promise<CreatedContextItem> {\n return this.create('ContextCreatorsController_createNote', omitUndefined({ title, content }))\n }\n\n /**\n * Update a note's title and markdown body.\n *\n * Preserves server-owned fields on the existing content blob. Pass `existing`\n * to skip a fetch when you already have the item from a list call.\n *\n * @param uid - Context item uid.\n * @param options.title - New title.\n * @param options.body - New markdown body.\n * @param options.existing - Optional cached item to avoid a GET.\n * @returns The updated context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const item = await mgmt.context.updateNote('PLACEHOLDER_UID', {\n * title: 'Runbook',\n * body: '# Steps\\n1. Check logs\\n2. Escalate',\n * })\n * ```\n */\n updateNote(\n uid: string,\n options: {\n title: string\n body: string\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n ): Promise<ContextItem> {\n return resolveAndUpdateNote(this.items, uid, options)\n }\n\n /**\n * Save a SQL query to the knowledge base.\n *\n * @param name - Display name for the query.\n * @param options.connectionId - Connection the query runs against.\n * @param options.query - SQL text.\n * @param options.path - Optional hierarchy path segments.\n * @returns The created context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const query = await mgmt.context.createSavedQuery('Monthly ARR', {\n * connectionId: 'conn_warehouse',\n * query: 'select * from arr_monthly',\n * })\n * ```\n */\n createSavedQuery(\n name: string,\n options: {\n query?: string\n connectionId: string\n description?: string\n path?: string[]\n },\n ): Promise<CreatedContextItem> {\n return this.create(\n 'ContextCreatorsController_createSavedQuery',\n omitUndefined({\n name,\n query: options.query,\n connectionId: options.connectionId,\n description: options.description,\n path: options.path,\n }),\n )\n }\n\n /**\n * Update a saved query's name, SQL, and optional connection metadata.\n *\n * @param uid - Context item uid.\n * @param options.name - New display name.\n * @param options.query - New SQL text.\n * @param options.existing - Optional cached item to avoid a GET.\n * @returns The updated context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const item = await mgmt.context.updateSavedQuery('PLACEHOLDER_UID', {\n * name: 'Monthly ARR',\n * query: 'select sum(amount) from arr_monthly',\n * })\n * ```\n */\n updateSavedQuery(\n uid: string,\n options: {\n name: string\n query: string\n connectionId?: string\n path?: string[]\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n ): Promise<ContextItem> {\n return resolveAndUpdateSavedQuery(this.items, uid, options)\n }\n\n /**\n * Add a URL to the knowledge base.\n *\n * @param url - Link URL.\n * @param options.title - Optional display title.\n * @param options.isCrawl - When true, crawl linked pages into context.\n * @param options.pageLimit - Maximum pages to crawl when `isCrawl` is true.\n * @returns The created context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const link = await mgmt.context.createLink('https://docs.example.com/runbook', {\n * title: 'Ops runbook',\n * })\n * ```\n */\n createLink(\n url: string,\n options: { title?: string; isCrawl?: boolean; pageLimit?: number } = {},\n ): Promise<CreatedContextItem> {\n return this.create(\n 'ContextCreatorsController_createLink',\n omitUndefined({\n url,\n title: options.title,\n isCrawl: options.isCrawl,\n pageLimit: options.pageLimit,\n }),\n )\n }\n\n /**\n * Update link metadata on an existing item.\n *\n * Merges `title` and/or `url` into the stored content blob. Does not re-fetch or re-crawl the URL.\n *\n * @param uid - Context item uid.\n * @param options.title - New display title.\n * @param options.url - New URL.\n * @param options.existing - Optional cached item to avoid a GET.\n * @returns The updated context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const item = await mgmt.context.updateLink('PLACEHOLDER_UID', {\n * title: 'Ops runbook (2025)',\n * })\n * ```\n */\n updateLink(\n uid: string,\n options: {\n title?: string\n url?: string\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n ): Promise<ContextItem> {\n return resolveAndUpdateLink(this.items, uid, options)\n }\n\n /** @internal */\n private async create(operationId: OperationId, payload: Record<string, unknown>): Promise<CreatedContextItem> {\n const data = await invokeWithRetry(this.config, this.http, operationId, {\n jsonBody: payload,\n })\n return withCreatedUid(data as Parameters<typeof withCreatedUid>[0])\n }\n}\n\nexport type { UserFeedback } from './_content-merge.js'\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../../_request.js'\nimport { validateId, validatePageSize } from '../../../_validation.js'\nimport type {\n McpExposureCatalog,\n McpExposureCatalogRequest,\n} from '../../../management/scopes/mcp-exposure-catalog.js'\nimport type { Scope } from '../../../types/scopes.js'\nimport type { VariationView } from '../../../types/views.js'\n\n/** Generated base for the management `scopes` resource. */\nexport class ScopesResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List scopes.\n *\n * Returns a paginated page of scopes the caller can at least `use`. Scopes the caller cannot see\n * are filtered out. Pagination uses an opaque token returned in `nextPageToken`.\n *\n * **Requires:** `scopes:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @param options.search - Case-insensitive substring filter on scope name.\n * @param options.view - Variation view. `active` reads the deployed version, or the latest draft\n * when nothing is published. `draft` reads the latest builder snapshot. `published` reads only\n * the published version, and only scopes you can use.\n * @param options.managerId - Return only scopes supervised by this manager scope id.\n * @returns A page of scopes.\n *\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * for await (const scope of (await mgmt.scopes.list()).autoPagingIter()) {\n * console.log(scope.id, scope.name, scope.status)\n * }\n * ```\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n search?: string\n view?: VariationView\n managerId?: number\n } = {}): Promise<Page<Scope>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken, options.search, options.view, options.managerId)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n search?: string,\n view?: VariationView,\n managerId?: number,\n ): Promise<Page<Scope>> {\n const extra: Record<string, string | number> = {}\n if (search !== undefined) extra.search = search\n if (view !== undefined) extra.view = view\n if (managerId !== undefined) extra.managerId = managerId\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ScopesController_list', {\n query: aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'scopes',\n (raw) => raw as Scope,\n (token) => this.listPage(pageSize, token, search, view, managerId),\n )\n }\n\n /**\n * Get a scope.\n *\n * Returns a scope. `view=active` (default) is the deployed version, or the latest draft when\n * nothing is published. `view=draft` is the latest edits. `view=published` is only the published\n * version, and only if you can use the scope. Returns 404 if you cannot access it.\n *\n * **Requires:** `scopes:read`\n *\n * @param scopeId - Numeric scope id.\n * @param options.view - Which version to read. Defaults to `active`. `published` is only the\n * published version, and only if you can use the scope.\n *\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const scope = await mgmt.scopes.get('PLACEHOLDER_SCOPE_ID')\n * console.log(scope.name, scope.status)\n * ```\n */\n async get(\n scopeId: number | string,\n options: { view?: VariationView } = {},\n ): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_get', {\n pathParams: { id: scopeId },\n query: { view: options.view },\n })\n return data as Scope\n }\n\n /**\n * Delete a scope.\n *\n * Deletes a scope. The scope can be restored later with POST /scopes/{id}/restore. Returns 404 if\n * the scope does not exist or is already deleted.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n *\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * await mgmt.scopes.delete('PLACEHOLDER_SCOPE_ID')\n * ```\n */\n async delete(scopeId: number | string): Promise<void> {\n validateId(scopeId, 'scope_id')\n await invokeWithRetry(this.config, this.http, 'ScopesController_delete', {\n pathParams: { id: scopeId },\n })\n }\n\n /**\n * Preview MCP exposure catalog.\n *\n * Lists tools this scope can expose to MCP clients. A field you send replaces the current draft;\n * a field you omit stays as stored. Nothing is saved. Entries you cannot access are left out, and\n * stored selections on them are counted in hiddenSelectedCount.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n * @param request - Request body; see `McpExposureCatalogRequest`.\n *\n * @example\n * ```ts\n * const catalog = await mgmt.scopes.mcpExposureCatalog(42, {})\n * catalog.discoveryAllowed\n * ```\n */\n async mcpExposureCatalog(\n scopeId: number | string,\n request: McpExposureCatalogRequest,\n ): Promise<McpExposureCatalog> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_mcpExposureCatalog', {\n pathParams: { id: scopeId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as McpExposureCatalog\n }\n\n /**\n * Restore a deleted scope.\n *\n * Restores a previously deleted scope and returns it. Restoring a scope that is already active\n * returns it unchanged.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n */\n async restore(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_restore', {\n pathParams: { id: scopeId },\n jsonBody: {},\n })\n return data as Scope\n }\n\n /**\n * Cancel ownership transfer.\n *\n * Cancels a pending ownership transfer. The current owner may cancel, the pending recipient may\n * decline, and for a scope with no owner an organization owner may cancel.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n */\n async cancelOwnershipTransfer(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_cancelOwnershipTransfer', {\n pathParams: { id: scopeId },\n })\n return data as Scope\n }\n\n /**\n * Accept ownership transfer.\n *\n * Accepts a pending ownership transfer. Only the pending recipient may invoke this action.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n */\n async acceptOwnershipTransfer(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_acceptOwnershipTransfer', {\n pathParams: { id: scopeId },\n jsonBody: {},\n })\n return data as Scope\n }\n}\n","const EVERYONE_GROUP_ID = '__everyone__'\n\nexport function accessConfigWireForCreate(guardrails: string[]): Record<string, unknown> {\n return {\n visibility: 'shared',\n groupPermissions: { [EVERYONE_GROUP_ID]: { use: true, manage: true } },\n guardrails,\n sharedWith: [],\n }\n}\n\nexport function accessConfigWireForUpdate(\n existing: Record<string, unknown> | undefined,\n guardrails: string[],\n): Record<string, unknown> {\n if (!existing || Object.keys(existing).length === 0) {\n return accessConfigWireForCreate(guardrails)\n }\n return { ...existing, guardrails }\n}\n\nexport function accessFromSkillResponse(raw: Record<string, unknown>): Record<string, unknown> {\n const value = raw.accessConfig ?? raw.access_config\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n return value as Record<string, unknown>\n }\n return {}\n}\n\nexport function accessConfigBodyForCreate(\n guardrails?: string[],\n): Record<string, unknown> | undefined {\n if (guardrails === undefined) return undefined\n return accessConfigWireForCreate(guardrails)\n}\n\nexport async function accessConfigBodyForUpdate(\n guardrails: string[] | undefined,\n loadResource: () => Promise<Record<string, unknown>>,\n): Promise<Record<string, unknown> | undefined> {\n if (guardrails === undefined) return undefined\n const existing = accessFromSkillResponse(await loadResource())\n return accessConfigWireForUpdate(existing, guardrails)\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../../_pagination.js'\nimport { updateMaskQuery } from '../../../../_query.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../../../_request.js'\nimport { validateId, validatePageSize } from '../../../../_validation.js'\nimport type {\n Memory,\n MemorySearchRequest,\n MemorySearchResult,\n MemoryUpdate,\n} from '../../../../management/types/memories.js'\n\n/** Generated base for the management `scopes.memories` resource. */\nexport class ScopesMemoriesResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly scopeId: number | string,\n ) {}\n\n /**\n * List scope memories.\n *\n * Returns a page of the scope’s memories (up to 1000 total). Pass `nextPageToken` as `pageToken`\n * to fetch the next page. Optional `userId` filters to one end user.\n *\n * **Requires:** `scopes:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @param options.userId - Narrow results to memories tagged with this end-user id.\n * @returns A page of memories.\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n userId?: string\n } = {}): Promise<Page<Memory>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken, options.userId)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n userId?: string,\n ): Promise<Page<Memory>> {\n validateId(this.scopeId, 'scope_id')\n const extra: Record<string, string> = {}\n if (userId !== undefined) extra.userId = userId\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ScopeMemoriesController_list', {\n pathParams: { id: this.scopeId },\n query: aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'memories',\n (raw) => raw as Memory,\n (token) => this.listPage(pageSize, token, userId),\n )\n }\n\n /**\n * Search scope memories.\n *\n * Returns memories ranked by semantic similarity to the supplied `query`. Caller must at least\n * `use` the scope. Optional `userId` and `limit` body fields narrow the result set (legacy parity\n * with `search-memories`).\n *\n * **Requires:** `scopes:read`\n *\n * @param request - Request body; see `MemorySearchRequest`.\n */\n async search(request: MemorySearchRequest): Promise<MemorySearchResult> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeMemoriesController_search', {\n pathParams: { id: this.scopeId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as MemorySearchResult\n }\n\n /**\n * Update a memory.\n *\n * Updates one memory. Supply at least one of `memory` or `metadata`. Use `updateMask` to limit\n * which fields change.\n *\n * **Requires:** `scopes:write`\n *\n * @param memoryId - Opaque memory id as returned by the list / search endpoints.\n * @param update - Request body; see `MemoryUpdate`.\n * @param options.updateMask - Comma-separated list of fields to update. Omit to update all\n * provided fields.\n */\n async update(\n memoryId: string,\n update: MemoryUpdate,\n options: { updateMask?: string } = {},\n ): Promise<void> {\n validateId(memoryId, 'memory_id')\n validateId(this.scopeId, 'scope_id')\n await invokeWithRetry(this.config, this.http, 'ScopeMemoriesController_update', {\n pathParams: { id: this.scopeId, memoryId },\n query: updateMaskQuery(options.updateMask),\n jsonBody: omitUndefined(update as Record<string, unknown>),\n })\n }\n\n /**\n * Delete a memory.\n *\n * Deletes one memory. Returns 404 if the memory does not exist or is already deleted.\n *\n * **Requires:** `scopes:write`\n *\n * @param memoryId - Opaque memory id as returned by the list / search endpoints.\n */\n async delete(memoryId: string): Promise<void> {\n validateId(memoryId, 'memory_id')\n validateId(this.scopeId, 'scope_id')\n await invokeWithRetry(this.config, this.http, 'ScopeMemoriesController_delete', {\n pathParams: { id: this.scopeId, memoryId },\n })\n }\n}\n","import { ScopesMemoriesResourceBase } from '../../_generated/resources/management/scopes/memories.js'\n\n/** Long-term memory stored per scope. */\nexport class ScopeMemoriesResource extends ScopesMemoriesResourceBase {}\n","import { randomUUID } from 'node:crypto'\nimport { ScopesEvaluationsResourceBase } from '../../_generated/resources/management/scopes/evaluations.js'\nimport { invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type { AddEvaluationCase, EvaluationCase, UpdateEvaluationCase } from '../types/evaluations.js'\n\n/** Scheduled and manual scope evaluations. */\nexport class ScopeEvaluationsResource extends ScopesEvaluationsResourceBase {\n /**\n * Add one evaluation case and return the stored case.\n *\n * @param input.task - What the scope should do. An empty string is allowed.\n * @param input.expectedOutput - What a correct result looks like. An empty string is allowed.\n * @param input.id - Stable id. Omit it and the client assigns one before the request, so a retry sends the same id.\n * @returns The stored evaluation case, including its id.\n * @throws ConflictError An evaluation case with this id already exists. A retry after the case was stored returns this error. An identical body is not treated as success.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const added = await mgmt.scopes.evaluations(42).addCase({\n * task: \"Summarize last quarter's revenue\",\n * expectedOutput: 'A one-paragraph summary with the total',\n * })\n * console.log(added.id)\n * ```\n */\n async addCase(input: AddEvaluationCase): Promise<EvaluationCase> {\n validateId(this.scopeId, 'scope_id')\n const id = input.id ?? randomUUID()\n validateId(id, 'id')\n return await invokeWithRetry(this.config, this.http, 'ScopesController_addEvaluationCase', {\n pathParams: { id: this.scopeId },\n jsonBody: omitUndefined({ ...input, id }),\n }) as EvaluationCase\n }\n\n /**\n * Change the task, the expected output, or both, for one evaluation case.\n *\n * @param caseId - Id of the case to change.\n * @param patch.task - Replacement task. Omit to leave it unchanged.\n * @param patch.expectedOutput - Replacement expected output. Omit to leave it unchanged.\n * @returns The evaluation case after the change.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const updated = await mgmt.scopes.evaluations(42).updateCase('CASE_ID', {\n * task: 'Summarize revenue in two sentences',\n * })\n * console.log(updated.task)\n * ```\n */\n async updateCase(caseId: string, patch: UpdateEvaluationCase): Promise<EvaluationCase> {\n validateId(this.scopeId, 'scope_id')\n validateId(caseId, 'case_id')\n return await invokeWithRetry(this.config, this.http, 'ScopesController_updateEvaluationCase', {\n pathParams: { id: this.scopeId, caseId },\n jsonBody: omitUndefined(patch),\n }) as EvaluationCase\n }\n\n /**\n * Remove one evaluation case. The other cases stay as they are.\n *\n * @param caseId - Id of the case to remove.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * await mgmt.scopes.evaluations(42).deleteCase('CASE_ID')\n * ```\n */\n async deleteCase(caseId: string): Promise<void> {\n validateId(this.scopeId, 'scope_id')\n validateId(caseId, 'case_id')\n await invokeWithRetry(this.config, this.http, 'ScopesController_deleteEvaluationCase', {\n pathParams: { id: this.scopeId, caseId },\n })\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../../../_request.js'\nimport { validateId, validatePageSize } from '../../../../_validation.js'\nimport type {\n EvaluationConfig,\n EvaluationRun,\n EvaluationRunWithResults,\n TriggerEvaluationRunResponse,\n UpdateEvaluationConfig,\n} from '../../../../management/types/evaluations.js'\n\n/** Generated base for the management `scopes.evaluations` resource. */\nexport class ScopesEvaluationsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly scopeId: number | string,\n ) {}\n\n /**\n * Get evaluation configuration.\n *\n * Returns the evaluation configuration for a scope, including judge settings, schedule cadence,\n * and notification preferences.\n *\n * **Requires:** `scopes:read`\n */\n async getConfig(): Promise<EvaluationConfig> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'EvaluationsController_getConfig', {\n pathParams: { id: this.scopeId },\n })\n return data as EvaluationConfig\n }\n\n /**\n * Update evaluation configuration.\n *\n * Updates the evaluation configuration for a scope. Changes to the schedule cadence are synced\n * automatically.\n *\n * **Requires:** `scopes:write`\n *\n * @param update - Request body; see `UpdateEvaluationConfig`.\n */\n async updateConfig(update: UpdateEvaluationConfig): Promise<EvaluationConfig> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'EvaluationsController_updateConfig', {\n pathParams: { id: this.scopeId },\n jsonBody: omitUndefined(update as Record<string, unknown>),\n })\n return data as EvaluationConfig\n }\n\n /**\n * Trigger evaluation run.\n *\n * Triggers a manual evaluation run for the scope. The run executes asynchronously.\n *\n * **Requires:** `scopes:write`\n *\n * @returns Evaluation run accepted and queued. The run executes asynchronously; poll `GET\n * /scopes/{id}/evaluations/runs/{runId}` for status.\n */\n async triggerRun(): Promise<TriggerEvaluationRunResponse> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'EvaluationsController_triggerRun', {\n pathParams: { id: this.scopeId },\n })\n return data as TriggerEvaluationRunResponse\n }\n\n /**\n * List evaluation runs.\n *\n * Returns a paginated list of evaluation runs for the scope, ordered by most recent first.\n *\n * **Requires:** `scopes:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @returns A page of runs.\n */\n listRuns(options: {\n pageSize?: number\n pageToken?: string\n } = {}): Promise<Page<EvaluationRun>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listRunsPage(pageSize, options.pageToken)\n }\n\n protected async listRunsPage(\n pageSize: number,\n pageToken: string | undefined,\n ): Promise<Page<EvaluationRun>> {\n validateId(this.scopeId, 'scope_id')\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'EvaluationsController_listRuns', {\n pathParams: { id: this.scopeId },\n query: aipListParams(pageSize, pageToken) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'runs',\n (raw) => raw as EvaluationRun,\n (token) => this.listRunsPage(pageSize, token),\n )\n }\n\n /**\n * Get evaluation run.\n *\n * Returns details of an evaluation run including all per-case results.\n *\n * **Requires:** `scopes:read`\n *\n * @param runId - Run ID.\n */\n async getRun(runId: string): Promise<EvaluationRunWithResults> {\n validateId(this.scopeId, 'scope_id')\n validateId(runId, 'run_id')\n const data = await invokeWithRetry(this.config, this.http, 'EvaluationsController_getRun', {\n pathParams: { id: this.scopeId, runId },\n })\n return data as EvaluationRunWithResults\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type { ScopeInterface } from '../../../../management/scopes/interfaces.js'\n\n/** Generated base for the management `scopes.interfaces` resource. */\nexport class ScopesInterfacesResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly scopeId: number | string,\n ) {}\n\n /**\n * List the chat interfaces of a scope.\n *\n * Returns the chat interfaces (at most one per chat platform) that let people use this scope from\n * chat. Requires manage permission on the scope, because the config lists allowed emails.\n *\n * **Requires:** `scopes:read`\n */\n async list(): Promise<ScopeInterface[]> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeInterfacesController_list', {\n pathParams: { id: this.scopeId },\n })\n return (data as { interfaces: ScopeInterface[] }).interfaces\n }\n\n /**\n * Remove a scope interface.\n *\n * Removes one chat interface from the scope. Mentions on that chat platform stop reaching this\n * scope immediately.\n *\n * **Requires:** `scopes:write`\n *\n * @param interfaceId - Interface id (UUID).\n */\n async delete(interfaceId: string): Promise<void> {\n validateId(this.scopeId, 'scope_id')\n validateId(interfaceId, 'interface_id')\n await invokeWithRetry(this.config, this.http, 'ScopeInterfacesController_delete', {\n pathParams: { id: this.scopeId, interfaceId },\n })\n }\n}\n","import { ScopesInterfacesResourceBase } from '../../_generated/resources/management/scopes/interfaces.js'\nimport { updateBody, updateMaskQuery } from '../../_query.js'\nimport { invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type { components } from '../../_generated/v1.js'\n\nexport type ScopeInterface = components['schemas']['ScopeInterfaceDto']\nexport type AddScopeInterface = components['schemas']['AddScopeInterfaceDto']\nexport type UpdateScopeInterface = components['schemas']['UpdateScopeInterfaceDto']\n\nexport class ScopeInterfacesResource extends ScopesInterfacesResourceBase {\n\n /**\n * Add a Slack or Microsoft Teams interface to this scope.\n *\n * @param options - Interface type, optional name and config.\n * @returns The created interface.\n */\n async create(options: AddScopeInterface): Promise<ScopeInterface> {\n validateId(this.scopeId, 'scope_id')\n return await invokeWithRetry(this.config, this.http, 'ScopeInterfacesController_add', {\n pathParams: { id: this.scopeId },\n jsonBody: omitUndefined(options),\n }) as ScopeInterface\n }\n\n /**\n * Update an interface on this scope.\n *\n * @param interfaceId - Interface id.\n * @param options - Updated name and/or config.\n * @param updateMask - Optional comma-separated field names to update.\n * @returns The updated interface.\n */\n async update(interfaceId: string, options: UpdateScopeInterface, updateMask?: string): Promise<ScopeInterface> {\n validateId(this.scopeId, 'scope_id')\n validateId(interfaceId, 'interface_id')\n return await invokeWithRetry(this.config, this.http, 'ScopeInterfacesController_update', {\n pathParams: { id: this.scopeId, interfaceId },\n query: updateMaskQuery(updateMask),\n jsonBody: updateBody(options, updateMask),\n }) as ScopeInterface\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type {\n SetSupervisionRequest,\n Supervision,\n} from '../../../../management/scopes/supervision.js'\nimport type { SupervisionView } from '../../../../types/views.js'\n\n/** Generated base for the management `scopes.supervision` resource. */\nexport class ScopesSupervisionResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly scopeId: number | string,\n ) {}\n\n /**\n * Read the scope subordinate supervision list.\n *\n * Returns the list of subordinate scope ids managed by this scope. `?view=active` (default) reads\n * the deployed supervision set; `?view=draft` reads the most recent builder snapshot. Returns 404\n * when the caller cannot at least `use` the scope.\n *\n * **Requires:** `scopes:read`\n *\n * @param options.view - Which variation snapshot to read. Defaults to `active`.\n */\n async get(options: { view?: SupervisionView } = {}): Promise<Supervision> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeSupervisionController_get', {\n pathParams: { id: this.scopeId },\n query: { view: options.view },\n })\n return data as Supervision\n }\n\n /**\n * Replace draft subordinate supervision list.\n *\n * Writes the supplied subordinate id list into the draft variation. Replaces the previous list\n * fully — supply an empty array to clear all subordinates. Requires manage permission on the\n * supervisor; the change is not visible to runners until the scope is deployed.\n *\n * **Requires:** `scopes:write`\n *\n * @param request - Request body; see `SetSupervisionRequest`.\n */\n async set(request: SetSupervisionRequest): Promise<Supervision> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeSupervisionController_set', {\n pathParams: { id: this.scopeId },\n jsonBody: request,\n })\n return data as Supervision\n }\n\n /**\n * Replace active subordinate supervision list.\n *\n * Writes directly into the active variation supervision set, bypassing the draft deploy cycle.\n * Requires `scopes:write` plus manage permission on the supervisor. Use to correct a live\n * supervision graph without going through the builder.\n *\n * **Requires:** `scopes:write`\n *\n * @param request - Request body; see `SetSupervisionRequest`.\n */\n async setActive(request: SetSupervisionRequest): Promise<Supervision> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeSupervisionController_setActive', {\n pathParams: { id: this.scopeId },\n jsonBody: request,\n })\n return data as Supervision\n }\n}\n","import { ScopesSupervisionResourceBase } from '../../_generated/resources/management/scopes/supervision.js'\nimport type { components } from '../../_generated/v1.js'\n\nexport type Supervision = components['schemas']['SupervisionDto']\nexport type SetSupervisionRequest = components['schemas']['SetSupervisionRequestDto']\n\nexport class ScopeSupervisionResource extends ScopesSupervisionResourceBase {}\n","import { ScopesResourceBase } from '../../_generated/resources/management/scopes.js'\nimport type { OperationId } from '../../_generated/operations.js'\nimport { updateBody, updateMaskQuery } from '../../_query.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport { ScopeConversationsResource } from '../../resources/scopes/conversations.js'\nimport type { Scope } from '../../types/scopes.js'\nimport {\n accessConfigBodyForCreate,\n accessConfigBodyForUpdate,\n} from '../_access-config.js'\nimport type { components } from '../../_generated/v1.js'\nimport type { JsonObjectListInput } from '../types/json-blob.js'\nimport type { ToolsetInput } from '../types/toolset.js'\nimport { ScopeMemoriesResource } from './memories.js'\nimport { ScopeEvaluationsResource } from './evaluations.js'\nimport { ScopeInterfacesResource } from './interfaces.js'\nimport { ScopeSupervisionResource } from './supervision.js'\n\n/** The canonical `/api/v1/scopes` management operationIds. */\ninterface ManagementScopesOperations {\n readonly list: OperationId\n readonly get: OperationId\n readonly create: OperationId\n readonly update: OperationId\n readonly deploy: OperationId\n readonly applySelectionOps: OperationId\n readonly delete: OperationId\n readonly restore: OperationId\n readonly requestOwnershipTransfer: OperationId\n readonly cancelOwnershipTransfer: OperationId\n readonly acceptOwnershipTransfer: OperationId\n readonly patchMcpConfig: OperationId\n readonly getVariation: OperationId\n}\n\n/** A connectionSet row from `scopes.get`, or a plain `{ connection_id, preferences }` object. */\ntype ConnectionSetRowInput = components['schemas']['ConnectionSetItemDto']\n\nconst MANAGEMENT_SCOPE_OPERATIONS: ManagementScopesOperations = {\n list: 'ScopesController_list',\n get: 'ScopesController_get',\n create: 'ScopesController_create',\n update: 'ScopesController_update',\n deploy: 'ScopesController_deploy',\n applySelectionOps: 'ScopesController_applySelectionOps',\n delete: 'ScopesController_delete',\n restore: 'ScopesController_restore',\n requestOwnershipTransfer: 'ScopesController_requestOwnershipTransfer',\n cancelOwnershipTransfer: 'ScopesController_cancelOwnershipTransfer',\n acceptOwnershipTransfer: 'ScopesController_acceptOwnershipTransfer',\n patchMcpConfig: 'ScopesController_patchMcpConfig',\n getVariation: 'ScopesController_getVariation',\n}\n\nfunction parseScope(raw: unknown): Scope {\n return raw as Scope\n}\n\nexport interface CreateScopeOptions {\n name: string\n description?: string\n expectedOutput?: string\n instructions?: string[]\n toolset?: ToolsetInput\n model?: string\n connectionSet?: ReadonlyArray<ConnectionSetRowInput>\n contextSelections?: JsonObjectListInput\n includeOwnLearnings?: boolean\n includeOrgLearnings?: boolean\n interfaces?: JsonObjectListInput\n guardrails?: string[]\n}\n\n/** @deprecated Use `CreateScopeOptions` instead. */\nexport type CreateSkillOptions = CreateScopeOptions\n\nexport interface UpdateScopeOptions {\n name?: string\n description?: string\n expectedOutput?: string\n instructions?: string[]\n toolset?: ToolsetInput\n model?: string\n connectionSet?: ReadonlyArray<ConnectionSetRowInput>\n contextSelections?: JsonObjectListInput\n interfaces?: JsonObjectListInput\n guardrails?: string[]\n /** Numeric id of the manager scope, or `null` to detach from the current manager. */\n managerId?: number | null\n evaluations?: JsonObjectListInput\n supervisionSubordinateDescriptions?: Record<string, string>\n updateMask?: string\n}\n\n/** @deprecated Use `UpdateScopeOptions` instead. */\nexport type UpdateSkillOptions = UpdateScopeOptions\n\n/**\n * Full CRUD and lifecycle for Modus scopes.\n *\n * Call path: `mgmt.scopes` after `new ModusManagement(...)`.\n */\nexport class ManagementScopesResource extends ScopesResourceBase {\n protected readonly ops: ManagementScopesOperations = MANAGEMENT_SCOPE_OPERATIONS\n\n /**\n * Conversations for a scope.\n *\n * @param scopeId - Scope id.\n * @returns A conversations resource scoped to the scope.\n */\n conversations(scopeId: number | string): ScopeConversationsResource {\n return new ScopeConversationsResource(this.http, this.config, scopeId)\n }\n\n /**\n * Long-term memories for a scope.\n *\n * @param scopeId - Scope id.\n * @returns A memories resource scoped to the scope.\n */\n memories(scopeId: number | string): ScopeMemoriesResource {\n return new ScopeMemoriesResource(this.http, this.config, scopeId)\n }\n\n /**\n * Evaluations for a scope.\n *\n * @param scopeId - Scope id.\n * @returns An evaluations resource scoped to the scope.\n */\n evaluations(scopeId: number | string): ScopeEvaluationsResource {\n return new ScopeEvaluationsResource(this.http, this.config, scopeId)\n }\n\n /**\n * Supervision (subordinate scopes) for a scope.\n *\n * @param scopeId - Scope id.\n * @returns A supervision resource scoped to the scope.\n */\n supervision(scopeId: number | string): ScopeSupervisionResource {\n return new ScopeSupervisionResource(this.http, this.config, scopeId)\n }\n\n /**\n * Slack and Microsoft Teams interfaces for a scope.\n *\n * @param scopeId - Scope id.\n * @returns An interfaces resource scoped to the scope.\n */\n interfaces(scopeId: number | string): ScopeInterfacesResource {\n return new ScopeInterfacesResource(this.http, this.config, scopeId)\n }\n\n /**\n * Create a new scope in the organization.\n *\n * @param options.name - Display name for the scope.\n * @param options.description - Optional description.\n * @param options.instructions - Optional system instructions.\n * @param options.model - Optional model id.\n * @param options.toolset - Optional tool selection for the scope.\n * @param options.includeOwnLearnings - Whether the scope reads what is taught while using it. Defaults to true.\n * @param options.includeOrgLearnings - Whether create adds the org-wide learnings path (`auto_generated:org`) to the scope's selections. Defaults to true; not applied when `contextSelections` already mention learnings or are context filters without a rule-based query. `false` only skips that addition: selections that already name the path still read org-wide learnings.\n * @param options.guardrails - Runtime guardrail labels (for example `\"no-pii\"`). Omit to create with no guardrails.\n * @returns The created scope (draft).\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const scope = await mgmt.scopes.create({ name: 'Support assistant', model: 'claude-sonnet-5' })\n * console.log(scope.id, scope.name)\n * ```\n */\n async create(options: CreateScopeOptions): Promise<Scope> {\n const body = omitUndefined({\n name: options.name,\n description: options.description,\n expectedOutput: options.expectedOutput,\n instructions: options.instructions,\n toolset: options.toolset,\n model: options.model,\n connectionSet: options.connectionSet,\n contextSelections: options.contextSelections,\n includeOwnLearnings: options.includeOwnLearnings,\n includeOrgLearnings: options.includeOrgLearnings,\n interfaces: options.interfaces,\n accessConfig: accessConfigBodyForCreate(options.guardrails),\n })\n const data = await invokeWithRetry(this.config, this.http, this.ops.create, {\n jsonBody: body,\n })\n return parseScope(data)\n }\n\n /**\n * Update a scope's configuration.\n *\n * Only the fields you pass are changed. To clear a field, name it in\n * `updateMask` (comma-separated field names) and leave its argument unset:\n * it is sent as `null`.\n *\n * @param scopeId - Numeric scope id.\n * @param options.guardrails - Guardrail labels to set. Fetches the current scope first to merge. Pass `[]` to clear all.\n * @param options.managerId - Numeric id of the manager scope to move this scope under, or `null`\n * to detach it. Send it alone: the server rejects it combined with other fields.\n * @param options.updateMask - Comma-separated field names to update or clear.\n * @returns The updated scope.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const scope = await mgmt.scopes.update('PLACEHOLDER_SCOPE_ID', {\n * description: 'Answers billing questions for enterprise customers.',\n * })\n * ```\n */\n async update(scopeId: number | string, options: UpdateScopeOptions = {}): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const accessConfig = await accessConfigBodyForUpdate(options.guardrails, async () =>\n asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.get, {\n pathParams: { id: scopeId },\n }),\n ),\n )\n const fields = {\n name: options.name,\n description: options.description,\n expectedOutput: options.expectedOutput,\n instructions: options.instructions,\n toolset: options.toolset,\n model: options.model,\n connectionSet: options.connectionSet,\n contextSelections: options.contextSelections,\n interfaces: options.interfaces,\n accessConfig,\n managerId: options.managerId,\n evaluations: options.evaluations,\n supervisionSubordinateDescriptions: options.supervisionSubordinateDescriptions,\n }\n const body = updateBody(fields, options.updateMask)\n const data = await invokeWithRetry(this.config, this.http, this.ops.update, {\n pathParams: { id: scopeId },\n query: updateMaskQuery(options.updateMask),\n jsonBody: body,\n })\n return parseScope(data)\n }\n\n /**\n * Publish the current draft of a scope.\n *\n * @param scopeId - Scope id.\n * @returns The published scope.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const scope = await mgmt.scopes.create({ name: 'Support assistant' })\n * const published = await mgmt.scopes.deploy(scope.id)\n * console.log(published.status)\n * ```\n */\n async deploy(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.deploy, {\n pathParams: { id: scopeId },\n jsonBody: {},\n }),\n )\n return parseScope(data.scope)\n }\n\n /**\n * Apply selection changes to a scope.\n *\n * Pass `validateOnly: true` to run the same checks and return the scope that would\n * be saved, without writing. Set a connection with `setConnectionPreferences` and\n * remove it with `removeConnection`.\n *\n * @param scopeId - Scope id.\n * @param ops - Selection changes, applied in order.\n * @param options.toolset - The scope toolset after the edit, when the edit changed it.\n * @param options.validateOnly - When true, check and return the planned scope without writing.\n * @returns The scope, or the scope that would be saved when `validateOnly` is true.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const preview = await mgmt.scopes.applySelectionOps(42, [{\n * op: 'setConnectionPreferences',\n * connectionId: '11111111-1111-4111-8111-111111111111',\n * preferences: { schemaVersion: 2, mode: 'all', include: [], exclude: [] },\n * }], { validateOnly: true })\n * console.log(preview.id)\n * ```\n */\n async applySelectionOps(\n scopeId: number | string,\n ops: ReadonlyArray<Record<string, unknown>>,\n options?: { toolset?: Record<string, unknown>; validateOnly?: boolean },\n ): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, this.ops.applySelectionOps, {\n pathParams: { id: scopeId },\n jsonBody: omitUndefined({\n ops,\n toolset: options?.toolset,\n validateOnly: options?.validateOnly ? true : undefined,\n }),\n })\n return parseScope(data)\n }\n\n /**\n * Start transferring ownership of a scope to another organization member.\n *\n * The current owner calls this, and the recipient accepts. A scope with no owner (one\n * created with a service-account token) can be given one by an organization owner;\n * assigning yourself takes effect at once.\n *\n * @param scopeId - Scope id.\n * @param options.newOwnerUserId - User id of the proposed new owner.\n * @returns The scope with a pending ownership transfer.\n */\n async requestOwnershipTransfer(\n scopeId: number | string,\n options: { newOwnerUserId: string },\n ): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.requestOwnershipTransfer,\n {\n pathParams: { id: scopeId },\n jsonBody: omitUndefined({ newOwnerUserId: options.newOwnerUserId }),\n },\n )\n return parseScope(data)\n }\n\n /**\n * Update MCP server configuration for a scope.\n *\n * @param scopeId - Scope id.\n * @param options.mcpConfig - MCP configuration object.\n */\n async patchMcpConfig(\n scopeId: number | string,\n options: { mcpConfig: Record<string, unknown> },\n ): Promise<void> {\n validateId(scopeId, 'scope_id')\n await invokeWithRetry(this.config, this.http, this.ops.patchMcpConfig, {\n pathParams: { id: scopeId },\n jsonBody: omitUndefined({ config: options.mcpConfig }),\n })\n }\n\n /**\n * Retrieve a specific scope variation by uid.\n *\n * @param scopeId - Scope id.\n * @param options.variationUid - Variation uid.\n * @returns The scope variation.\n */\n async getVariation(\n scopeId: number | string,\n options: { variationUid: string },\n ): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n validateId(options.variationUid, 'variation_uid')\n const data = await invokeWithRetry(this.config, this.http, this.ops.getVariation, {\n pathParams: { id: scopeId, variationUid: options.variationUid },\n })\n return parseScope(data)\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { invokeWithRetry } from '../../../_request.js'\nimport type { UsageUsersReport } from '../../../types/usage.js'\n\n/** Generated base for the management `usage` resource. */\nexport class UsageResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List usage users.\n *\n * Returns the distinct acting-user emails that appear in your organization's LLM usage over the\n * `[since, until)` window. Feeds the usage page's user filter (includes non-Modus Slack/Teams\n * users). Scoped to your organization.\n *\n * **Requires:** `usage:read`\n *\n * @param options.since - ISO8601 start of the query window (inclusive).\n * @param options.until - ISO8601 end of the query window (exclusive).\n */\n async listUsers(options: { since: string; until: string }): Promise<UsageUsersReport> {\n const data = await invokeWithRetry(this.config, this.http, 'UsageController_listUsers', {\n query: { since: options.since, until: options.until },\n })\n return data as UsageUsersReport\n }\n}\n","import { UsageResourceBase } from '../_generated/resources/management/usage.js'\nimport { invokeWithRetry } from '../_request.js'\nimport type { UsageReport, UsageRollup } from '../types/usage.js'\n\nexport class ManagementUsageResource extends UsageResourceBase {\n /**\n * List usage metrics for your organization over a time window.\n *\n * @param options.since - Start of the window (ISO 8601, inclusive).\n * @param options.until - End of the window (ISO 8601, exclusive).\n * @param options.rollup - Bucket size for each row: `\"hour\"` or `\"day\"`.\n * @param options.model - Optional filter to a single model name.\n * @param options.userEmail - Optional filter to one or more acting-user emails.\n * @returns Usage report rows for the window.\n * @throws {UnprocessableError} When the request is rejected by the API.\n * @throws {AuthenticationError} When the API key is invalid or missing.\n */\n async list(options: {\n since: string\n until: string\n rollup: UsageRollup\n model?: string\n userEmail?: readonly string[]\n }): Promise<UsageReport> {\n const query: Record<string, string | string[]> = {\n since: options.since,\n until: options.until,\n rollup: options.rollup,\n }\n if (options.model !== undefined) query.model = options.model\n if (options.userEmail !== undefined) query.user_email = [...options.userEmail]\n const data = await invokeWithRetry(this.config, this.http, 'UsageController_list', { query })\n return data as UsageReport\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../_pagination.js'\nimport { asRecord, invokeWithRetry } from '../../../_request.js'\nimport { validatePageSize } from '../../../_validation.js'\nimport type { ToolCatalogEntry } from '../../../types/tools.js'\n\n/** Generated base for the management `tools` resource. */\nexport class ToolsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List available tools.\n *\n * Returns a page of known tool/integration surfaces a scope can select in its toolset, with the\n * fixed actions for built-in tools.\n *\n * **Requires:** `scopes:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @returns A page of tools.\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n } = {}): Promise<Page<ToolCatalogEntry>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n ): Promise<Page<ToolCatalogEntry>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ToolsController_list', {\n query: aipListParams(pageSize, pageToken) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'tools',\n (raw) => raw as ToolCatalogEntry,\n (token) => this.listPage(pageSize, token),\n )\n }\n}\n","import { ToolsResourceBase } from '../_generated/resources/management/tools.js'\n\n/** Browse the catalog of tool and integration surfaces a scope can select in its toolset. */\nexport class ManagementToolsResource extends ToolsResourceBase {}\n","import type { ModusConfig } from '../_config.js'\nimport type { components } from '../_generated/v1.js'\nimport type { HttpClient } from '../_http.js'\nimport { invokeWithRetry } from '../_request.js'\n\nexport type MemberGroup = components['schemas']['MemberGroupDto']\nexport type OrgMember = components['schemas']['OrgMemberDto']\n\nexport class ManagementUsersResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\n\n /** List member groups in the organization. */\n async listMemberGroups(): Promise<MemberGroup[]> {\n const data = (await invokeWithRetry(\n this.config, this.http, 'MemberGroupsController_list',\n )) as { groups: MemberGroup[] }\n return data.groups\n }\n\n /** List organization members. */\n async listOrgMembers(): Promise<OrgMember[]> {\n const data = (await invokeWithRetry(\n this.config, this.http, 'OrgMembersController_list',\n )) as { members: OrgMember[] }\n return data.members\n }\n}\n","import { ModusClientBase } from '../_client-base.js'\nimport type { ModusOptions } from '../_config.js'\nimport { ManagementWorkflowsResource } from './workflows/agents.js'\nimport { ManagementContextResource } from './context/context.js'\nimport { ManagementScopesResource } from './scopes/skills.js'\nimport { ManagementUsageResource } from './usage.js'\nimport { ManagementToolsResource } from './tools.js'\nimport { ManagementUsersResource } from './users.js'\n\n/**\n * Configure scopes, workflows, context, usage, tools, and users.\n *\n * Call path: `const mgmt = new ModusManagement(...)` then `mgmt.scopes`, `mgmt.context`, …\n *\n * @param options - Client configuration (`apiKey`, `baseUrl`, `timeoutMs`, `maxRetries`).\n */\nexport class ModusManagement extends ModusClientBase {\n readonly scopes: ManagementScopesResource\n readonly workflows: ManagementWorkflowsResource\n readonly context: ManagementContextResource\n readonly usage: ManagementUsageResource\n readonly tools: ManagementToolsResource\n readonly users: ManagementUsersResource\n\n constructor(options: ModusOptions = {}) {\n super(options)\n this.scopes = new ManagementScopesResource(this.http, this.config)\n this.workflows = new ManagementWorkflowsResource(this.http, this.config)\n this.context = new ManagementContextResource(this.http, this.config)\n this.usage = new ManagementUsageResource(this.http, this.config)\n this.tools = new ManagementToolsResource(this.http, this.config)\n this.users = new ManagementUsersResource(this.http, this.config)\n }\n}\n\nexport type { ModusOptions }\nexport type { ModusConfig } from '../_config.js'\nexport type { ManagementScopesResource } from './scopes/skills.js'\nexport type { ScopeMemoriesResource } from './scopes/memories.js'\nexport type { ScopeEvaluationsResource } from './scopes/evaluations.js'\nexport type { ScopeSupervisionResource, SetSupervisionRequest, Supervision } from './scopes/supervision.js'\nexport type { McpExposureCatalog, McpExposureCatalogRequest } from './scopes/mcp-exposure-catalog.js'\nexport type {\n AddScopeInterface,\n ScopeInterface,\n ScopeInterfacesResource,\n UpdateScopeInterface,\n} from './scopes/interfaces.js'\nexport type { ManagementWorkflowsResource } from './workflows/agents.js'\nexport type {\n AddAgentInterface,\n AgentInterface,\n UpdateAgentInterface,\n WorkflowInterfacesResource,\n} from './workflows/interfaces.js'\nexport type { ManagementContextResource } from './context/context.js'\nexport type { ManagementContextItemsResource } from './context/items.js'\nexport type { BatchUploadOptions, ManagementContextFilesResource } from './context/files.js'\nexport type { ManagementDashboardElementsResource, ManagementDashboardsResource } from './context/dashboards.js'\nexport type { ManagementUsageResource } from './usage.js'\nexport type { ManagementToolsResource } from './tools.js'\nexport type { ManagementUsersResource, MemberGroup, OrgMember } from './users.js'\nexport type {\n AddEvaluationCase,\n EvaluationCase,\n EvaluationConfig,\n EvaluationRun,\n EvaluationRunWithResults,\n TriggerEvaluationRunResponse,\n UpdateEvaluationCase,\n UpdateEvaluationConfig,\n} from './types/evaluations.js'\nexport type { JsonObjectInput, JsonObjectListInput } from './types/json-blob.js'\nexport type { CreatedContextItem } from '../types/context.js'\nexport type { ToolCatalogEntry } from '../types/tools.js'\nexport type {\n UsageBucket,\n UsageReport,\n UsageRollup,\n UsageTotals,\n UsageUser,\n UsageUsersReport,\n} from '../types/usage.js'\nexport type {\n CreateScopeOptions,\n UpdateScopeOptions,\n CreateSkillOptions,\n UpdateSkillOptions,\n} from './scopes/skills.js'\nexport type {\n CreateWorkflowOptions,\n UpdateWorkflowOptions,\n CreateAgentOptions,\n UpdateAgentOptions,\n TriggerInput,\n AgentSelectionInput,\n WorkflowGraphInput,\n} from './workflows/agents.js'\nexport type { UserFeedback } from './context/context.js'\nexport type {\n ContextItemAccessUpdate,\n ContextItemDeletion,\n ContextItemMove,\n UpdateContextItemAccessInput,\n} from '../types/context.js'\nexport type {\n BulkFinalizeResult,\n BulkUploadFromUrlsResult,\n BulkUploadUrlsResult,\n FinalizeInput,\n FailedUploadFromUrl,\n FailedUploadUrl,\n FinalizeFailure,\n FileUpload,\n FileUploadStatus,\n UploadDirFailure,\n UploadDirResult,\n UploadFileInput,\n UploadFromUrlInput,\n UploadProgress,\n UploadProgressCallback,\n UploadUrlInput,\n UploadUrlSlot,\n WaitUntil,\n} from '../types/context-files.js'\nexport type {\n CreateDashboardElementInput,\n CreateDashboardInput,\n Dashboard,\n DashboardDraftSnapshot,\n DashboardElementKind,\n DashboardElementLayout,\n DashboardElementPatch,\n DashboardElementResult,\n DashboardElementsList,\n DashboardElementSummary,\n DashboardLayoutElement,\n DashboardPublishResult,\n DashboardVersion,\n DashboardView,\n PublishDashboardInput,\n TransferDashboardOwnershipInput,\n UpdateDashboardAccessInput,\n UpdateDashboardDraftInput,\n UpdateDashboardElementInput,\n UpdateDashboardLayoutInput,\n} from '../types/context-dashboards.js'\nexport type { PlatformToolsetEntry, ToolsetInput, ToolsetRules, ToolsetSlot } from './types/toolset.js'\nexport type {\n Memory,\n MemorySearchRequest,\n MemorySearchResult,\n MemoryUpdate,\n} from './types/memories.js'\n"],"mappings":";;;;;;;;;;;;;;;;AAWO,IAAM,wBAAN,MAA4B;AAAA;AAAA,EAEjC,YACqB,MACA,QACnB;AAFmB;AACA;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8BH,KAAK,UAOD,CAAC,GAA4B;AAC/B,U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,GAAG;AACtC,UAAM,OAAO;AACb,SAAK,SAAS,IAAI,yBAAyB,KAAK,MAAM,KAAK,MAAM;AACjE,SAAK,YAAY,IAAI,4BAA4B,KAAK,MAAM,KAAK,MAAM;AACvE,SAAK,UAAU,IAAI,0BAA0B,KAAK,MAAM,KAAK,MAAM;AACnE,SAAK,QAAQ,IAAI,wBAAwB,KAAK,MAAM,KAAK,MAAM;AAC/D,SAAK,QAAQ,IAAI,wBAAwB,KAAK,MAAM,KAAK,MAAM;AAC/D,SAAK,QAAQ,IAAI,wBAAwB,KAAK,MAAM,KAAK,MAAM;AAAA,EACjE;AACF;","names":["relative"]}
|
|
1
|
+
{"version":3,"sources":["../../src/_generated/resources/management/workflows.ts","../../src/_generated/resources/management/workflows/interfaces.ts","../../src/management/workflows/interfaces.ts","../../src/management/workflows/agents.ts","../../src/_generated/resources/management/context/artifacts.ts","../../src/_generated/resources/management/context/artifactComments.ts","../../src/_generated/resources/management/context/dashboardAlerts.ts","../../src/_generated/resources/management/context/graph.ts","../../src/_generated/resources/management/context/orgLearnings.ts","../../src/_generated/resources/management/context/reporting.ts","../../src/_generated/resources/management/context/suggestions.ts","../../src/types/context.ts","../../src/management/context/_content-merge.ts","../../src/_generated/resources/management/context/dashboards.ts","../../src/_generated/resources/management/context/dashboards/elements.ts","../../src/management/context/dashboards.ts","../../src/management/context/files.ts","../../src/_generated/resources/management/context/files.ts","../../src/management/context/items.ts","../../src/management/context/context.ts","../../src/_generated/resources/management/scopes.ts","../../src/management/_access-config.ts","../../src/_generated/resources/management/scopes/memories.ts","../../src/management/scopes/memories.ts","../../src/management/scopes/evaluations.ts","../../src/_generated/resources/management/scopes/evaluations.ts","../../src/_generated/resources/management/scopes/interfaces.ts","../../src/management/scopes/interfaces.ts","../../src/_generated/resources/management/scopes/supervision.ts","../../src/management/scopes/supervision.ts","../../src/management/scopes/skills.ts","../../src/_generated/resources/management/auditEvents.ts","../../src/management/audit-events.ts","../../src/_generated/resources/management/usage.ts","../../src/management/usage.ts","../../src/_generated/resources/management/tools.ts","../../src/management/tools.ts","../../src/_generated/resources/management/users.ts","../../src/management/users.ts","../../src/_generated/resources/management/git.ts","../../src/management/git.ts","../../src/_generated/resources/management/llm.ts","../../src/management/llm.ts","../../src/_generated/resources/management/security.ts","../../src/management/security.ts","../../src/_generated/resources/management/directorySync.ts","../../src/management/directory-sync.ts","../../src/_generated/resources/management/connections.ts","../../src/management/connections.ts","../../src/management/index.ts"],"sourcesContent":["// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../../_request.js'\nimport { validateId, validatePageSize } from '../../../_validation.js'\nimport type {\n ApproveAutomationRunStep,\n ApproveAutomationRunStepResponse,\n ListAutomationRunsResponse,\n ListInboundEmailsResponse,\n ReportedIssueStreaksResponse,\n} from '../../../types/organization-operations.js'\nimport type { VariationView } from '../../../types/views.js'\nimport type { Workflow, WorkflowEmailAddress, WorkflowType } from '../../../types/workflows.js'\n\n/** Generated base for the management `workflows` resource. */\nexport class WorkflowsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List workflows.\n *\n * Returns a paginated page of workflows the caller can at least `use`. Workflows the caller\n * cannot see are filtered out. Pagination uses an opaque token returned in `nextPageToken`.\n *\n * **Requires:** `workflows:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @param options.search - Case-insensitive substring filter on workflow name.\n * @param options.type - Filter by workflow type.\n * @param options.view - Variation view. `active` reads the deployed version. `draft` reads the\n * latest builder snapshot. `published` reads only a published workflow of type workflow that\n * you can use; tasks are excluded.\n * @param options.includeVariation - Include the requested variation payload (`trigger`,\n * `workflowStructure`, `agentSelection`) on list rows.\n * @returns A page of workflows.\n *\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * for await (const wf of (await mgmt.workflows.list({ search: 'digest' })).autoPagingIter()) {\n * console.log(wf.id, wf.name, wf.status)\n * }\n * ```\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n search?: string\n type?: WorkflowType\n view?: VariationView\n includeVariation?: boolean\n } = {}): Promise<Page<Workflow>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken, options.search, options.type, options.view, options.includeVariation)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n search?: string,\n type?: WorkflowType,\n view?: VariationView,\n includeVariation?: boolean,\n ): Promise<Page<Workflow>> {\n const extra: Record<string, string | boolean> = {}\n if (search !== undefined) extra.search = search\n if (type !== undefined) extra.type = type\n if (view !== undefined) extra.view = view\n if (includeVariation !== undefined) extra.includeVariation = includeVariation\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'WorkflowsController_list', {\n query: aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'workflows',\n (raw) => raw as Workflow,\n (token) => this.listPage(pageSize, token, search, type, view, includeVariation),\n )\n }\n\n /**\n * Delete a workflow.\n *\n * Deletes a workflow and stops its schedule. The workflow can be restored later with POST\n * /workflows/{id}/restore. Returns 404 if the workflow does not exist or is already deleted.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n *\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * await mgmt.workflows.delete('PLACEHOLDER_WORKFLOW_ID')\n * ```\n */\n async delete(workflowId: number | string): Promise<void> {\n validateId(workflowId, 'workflow_id')\n await invokeWithRetry(this.config, this.http, 'WorkflowsController_delete', {\n pathParams: { id: workflowId },\n })\n }\n\n /**\n * Restore a deleted workflow.\n *\n * Restores a previously deleted workflow and returns it. The workflow’s schedule is not resumed\n * automatically — re-enable it if it should run again. Restoring an active workflow returns it\n * unchanged.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n */\n async restore(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowsController_restore', {\n pathParams: { id: workflowId },\n jsonBody: {},\n })\n return data as Workflow\n }\n\n /**\n * Cancel ownership transfer.\n *\n * Cancels a pending ownership transfer. The current owner may cancel; the pending recipient may\n * decline.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n */\n async cancelOwnershipTransfer(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowsController_cancelOwnershipTransfer', {\n pathParams: { id: workflowId },\n })\n return data as Workflow\n }\n\n /**\n * Accept ownership transfer.\n *\n * Accepts a pending ownership transfer. Only the pending recipient may invoke this action.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n */\n async acceptOwnershipTransfer(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowsController_acceptOwnershipTransfer', {\n pathParams: { id: workflowId },\n jsonBody: {},\n })\n return data as Workflow\n }\n\n /**\n * Get workflow email address.\n *\n * Get the inbound address of a workflow you manage.\n *\n * **Requires:** `workflows:read`\n *\n * @param workflowId - Numeric workflow id.\n *\n * @example\n * await management.workflows.getEmailAddress(42)\n */\n async getEmailAddress(workflowId: number | string): Promise<WorkflowEmailAddress> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowEmailAddressController_get', {\n pathParams: { id: workflowId },\n })\n return data as WorkflowEmailAddress\n }\n\n /**\n * Rotate workflow email address.\n *\n * Replace the inbound address of a workflow you manage. The previous address accepts mail for\n * seven days.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n *\n * @example\n * await management.workflows.rotateEmailAddress(42)\n */\n async rotateEmailAddress(workflowId: number | string): Promise<WorkflowEmailAddress> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowEmailAddressController_rotate', {\n pathParams: { id: workflowId },\n })\n return data as WorkflowEmailAddress\n }\n\n /**\n * Disable workflow email address.\n *\n * Disable a workflow email address so incoming mail is dropped.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n *\n * @example\n * await management.workflows.disableEmailAddress(42)\n */\n async disableEmailAddress(workflowId: number | string): Promise<WorkflowEmailAddress> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowEmailAddressController_disable', {\n pathParams: { id: workflowId },\n })\n return data as WorkflowEmailAddress\n }\n\n /**\n * Enable workflow email address.\n *\n * Enable the existing address of a deployed email-triggered workflow.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n *\n * @example\n * await management.workflows.enableEmailAddress(42)\n */\n async enableEmailAddress(workflowId: number | string): Promise<WorkflowEmailAddress> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowEmailAddressController_enable', {\n pathParams: { id: workflowId },\n })\n return data as WorkflowEmailAddress\n }\n\n /**\n * Revoke previous workflow email address.\n *\n * Stop accepting mail at the previous address before its grace period ends.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n *\n * @example\n * await management.workflows.revokePreviousEmailAddress(42)\n */\n async revokePreviousEmailAddress(workflowId: number | string): Promise<WorkflowEmailAddress> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowEmailAddressController_revokePrevious', {\n pathParams: { id: workflowId },\n })\n return data as WorkflowEmailAddress\n }\n\n /**\n * List the emails a workflow's email trigger received.\n *\n * Newest first, with what became of each email. Requires manage permission on the workflow:\n * returns 403 if you can only use it, and 404 if you cannot access it.\n *\n * **Requires:** `workflows:read`\n *\n * @param workflowId - Numeric workflow id.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @param options.pageSize - Max emails per page. Defaults to 10.\n *\n * @example\n * await mgmt.workflows.listInboundEmails(42)\n */\n async listInboundEmails(\n workflowId: number | string,\n options: { pageToken?: string; pageSize?: number } = {},\n ): Promise<ListInboundEmailsResponse> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowInboundEmailsController_list', {\n pathParams: { id: workflowId },\n query: { pageToken: options.pageToken, pageSize: options.pageSize },\n })\n return data as ListInboundEmailsResponse\n }\n\n /**\n * Approve a pending workflow step.\n *\n * Sends the chosen option for a workflow run step that is waiting for a person. A step assigned\n * to a person needs a person: a service account token gets 403. Returns 404 when the caller\n * cannot use the workflow. A step assigned to someone else is refused unless the caller can\n * manage that workflow.\n *\n * **Requires:** `workflows:write`\n *\n * @param workflowId - Numeric workflow id.\n * @param runId - Workflow run identifier.\n * @param stepId - Workflow node id awaiting approval.\n * @param input - Request body; see `ApproveAutomationRunStep`.\n *\n * @example\n * await mgmt.workflows.approveRunStep(42, \"RUN_ID\", \"STEP_ID\", {\"optionId\": \"approve\"})\n */\n async approveRunStep(\n workflowId: number | string,\n runId: string,\n stepId: string,\n input: ApproveAutomationRunStep,\n ): Promise<ApproveAutomationRunStepResponse> {\n validateId(workflowId, 'workflow_id')\n validateId(runId, 'run_id')\n validateId(stepId, 'step_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowRunsController_approveStep', {\n pathParams: { id: workflowId, runId, stepId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ApproveAutomationRunStepResponse\n }\n\n /**\n * List recent runs across the workflows the caller may use.\n *\n * Returns run history across workflows the caller may use. Supports status, timeframe, approval\n * scope, search and pagination filters. Inaccessible workflows contribute no runs or counts.\n *\n * **Requires:** `workflows:read`\n *\n * @param options.status - Filter by run status (running / awaiting_human / completed / error /\n * cancelled / all_executions).\n * @param options.timeframe - Filter by run timeframe (e.g. last_hour / last_day / last_week).\n * @param options.approvalScope - Approval scope filter (mine / all). Only meaningful with\n * `status=awaiting_human`.\n * @param options.search - Case-insensitive substring filter on the parent workflow name.\n * @param options.pageSize - Max items per page. Defaults to 25. Must be between 1 and 100.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n *\n * @example\n * await mgmt.workflows.listAllRuns()\n */\n async listAllRuns(options: { status?: string; timeframe?: string; approvalScope?: string; search?: string; pageSize?: number; pageToken?: string } = {}): Promise<ListAutomationRunsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'AllRunsController_listAll', {\n query: { status: options.status, timeframe: options.timeframe, approvalScope: options.approvalScope, search: options.search, pageSize: options.pageSize, pageToken: options.pageToken },\n })\n return data as ListAutomationRunsResponse\n }\n\n /**\n * List workflows whose last 3 runs reported an issue.\n *\n * Returns the ids of the workflows the caller may use whose last 3 finished runs all completed\n * with an issue reported by one of their steps. Only workflows with such a run in the last 30\n * days are checked, at most 25.\n *\n * **Requires:** `workflows:read`\n *\n * @example\n * await mgmt.workflows.listReportedIssueStreaks()\n */\n async listReportedIssueStreaks(): Promise<ReportedIssueStreaksResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'AllRunsController_listReportedIssueStreaks')\n return data as ReportedIssueStreaksResponse\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type { AgentInterface } from '../../../../management/workflows/interfaces.js'\n\n/** Generated base for the management `workflows.interfaces` resource. */\nexport class WorkflowsInterfacesResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly workflowId: number | string,\n ) {}\n\n /**\n * List interfaces attached to a workflow.\n *\n * Returns every Slack, MCP, or Teams interface bound to the workflow. Requires manage permission\n * on the workflow: returns 403 if you can only use it, and 404 if you cannot access it.\n *\n * **Requires:** `workflows:read`\n */\n async list(): Promise<AgentInterface[]> {\n validateId(this.workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'WorkflowInterfacesController_list', {\n pathParams: { id: this.workflowId },\n })\n return (data as { interfaces: AgentInterface[] }).interfaces\n }\n\n /**\n * Remove a workflow interface.\n *\n * Deletes one interface row. For MCP interfaces, bound MCP tokens are revoked best-effort.\n *\n * **Requires:** `workflows:write`\n *\n * @param interfaceId - Interface row id (UUID).\n */\n async delete(interfaceId: string): Promise<void> {\n validateId(this.workflowId, 'workflow_id')\n validateId(interfaceId, 'interface_id')\n await invokeWithRetry(this.config, this.http, 'WorkflowInterfacesController_delete', {\n pathParams: { id: this.workflowId, interfaceId },\n })\n }\n}\n","import { WorkflowsInterfacesResourceBase } from '../../_generated/resources/management/workflows/interfaces.js'\nimport { updateBody, updateMaskQuery } from '../../_query.js'\nimport { invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type { components } from '../../_generated/v1.js'\n\nexport type AgentInterface = components['schemas']['AgentInterfaceDto']\nexport type AddAgentInterface = components['schemas']['AddAgentInterfaceDto']\nexport type UpdateAgentInterface = components['schemas']['UpdateAgentInterfaceDto']\n\nexport class WorkflowInterfacesResource extends WorkflowsInterfacesResourceBase {\n\n /**\n * Add an interface to this workflow.\n *\n * @param options - Interface configuration to attach.\n * @returns The created interface.\n */\n async create(options: AddAgentInterface): Promise<AgentInterface> {\n validateId(this.workflowId, 'workflow_id')\n return await invokeWithRetry(this.config, this.http, 'WorkflowInterfacesController_add', {\n pathParams: { id: this.workflowId },\n jsonBody: omitUndefined(options),\n }) as AgentInterface\n }\n\n /**\n * Update an interface attached to this workflow.\n *\n * @param interfaceId - Interface id.\n * @param options - Updated interface values.\n * @param updateMask - Optional comma-separated field names to update.\n * @returns The updated interface.\n */\n async update(interfaceId: string, options: UpdateAgentInterface, updateMask?: string): Promise<AgentInterface> {\n validateId(this.workflowId, 'workflow_id')\n validateId(interfaceId, 'interface_id')\n return await invokeWithRetry(this.config, this.http, 'WorkflowInterfacesController_update', {\n pathParams: { id: this.workflowId, interfaceId },\n query: updateMaskQuery(updateMask),\n jsonBody: updateBody(options, updateMask),\n }) as AgentInterface\n }\n}\n","import { WorkflowsResourceBase } from '../../_generated/resources/management/workflows.js'\nimport type { OperationId } from '../../_generated/operations.js'\nimport { updateBody, updateMaskQuery } from '../../_query.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type { Workflow, WorkflowType } from '../../types/workflows.js'\nimport type { VariationView } from '../../types/views.js'\nimport { WorkflowInterfacesResource } from './interfaces.js'\n\nexport type TriggerInput = Record<string, unknown>\nexport type AgentSelectionInput = Record<string, unknown>\nexport type WorkflowGraphInput = Record<string, unknown>\n\n/** The canonical `/api/v1/workflows` management operationIds. */\ninterface ManagementWorkflowsOperations {\n readonly list: OperationId\n readonly get: OperationId\n readonly create: OperationId\n readonly update: OperationId\n readonly deploy: OperationId\n readonly delete: OperationId\n readonly restore: OperationId\n readonly requestOwnershipTransfer: OperationId\n readonly cancelOwnershipTransfer: OperationId\n readonly acceptOwnershipTransfer: OperationId\n readonly toggle: OperationId\n}\n\nconst MANAGEMENT_WORKFLOW_OPERATIONS: ManagementWorkflowsOperations = {\n list: 'WorkflowsController_list',\n get: 'WorkflowsController_get',\n create: 'WorkflowsController_create',\n update: 'WorkflowsController_update',\n deploy: 'WorkflowsController_deploy',\n delete: 'WorkflowsController_delete',\n restore: 'WorkflowsController_restore',\n requestOwnershipTransfer: 'WorkflowsController_requestOwnershipTransfer',\n cancelOwnershipTransfer: 'WorkflowsController_cancelOwnershipTransfer',\n acceptOwnershipTransfer: 'WorkflowsController_acceptOwnershipTransfer',\n toggle: 'WorkflowsController_toggle',\n}\n\nfunction parseWorkflow(raw: unknown): Workflow {\n return raw as Workflow\n}\n\nexport interface CreateWorkflowOptions {\n name: string\n type: WorkflowType\n description?: string\n trigger?: TriggerInput\n agentSelection?: AgentSelectionInput\n workflowStructure?: WorkflowGraphInput\n}\n\n/** @deprecated Use `CreateWorkflowOptions` instead. */\nexport type CreateAgentOptions = CreateWorkflowOptions\n\nexport interface UpdateWorkflowOptions {\n name?: string\n type?: WorkflowType\n description?: string\n trigger?: TriggerInput\n agentSelection?: AgentSelectionInput\n workflowStructure?: WorkflowGraphInput\n updateMask?: string\n}\n\n/** @deprecated Use `UpdateWorkflowOptions` instead. */\nexport type UpdateAgentOptions = UpdateWorkflowOptions\n\nexport class ManagementWorkflowsResource extends WorkflowsResourceBase {\n protected readonly ops: ManagementWorkflowsOperations = MANAGEMENT_WORKFLOW_OPERATIONS\n\n /**\n * Retrieve a workflow with full configuration.\n *\n * @param workflowId - Numeric workflow id.\n * @param options.view - Variation view: `\"active\"` (deployed), `\"draft\"`, or `\"published\"` (published workflow you can use).\n * @returns The workflow.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const [first] = (await mgmt.workflows.list()).items\n * const wf = await mgmt.workflows.get(first.id)\n * console.log(wf.name, wf.status)\n * ```\n */\n async get(workflowId: number | string, options: { view?: VariationView } = {}): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const query = options.view !== undefined ? { view: options.view } : undefined\n const data = await invokeWithRetry(this.config, this.http, this.ops.get, {\n pathParams: { id: workflowId },\n query,\n })\n return parseWorkflow(data)\n }\n\n /**\n * Interfaces attached to a workflow.\n *\n * @param workflowId - Workflow id.\n * @returns An interfaces resource scoped to the workflow.\n */\n interfaces(workflowId: number | string): WorkflowInterfacesResource {\n return new WorkflowInterfacesResource(this.http, this.config, workflowId)\n }\n\n /**\n * Create a new workflow in the organization.\n *\n * @param options.name - Display name for the workflow.\n * @param options.type - `\"workflow\"`. `\"task\"` is a deprecated alias the server stores as `\"workflow\"`.\n * @param options.trigger - Optional trigger configuration.\n * @returns The created workflow (draft).\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const wf = await mgmt.workflows.create({ name: 'Daily report', type: 'workflow' })\n * ```\n */\n async create(options: CreateWorkflowOptions): Promise<Workflow> {\n const body = omitUndefined({\n name: options.name,\n type: options.type,\n description: options.description,\n trigger: options.trigger,\n agentSelection: options.agentSelection,\n workflowStructure: options.workflowStructure,\n })\n const data = await invokeWithRetry(this.config, this.http, this.ops.create, {\n jsonBody: body,\n })\n return parseWorkflow(data)\n }\n\n /**\n * Update a workflow's configuration.\n *\n * Only the fields you pass are changed. To clear a field, name it in\n * `updateMask` and leave its argument unset: it is sent as `null`.\n *\n * @param workflowId - Numeric workflow id.\n * @param options.type - Only `\"workflow\"` is accepted; `\"task\"` is rejected with a 422.\n * @param options.updateMask - Comma-separated field names to update or clear.\n * @returns The updated workflow.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const wf = await mgmt.workflows.update('PLACEHOLDER_WORKFLOW_ID', { description: 'Runs every morning' })\n * ```\n */\n async update(workflowId: number | string, options: UpdateWorkflowOptions = {}): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const fields = {\n name: options.name,\n type: options.type,\n description: options.description,\n trigger: options.trigger,\n agentSelection: options.agentSelection,\n workflowStructure: options.workflowStructure,\n }\n const body = updateBody(fields, options.updateMask)\n const data = await invokeWithRetry(this.config, this.http, this.ops.update, {\n pathParams: { id: workflowId },\n query: updateMaskQuery(options.updateMask),\n jsonBody: body,\n })\n return parseWorkflow(data)\n }\n\n /**\n * Publish the current draft of a workflow.\n *\n * @param workflowId - Workflow id.\n * @returns The published workflow.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * await mgmt.workflows.update('PLACEHOLDER_WORKFLOW_ID', { description: 'Runs every morning' })\n * const published = await mgmt.workflows.deploy('PLACEHOLDER_WORKFLOW_ID')\n * ```\n */\n async deploy(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.deploy, {\n pathParams: { id: workflowId },\n jsonBody: {},\n }),\n )\n return parseWorkflow(data.workflow)\n }\n\n /**\n * Enable or disable a workflow without deleting it.\n *\n * @param workflowId - Workflow id.\n * @param options.active - `true` to activate, `false` to deactivate.\n * @returns The updated workflow.\n */\n async toggle(workflowId: number | string, options: { active: boolean }): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, this.ops.toggle, {\n pathParams: { id: workflowId },\n jsonBody: { active: options.active },\n })\n return parseWorkflow(data)\n }\n\n /**\n * Start transferring ownership of a workflow to another organization member.\n *\n * @param workflowId - Workflow id.\n * @param options.newOwnerUserId - User id of the proposed new owner.\n * @returns The workflow with a pending ownership transfer.\n */\n async requestOwnershipTransfer(\n workflowId: number | string,\n options: { newOwnerUserId: string },\n ): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.requestOwnershipTransfer,\n {\n pathParams: { id: workflowId },\n jsonBody: omitUndefined({ newOwnerUserId: options.newOwnerUserId }),\n },\n )\n return parseWorkflow(data)\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type {\n ArtifactDirectoryResponse,\n ArtifactDraftResponse,\n ArtifactEditionSavedResponse,\n ArtifactFolderResponse,\n ArtifactPublishedResponse,\n ArtifactReportDownloadResponse,\n ArtifactRestoredResponse,\n ArtifactTitleResponse,\n ArtifactVersionDownloadResponse,\n ArtifactVersionResponse,\n CreateArtifactFolder,\n CreateDocumentDraft,\n PlaceArtifact,\n PublishArtifact,\n PublishedArtifactDownload,\n PublishedArtifactListResponse,\n RenameDocument,\n SaveArtifactEdition,\n SaveGeneratedReport,\n SavedArtifactResponse,\n SavedReportLookupResponse,\n VersionPin,\n} from '../../../../types/context-operations.js'\n\n/** Generated base for the management `context.artifacts` resource. */\nexport class ContextArtifactsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List artifacts and folders.\n *\n * **Requires:** `context:read`\n *\n * @example\n * await mgmt.context.artifacts.list()\n */\n async list(options: { page?: number; search?: string; folderId?: string; kind?: string; selectedId?: string; selectedKind?: string } = {}): Promise<ArtifactDirectoryResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_list', {\n query: { page: options.page, search: options.search, folderId: options.folderId, kind: options.kind, selectedId: options.selectedId, selectedKind: options.selectedKind },\n })\n return data as ArtifactDirectoryResponse\n }\n\n /**\n * Get an artifact download URL.\n *\n * **Requires:** `context:read`\n *\n * @param id - Artifact ID.\n * @param options.view - Artifact edition to download.\n * @param options.includeSourceFiles - Include the source files needed to reopen the working\n * edition. Requires manage access to the artifact.\n *\n * @example\n * await mgmt.context.artifacts.getDownload('ARTIFACT_ID', { view: 'draft', includeSourceFiles: true })\n */\n async getDownload(\n id: string,\n options: { view?: string; includeSourceFiles?: boolean } = {},\n ): Promise<ArtifactReportDownloadResponse> {\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_download', {\n pathParams: { id },\n query: { view: options.view, includeSourceFiles: options.includeSourceFiles },\n })\n return data as ArtifactReportDownloadResponse\n }\n\n /**\n * Find a report saved from a conversation.\n *\n * **Requires:** `context:read`\n *\n * @param input - Request body; see `SaveGeneratedReport`.\n *\n * @example\n * await mgmt.context.artifacts.findSavedReport({\"threadId\": \"thread-id\", \"filePath\": \"reports/weekly.html\"})\n */\n async findSavedReport(input: SaveGeneratedReport): Promise<SavedReportLookupResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_findSavedReport', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as SavedReportLookupResponse\n }\n\n /**\n * Save a report from a conversation.\n *\n * **Requires:** `context:write`\n *\n * @param input - Request body; see `SaveGeneratedReport`.\n *\n * @example\n * await mgmt.context.artifacts.saveReport({\"threadId\": \"thread-id\", \"filePath\": \"reports/weekly.html\"})\n */\n async saveReport(input: SaveGeneratedReport): Promise<SavedArtifactResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_saveReport', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as SavedArtifactResponse\n }\n\n /**\n * Create an artifact draft.\n *\n * **Requires:** `context:write`\n *\n * @param input - Request body; see `CreateDocumentDraft`.\n *\n * @example\n * await mgmt.context.artifacts.createDraft({\"requestId\": \"65fe8d02-3bb0-41d4-980a-10dc9ebbc6ba\", \"kind\": \"report\"})\n */\n async createDraft(input: CreateDocumentDraft): Promise<ArtifactDraftResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_createDraft', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ArtifactDraftResponse\n }\n\n /**\n * Rename an artifact.\n *\n * **Requires:** `context:write`\n *\n * @param id - Artifact ID.\n * @param input - Request body; see `RenameDocument`.\n *\n * @example\n * await mgmt.context.artifacts.rename(\"ID\", {\"title\": \"title\", \"expectedTitle\": \"expected-title\"})\n */\n async rename(\n id: string,\n input: RenameDocument,\n ): Promise<ArtifactTitleResponse> {\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_rename', {\n pathParams: { id },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ArtifactTitleResponse\n }\n\n /**\n * Set or clear an artifact version pin.\n *\n * **Requires:** `context:write`\n *\n * @param kind - Artifact kind.\n * @param id - Artifact ID.\n * @param input - Request body; see `VersionPin`.\n *\n * @example\n * await mgmt.context.artifacts.setVersionPin(\"dashboard\", \"ID\", {\"versionId\": \"65fe8d02-3bb0-41d4-980a-10dc9ebbc6ba\", \"name\": null})\n */\n async setVersionPin(\n kind: string,\n id: string,\n input: VersionPin,\n ): Promise<void> {\n validateId(kind, 'kind')\n validateId(id, 'id')\n await invokeWithRetry(this.config, this.http, 'ArtifactsController_setVersionPin', {\n pathParams: { kind, id },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n }\n\n /**\n * List artifact versions.\n *\n * **Requires:** `context:read`\n *\n * @param id - Artifact ID.\n *\n * @example\n * await mgmt.context.artifacts.listVersions(\"ID\")\n */\n async listVersions(id: string): Promise<ArtifactVersionResponse[]> {\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_versions', {\n pathParams: { id },\n })\n return data as ArtifactVersionResponse[]\n }\n\n /**\n * Get an artifact version download URL.\n *\n * **Requires:** `context:read`\n *\n * @param id - Artifact ID.\n * @param versionId - Artifact version ID.\n *\n * @example\n * await mgmt.context.artifacts.getVersionDownload(\"ID\", \"VERSION_ID\")\n */\n async getVersionDownload(\n id: string,\n versionId: string,\n ): Promise<ArtifactVersionDownloadResponse> {\n validateId(id, 'id')\n validateId(versionId, 'version_id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_versionDownload', {\n pathParams: { id, versionId },\n })\n return data as ArtifactVersionDownloadResponse\n }\n\n /**\n * Restore an artifact version.\n *\n * **Requires:** `context:write`\n *\n * @param id - Artifact ID.\n * @param versionId - Artifact version ID.\n * @param input - Request body; see `PublishArtifact`.\n *\n * @example\n * await mgmt.context.artifacts.restoreVersion(\"ID\", \"VERSION_ID\", {\"expectedRevision\": \"expected-revision\", \"expectedTitle\": \"expected-title\"})\n */\n async restoreVersion(\n id: string,\n versionId: string,\n input: PublishArtifact,\n ): Promise<ArtifactRestoredResponse> {\n validateId(id, 'id')\n validateId(versionId, 'version_id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_restore', {\n pathParams: { id, versionId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ArtifactRestoredResponse\n }\n\n /**\n * Publish an artifact.\n *\n * **Requires:** `context:write`\n *\n * @param id - Artifact ID.\n * @param input - Request body; see `PublishArtifact`.\n *\n * @example\n * await mgmt.context.artifacts.publish(\"ID\", {\"expectedRevision\": \"expected-revision\", \"expectedTitle\": \"expected-title\"})\n */\n async publish(\n id: string,\n input: PublishArtifact,\n ): Promise<ArtifactPublishedResponse> {\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_publish', {\n pathParams: { id },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ArtifactPublishedResponse\n }\n\n /**\n * Save an artifact edition from a conversation.\n *\n * **Requires:** `context:write`\n *\n * @param id - Artifact ID.\n * @param input - Request body; see `SaveArtifactEdition`.\n *\n * @example\n * await mgmt.context.artifacts.saveEdition(\"ID\", {\"threadId\": \"thread-id\", \"filePath\": \"reports/weekly.html\", \"previewSha256\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"expectedRevision\": \"expected-revision\"})\n */\n async saveEdition(\n id: string,\n input: SaveArtifactEdition,\n ): Promise<ArtifactEditionSavedResponse> {\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_saveEdition', {\n pathParams: { id },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ArtifactEditionSavedResponse\n }\n\n /**\n * Move an artifact to a folder.\n *\n * **Requires:** `context:write`\n *\n * @param kind - Artifact kind.\n * @param id - Artifact ID.\n * @param input - Request body; see `PlaceArtifact`.\n *\n * @example\n * await mgmt.context.artifacts.move(\"dashboard\", \"ID\", {\"folderId\": \"00000000-0000-4000-a000-000000000001\"})\n */\n async move(\n kind: string,\n id: string,\n input: PlaceArtifact,\n ): Promise<void> {\n validateId(kind, 'kind')\n validateId(id, 'id')\n await invokeWithRetry(this.config, this.http, 'ArtifactsController_place', {\n pathParams: { kind, id },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n }\n\n /**\n * Create an artifact folder.\n *\n * **Requires:** `context:write`\n *\n * @param input - Request body; see `CreateArtifactFolder`.\n *\n * @example\n * await mgmt.context.artifacts.createFolder({\"name\": \"Weekly report\"})\n */\n async createFolder(input: CreateArtifactFolder): Promise<ArtifactFolderResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactsController_createFolder', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ArtifactFolderResponse\n }\n\n /**\n * Delete an artifact folder.\n *\n * **Requires:** `context:write`\n *\n * @param folderId - Artifact folder ID.\n *\n * @example\n * await mgmt.context.artifacts.deleteFolder(\"FOLDER_ID\")\n */\n async deleteFolder(folderId: string): Promise<void> {\n validateId(folderId, 'folder_id')\n await invokeWithRetry(this.config, this.http, 'ArtifactsController_deleteFolder', {\n pathParams: { folderId },\n })\n }\n\n /**\n * Delete an artifact.\n *\n * **Requires:** `context:write`\n *\n * @param kind - Artifact kind.\n * @param id - Artifact ID.\n *\n * @example\n * await mgmt.context.artifacts.delete(\"dashboard\", \"ID\")\n */\n async delete(\n kind: string,\n id: string,\n ): Promise<void> {\n validateId(kind, 'kind')\n validateId(id, 'id')\n await invokeWithRetry(this.config, this.http, 'ArtifactsController_delete', {\n pathParams: { kind, id },\n })\n }\n\n /**\n * Get a published file.\n *\n * Returns a published artifact by name. Access is limited to users who can use the scope that\n * published the file.\n *\n * **Requires:** `scopes:read`\n *\n * @param name - Published display name.\n *\n * @example\n * await mgmt.context.artifacts.getPublishedFile(\"NAME\")\n */\n async getPublishedFile(name: string): Promise<PublishedArtifactDownload> {\n validateId(name, 'name')\n const data = await invokeWithRetry(this.config, this.http, 'PublishedArtifactsController_get', {\n pathParams: { name },\n })\n return data as PublishedArtifactDownload\n }\n\n /**\n * List published files for a scope.\n *\n * Returns published artifacts owned by the given scope.\n *\n * **Requires:** `scopes:read`\n *\n * @param scopeId - Numeric scope id.\n *\n * @example\n * await mgmt.context.artifacts.listScopePublishedFiles(42)\n */\n async listScopePublishedFiles(scopeId: number | string): Promise<PublishedArtifactListResponse> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopePublishedArtifactsController_list', {\n pathParams: { id: scopeId },\n })\n return data as PublishedArtifactListResponse\n }\n\n /**\n * Unpublish a file for a scope.\n *\n * Removes a published artifact by name for the given scope.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n * @param name - Published display name.\n *\n * @example\n * await mgmt.context.artifacts.unpublishScopeFile(42, \"NAME\")\n */\n async unpublishScopeFile(\n scopeId: number | string,\n name: string,\n ): Promise<void> {\n validateId(scopeId, 'scope_id')\n validateId(name, 'name')\n await invokeWithRetry(this.config, this.http, 'ScopePublishedArtifactsController_unpublish', {\n pathParams: { id: scopeId, name },\n })\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type {\n ArtifactCommentCountsResponse,\n ArtifactCommentThreadIdResponse,\n ArtifactCommentThreadResponse,\n Message,\n NewThread,\n UpdateThread,\n} from '../../../../types/context-operations.js'\n\n/** Generated base for the management `context.artifactComments` resource. */\nexport class ContextArtifactCommentsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List artifact comment threads.\n *\n * **Requires:** `context:read`\n *\n * @param id - Artifact ID.\n *\n * @example\n * await mgmt.context.artifactComments.list(\"dashboard\", \"ID\")\n */\n async list(\n kind: string,\n id: string,\n ): Promise<ArtifactCommentThreadResponse[]> {\n validateId(kind, 'kind')\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactCommentsController_list', {\n pathParams: { kind, id },\n })\n return data as ArtifactCommentThreadResponse[]\n }\n\n /**\n * Get artifact comment counts.\n *\n * **Requires:** `context:read`\n *\n * @param id - Artifact ID.\n *\n * @example\n * await mgmt.context.artifactComments.getCounts(\"dashboard\", \"ID\")\n */\n async getCounts(\n kind: string,\n id: string,\n ): Promise<ArtifactCommentCountsResponse> {\n validateId(kind, 'kind')\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactCommentsController_counts', {\n pathParams: { kind, id },\n })\n return data as ArtifactCommentCountsResponse\n }\n\n /**\n * Add an artifact comment.\n *\n * **Requires:** `context:write`\n *\n * @param id - Artifact ID.\n * @param input - Request body; see `NewThread`.\n *\n * @example\n * await mgmt.context.artifactComments.create(\"dashboard\", \"ID\", {\"requestId\": \"65fe8d02-3bb0-41d4-980a-10dc9ebbc6ba\", \"body\": \"Please review this report.\", \"mentions\": []})\n */\n async create(\n kind: string,\n id: string,\n input: NewThread,\n ): Promise<ArtifactCommentThreadIdResponse> {\n validateId(kind, 'kind')\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactCommentsController_create', {\n pathParams: { kind, id },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ArtifactCommentThreadIdResponse\n }\n\n /**\n * Reply to an artifact comment thread.\n *\n * **Requires:** `context:write`\n *\n * @param id - Artifact ID.\n * @param threadId - Comment thread ID.\n * @param input - Request body; see `Message`.\n *\n * @example\n * await mgmt.context.artifactComments.reply(\"dashboard\", \"ID\", \"THREAD_ID\", {\"requestId\": \"65fe8d02-3bb0-41d4-980a-10dc9ebbc6ba\", \"body\": \"Please review this report.\", \"mentions\": []})\n */\n async reply(\n kind: string,\n id: string,\n threadId: string,\n input: Message,\n ): Promise<ArtifactCommentThreadIdResponse> {\n validateId(kind, 'kind')\n validateId(id, 'id')\n validateId(threadId, 'thread_id')\n const data = await invokeWithRetry(this.config, this.http, 'ArtifactCommentsController_reply', {\n pathParams: { kind, id, threadId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ArtifactCommentThreadIdResponse\n }\n\n /**\n * Update an artifact comment thread.\n *\n * **Requires:** `context:write`\n *\n * @param id - Artifact ID.\n * @param threadId - Comment thread ID.\n * @param input - Request body; see `UpdateThread`.\n *\n * @example\n * await mgmt.context.artifactComments.update(\"dashboard\", \"ID\", \"THREAD_ID\", {})\n */\n async update(\n kind: string,\n id: string,\n threadId: string,\n input: UpdateThread,\n ): Promise<void> {\n validateId(kind, 'kind')\n validateId(id, 'id')\n validateId(threadId, 'thread_id')\n await invokeWithRetry(this.config, this.http, 'ArtifactCommentsController_update', {\n pathParams: { kind, id, threadId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type {\n CreateDashboardAlert,\n DashboardAlertRecipientOptionResponse,\n DashboardAlertResponse,\n ListDashboardAlertsResponse,\n UpdateDashboardAlert,\n} from '../../../../types/context-operations.js'\n\n/** Generated base for the management `context.dashboardAlerts` resource. */\nexport class ContextDashboardAlertsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List dashboard alerts.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard ID.\n *\n * @example\n * await mgmt.context.dashboardAlerts.list(\"DASHBOARD_ID\")\n */\n async list(dashboardId: string): Promise<ListDashboardAlertsResponse> {\n validateId(dashboardId, 'dashboard_id')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardAlertsController_list', {\n pathParams: { dashboardId },\n })\n return data as ListDashboardAlertsResponse\n }\n\n /**\n * List eligible dashboard alert recipients.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard ID.\n *\n * @example\n * await mgmt.context.dashboardAlerts.listRecipients(\"DASHBOARD_ID\")\n */\n async listRecipients(\n dashboardId: string,\n options: { q?: string } = {},\n ): Promise<DashboardAlertRecipientOptionResponse[]> {\n validateId(dashboardId, 'dashboard_id')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardAlertsController_recipientOptions', {\n pathParams: { dashboardId },\n query: { q: options.q },\n })\n return data as DashboardAlertRecipientOptionResponse[]\n }\n\n /**\n * Create a dashboard alert.\n *\n * **Requires:** `context:read`, `workflows:invoke`\n *\n * @param dashboardId - Dashboard ID.\n * @param input - Request body; see `CreateDashboardAlert`.\n *\n * @example\n * await mgmt.context.dashboardAlerts.create(\"DASHBOARD_ID\", {\"tileId\": \"tile-id\", \"name\": \"Weekly report\", \"operator\": \"above\", \"threshold\": 1, \"schedule\": {\"frequency\": \"hourly\", \"time_of_day\": \"09:00\", \"timezone\": \"UTC\"}, \"recipientUserIds\": [\"user_123\"]})\n */\n async create(\n dashboardId: string,\n input: CreateDashboardAlert,\n ): Promise<DashboardAlertResponse> {\n validateId(dashboardId, 'dashboard_id')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardAlertsController_create', {\n pathParams: { dashboardId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as DashboardAlertResponse\n }\n\n /**\n * Update a dashboard alert.\n *\n * **Requires:** `context:read`, `workflows:invoke`\n *\n * @param dashboardId - Dashboard ID.\n * @param workflowId - Workflow ID of the alert.\n * @param input - Request body; see `UpdateDashboardAlert`.\n *\n * @example\n * await mgmt.context.dashboardAlerts.update(\"DASHBOARD_ID\", 42, {})\n */\n async update(\n dashboardId: string,\n workflowId: number | string,\n input: UpdateDashboardAlert,\n ): Promise<DashboardAlertResponse> {\n validateId(dashboardId, 'dashboard_id')\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardAlertsController_update', {\n pathParams: { dashboardId, automationId: workflowId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as DashboardAlertResponse\n }\n\n /**\n * Delete a dashboard alert.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard ID.\n * @param workflowId - Workflow ID of the alert.\n *\n * @example\n * await mgmt.context.dashboardAlerts.delete(\"DASHBOARD_ID\", 42)\n */\n async delete(\n dashboardId: string,\n workflowId: number | string,\n ): Promise<void> {\n validateId(dashboardId, 'dashboard_id')\n validateId(workflowId, 'workflow_id')\n await invokeWithRetry(this.config, this.http, 'DashboardAlertsController_remove', {\n pathParams: { dashboardId, automationId: workflowId },\n })\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry } from '../../../../_request.js'\nimport type {\n ContextGraphNodeRelationsResponse,\n ContextGraphViewResponse,\n} from '../../../../types/context-operations.js'\n\n/** Generated base for the management `context.graph` resource. */\nexport class ContextGraphResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * Get relations for a Context graph node.\n *\n * **Requires:** `context:read`\n *\n * @example\n * await mgmt.context.graph.getNodeRelations({ uid: \"ITEM_ID\" })\n */\n async getNodeRelations(options: { uid: string; includeEntities?: boolean }): Promise<ContextGraphNodeRelationsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextGraphController_getNodeRelations', {\n query: { uid: options.uid, includeEntities: options.includeEntities },\n })\n return data as ContextGraphNodeRelationsResponse\n }\n\n /**\n * Get a filtered Context graph.\n *\n * **Requires:** `context:read`\n *\n * @example\n * await mgmt.context.graph.get()\n */\n async get(options: { platforms?: readonly string[]; objectTypes?: readonly string[]; relationshipTypes?: readonly string[]; entityTypes?: readonly string[]; includeEntities?: boolean; includeFacets?: boolean; nodeLimit?: number } = {}): Promise<ContextGraphViewResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextGraphController_getGraph', {\n query: { platforms: options.platforms, objectTypes: options.objectTypes, relationshipTypes: options.relationshipTypes, entityTypes: options.entityTypes, includeEntities: options.includeEntities, includeFacets: options.includeFacets, nodeLimit: options.nodeLimit },\n })\n return data as ContextGraphViewResponse\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type {\n CreateOrgLearning,\n ListOrgLearningsResponse,\n OrgLearningUidResponse,\n UpdateOrgLearning,\n} from '../../../../types/context-operations.js'\n\n/** Generated base for the management `context.orgLearnings` resource. */\nexport class ContextOrgLearningsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List organization learnings.\n *\n * **Requires:** `context:read`\n *\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @param options.pageSize - Max items per page. Defaults to 25. Must be between 1 and 200.\n *\n * @example\n * await mgmt.context.orgLearnings.list()\n */\n async list(options: { pageToken?: string; pageSize?: number } = {}): Promise<ListOrgLearningsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'OrgLearningsController_list', {\n query: { pageToken: options.pageToken, pageSize: options.pageSize },\n })\n return data as ListOrgLearningsResponse\n }\n\n /**\n * Create an organization learning.\n *\n * **Requires:** `context:write`\n *\n * @param input - Request body; see `CreateOrgLearning`.\n *\n * @example\n * await mgmt.context.orgLearnings.create({\"learningType\": \"glossary\", \"text\": \"text\"})\n */\n async create(input: CreateOrgLearning): Promise<OrgLearningUidResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'OrgLearningsController_create', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as OrgLearningUidResponse\n }\n\n /**\n * Update an organization learning.\n *\n * **Requires:** `context:write`\n *\n * @param uid - Organization learning ID.\n * @param input - Request body; see `UpdateOrgLearning`.\n *\n * @example\n * await mgmt.context.orgLearnings.update(\"UID\", {})\n */\n async update(\n uid: string,\n input: UpdateOrgLearning,\n ): Promise<OrgLearningUidResponse> {\n validateId(uid, 'uid')\n const data = await invokeWithRetry(this.config, this.http, 'OrgLearningsController_update', {\n pathParams: { uid },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as OrgLearningUidResponse\n }\n\n /**\n * Delete an organization learning.\n *\n * **Requires:** `context:write`\n *\n * @param uid - Organization learning ID.\n *\n * @example\n * await mgmt.context.orgLearnings.delete(\"UID\")\n */\n async delete(uid: string): Promise<OrgLearningUidResponse> {\n validateId(uid, 'uid')\n const data = await invokeWithRetry(this.config, this.http, 'OrgLearningsController_retire', {\n pathParams: { uid },\n })\n return data as OrgLearningUidResponse\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type {\n BatchGetContextItemsRequest,\n BatchGetContextItemsResponse,\n ClearConnectionErrors,\n ClearContextItemErrors,\n ClearItemErrorsResponse,\n CoverageNodeItemsResponse,\n CoverageRefreshResponse,\n CoverageReportsResponse,\n DashboardSummaryResponse,\n DataAssetsResponse,\n EditCountsResponse,\n FilterCountsResponse,\n ImagePreviewResponse,\n ListContextItemsResponse,\n NewActivityResponse,\n RawObjectResponse,\n RequestRescanBody,\n RescanRequestedResponse,\n RescanStatusResponse,\n SearchContextEntitiesRequest,\n SearchContextEntitiesResponse,\n SearchContextItemsRequest,\n TimeQuantilesResponse,\n UsageTopResponse,\n} from '../../../../types/context-operations.js'\n\n/** Generated base for the management `context.reporting` resource. */\nexport class ContextReportingResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * Get the Context dashboard summary.\n *\n * Aggregated totals + sunburst chart data + topic facets for the org-wide context dashboard. Pass\n * a section to request one part at a time.\n *\n * **Requires:** `context:read`\n *\n * @param options.includeSunburstBuckets - When true, includes the raw sunburst bucket array in\n * the response. Defaults to false.\n * @param options.section - Returns only one independently rendered dashboard section.\n * @returns Aggregated dashboard payload.\n *\n * @example\n * await mgmt.context.reporting.getSummary()\n */\n async getSummary(options: { includeSunburstBuckets?: boolean; section?: string } = {}): Promise<DashboardSummaryResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextReportingController_dashboardSummary', {\n query: { includeSunburstBuckets: options.includeSunburstBuckets, section: options.section },\n })\n return data as DashboardSummaryResponse\n }\n\n /**\n * List Context coverage reports.\n *\n * Walks the datamap object-type hierarchy and returns one funnel-style coverage card per\n * connection. Each contextType listed shows aggregated (expected, persisted, errored) counts.\n *\n * **Requires:** `context:read`\n *\n * @returns Array of per-connection coverage reports.\n *\n * @example\n * await mgmt.context.reporting.listCoverage()\n */\n async listCoverage(): Promise<CoverageReportsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextReportingController_coverageReports')\n return data as CoverageReportsResponse\n }\n\n /**\n * Refresh coverage for a connection.\n *\n * Requests fresh coverage counts for the selected connection.\n *\n * **Requires:** `context:write`\n *\n * @returns Handle for the requested refresh.\n *\n * @example\n * await mgmt.context.reporting.refreshCoverage(\"CONNECTION_ID\", { integrationType: \"postgres\" })\n */\n async refreshCoverage(\n connectionId: string,\n options: { integrationType: string },\n ): Promise<CoverageRefreshResponse> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ContextReportingController_triggerCoverageRefresh', {\n pathParams: { connectionId },\n query: { integrationType: options.integrationType },\n })\n return data as CoverageRefreshResponse\n }\n\n /**\n * Rescan a Context item.\n *\n * Queues a fresh scan of the item and everything under it. Returns a conflict if a rescan already\n * covers the item.\n *\n * **Requires:** `context:write`\n *\n * @param input - Request body; see `RequestRescanBody`.\n * @returns The started rescan: `id` names the mining workflow that runs it.\n *\n * @example\n * await mgmt.context.reporting.requestRescan({\"contextItemUid\": \"context-item-uid\"})\n */\n async requestRescan(input: RequestRescanBody): Promise<RescanRequestedResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextReportingController_requestRescan', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as RescanRequestedResponse\n }\n\n /**\n * Get the rescan status of a Context item.\n *\n * Whether a rescan can start from the item, the queued or running rescan that already re-mines it\n * with its progress, and the latest finished one with its final counts.\n *\n * **Requires:** `context:read`\n *\n * @param options.contextItemUid - Context item whose rescan state is reported.\n * @returns Rescan support and the covering rescan, if any.\n *\n * @example\n * await mgmt.context.reporting.getRescanStatus({ contextItemUid: \"context-item-uid\" })\n */\n async getRescanStatus(options: { contextItemUid: string }): Promise<RescanStatusResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextReportingController_rescanStatus', {\n query: { contextItemUid: options.contextItemUid },\n })\n return data as RescanStatusResponse\n }\n\n /**\n * List items for a Context coverage node.\n *\n * Drill-down for a single coverage funnel row — returns paginated items in the requested mode\n * (`existing` / `missing` / `stale` / `errored`). Use `connectionId`, `contextType`, and\n * `childIdentityField` to select the coverage row.\n *\n * **Requires:** `context:read`\n *\n * @param nodeId - Opaque coverage-node identifier used for URL grouping.\n * @param options.connectionId - Connection id the coverage report is rooted at.\n * @param options.contextType - Context type the coverage row belongs to.\n * @param options.childIdentityField - Field on the child object that identifies the row (e.g.\n * `Id`, `email`).\n * @param options.mode - Mode: `existing` (default), `missing`, `stale`, or `errored`.\n * @param options.topLevelObjectTypeId - Top-level object-type id (when applicable).\n * @param options.cursor - Opaque cursor for the next page.\n * @param options.limit - Max items per page.\n * @returns Paginated drill-down rows.\n *\n * @example\n * await mgmt.context.reporting.listCoverageItems(\"NODE_ID\", { connectionId: \"connection-id\", contextType: \"postgres_table\", childIdentityField: \"child-identity-field\" })\n */\n async listCoverageItems(\n nodeId: string,\n options: { connectionId: string; contextType: string; childIdentityField: string; mode?: string; topLevelObjectTypeId?: string; cursor?: string; limit?: number },\n ): Promise<CoverageNodeItemsResponse> {\n validateId(nodeId, 'node_id')\n const data = await invokeWithRetry(this.config, this.http, 'ContextReportingController_coverageNodeItems', {\n pathParams: { nodeId },\n query: { connectionId: options.connectionId, contextType: options.contextType, childIdentityField: options.childIdentityField, mode: options.mode, topLevelObjectTypeId: options.topLevelObjectTypeId, cursor: options.cursor, limit: options.limit },\n })\n return data as CoverageNodeItemsResponse\n }\n\n /**\n * Get Context edit counts by editor.\n *\n * Returns the count of manual edits per editor (resolved from the\n * `last_update_metadata.editedByEmail` / `editedByName` audit fields). Used by the dashboard\n * sidebar to render the editors filter list.\n *\n * **Requires:** `context:read`\n *\n * @returns Editor counts.\n *\n * @example\n * await mgmt.context.reporting.getEditCounts()\n */\n async getEditCounts(): Promise<EditCountsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextReportingController_userEditCounts')\n return data as EditCountsResponse\n }\n\n /**\n * Get Context update-age quantiles.\n *\n * Computes 25th/50th/75th percentile of context-item `updated_at` age (last 90 days). The values\n * are expressed in seconds.\n *\n * **Requires:** `context:read`\n *\n * @returns Quantile triple or null when there are no recent items.\n *\n * @example\n * await mgmt.context.reporting.getTimeQuantiles()\n */\n async getTimeQuantiles(): Promise<TimeQuantilesResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextReportingController_timeQuantiles')\n return data as TimeQuantilesResponse\n }\n\n /**\n * Get filtered Context facet counts.\n *\n * Returns requested dashboard facet counts with cross-filtering applied (each facet count\n * reflects the *other* selected filters). Omitting `facets` returns every family.\n *\n * **Requires:** `context:read`\n *\n * @param options.dataAssets - URL-encoded JSON array of `{ connection_id, path?, database?,\n * schema? }`. Used to cross-filter facet counts by selected data assets.\n * @param options.timeBucket - URL-encoded JSON `{ lowerHours, upperHours }`. `upperHours: null`\n * for open-ended.\n * @param options.createdWithinHours - Count only items created in the last N hours.\n * @returns Facet counts for the dashboard sidebar.\n *\n * @example\n * await mgmt.context.reporting.getFilterCounts()\n */\n async getFilterCounts(options: { facets?: readonly string[]; contextTypes?: readonly string[]; verificationStatuses?: readonly string[]; updateSources?: readonly string[]; userId?: string; topics?: readonly string[]; topicLimit?: number; topicOffset?: number; topicSearch?: string; dataAssets?: string; timeBucket?: string; createdWithinHours?: number; sensitiveInfoTypes?: readonly string[]; sensitiveInfoTypeLimit?: number; sensitiveInfoTypeOffset?: number; sensitiveInfoTypeSearch?: string } = {}): Promise<FilterCountsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextReportingController_filterCounts', {\n query: { facets: options.facets, contextTypes: options.contextTypes, verificationStatuses: options.verificationStatuses, updateSources: options.updateSources, userId: options.userId, topics: options.topics, topicLimit: options.topicLimit, topicOffset: options.topicOffset, topicSearch: options.topicSearch, dataAssets: options.dataAssets, timeBucket: options.timeBucket, createdWithinHours: options.createdWithinHours, sensitiveInfoTypes: options.sensitiveInfoTypes, sensitiveInfoTypeLimit: options.sensitiveInfoTypeLimit, sensitiveInfoTypeOffset: options.sensitiveInfoTypeOffset, sensitiveInfoTypeSearch: options.sensitiveInfoTypeSearch },\n })\n return data as FilterCountsResponse\n }\n\n /**\n * List Context data assets.\n *\n * Returns connection summaries plus a paginated slice of asset rows in the requested category.\n * Pass a category or connection to narrow the result.\n *\n * **Requires:** `context:read`\n *\n * @param options.category - Limit results to one platform category (e.g. `salesforce`).\n * @param options.connectionId - Limit results to one specific connection (UUID).\n * @param options.search - Case-insensitive substring search over display_name or path.\n * @param options.timeBucket - URL-encoded JSON `{ lowerHours, upperHours }`. `upperHours: null`\n * for open-ended.\n * @returns Paginated data asset entries.\n *\n * @example\n * await mgmt.context.reporting.listDataAssets()\n */\n async listDataAssets(options: { category?: string; connectionId?: string; limit?: number; offset?: number; search?: string; contextTypes?: readonly string[]; verificationStatuses?: readonly string[]; updateSources?: readonly string[]; userId?: string; topics?: readonly string[]; timeBucket?: string; sensitiveInfoTypes?: readonly string[] } = {}): Promise<DataAssetsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextReportingController_dataAssets', {\n query: { category: options.category, connectionId: options.connectionId, limit: options.limit, offset: options.offset, search: options.search, contextTypes: options.contextTypes, verificationStatuses: options.verificationStatuses, updateSources: options.updateSources, userId: options.userId, topics: options.topics, timeBucket: options.timeBucket, sensitiveInfoTypes: options.sensitiveInfoTypes },\n })\n return data as DataAssetsResponse\n }\n\n /**\n * Get a Context item image preview URL.\n *\n * **Requires:** `context:read`\n *\n * @param uid - Context item ID.\n *\n * @example\n * await mgmt.context.reporting.getImagePreview(\"UID\")\n */\n async getImagePreview(uid: string): Promise<ImagePreviewResponse> {\n validateId(uid, 'uid')\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_imagePreview', {\n pathParams: { uid },\n })\n return data as ImagePreviewResponse\n }\n\n /**\n * Get a Context item attachment.\n *\n * Returns the UTF-8 content of an attachment referenced by a readable Context item. Pass the item\n * ID and the attachment key.\n *\n * **Requires:** `context:read`\n *\n * @param options.uid - UUID of the context item whose body this key holds.\n * @param options.s3Key - Tenant-scoped S3 key (forwarded verbatim to the storage helper).\n *\n * @example\n * await mgmt.context.reporting.getItemAttachment({ uid: \"7a3f9d2c-1111-4000-a000-000000000abc\", s3Key: \"notes/abc-123/content.md\" })\n */\n async getItemAttachment(options: { uid: string; s3Key: string }): Promise<RawObjectResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_rawObject', {\n query: { uid: options.uid, s3Key: options.s3Key },\n })\n return data as RawObjectResponse\n }\n\n /**\n * Get Context items by their IDs.\n *\n * Returns context items for the supplied UIDs in request order. Missing or inaccessible items are\n * omitted.\n *\n * **Requires:** `context:read`\n *\n * @param input - Request body; see `BatchGetContextItemsRequest`.\n *\n * @example\n * await mgmt.context.reporting.batchGetItems({\"uids\": [\"7a3f9d2c-1111-4000-a000-000000000abc\", \"8b4c1f3d-2222-4000-a000-000000000def\"]})\n */\n async batchGetItems(input: BatchGetContextItemsRequest): Promise<BatchGetContextItemsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_batchGet', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as BatchGetContextItemsResponse\n }\n\n /**\n * Search Context items.\n *\n * Search with a recursive AND/OR filter using `queryStructure`, `listDataAssets`,\n * `updateSources`, `userId`, `timeBucket`, and `fromEnd`.\n *\n * **Requires:** `context:read`\n *\n * @param input - Request body; see `SearchContextItemsRequest`.\n *\n * @example\n * await mgmt.context.reporting.searchItems({})\n */\n async searchItems(input: SearchContextItemsRequest): Promise<ListContextItemsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_search', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ListContextItemsResponse\n }\n\n /**\n * Search Context entities.\n *\n * Returns matching integration entities such as tables and channels, plus standalone items such\n * as notes and files. `mode: 'picker'` drives a lazy asset tree instead, with `childCount` and\n * keyset/offset `nextPageToken` paging.\n *\n * **Requires:** `context:read`\n *\n * @param input - Request body; see `SearchContextEntitiesRequest`.\n *\n * @example\n * await mgmt.context.reporting.searchEntities({})\n */\n async searchEntities(input: SearchContextEntitiesRequest): Promise<SearchContextEntitiesResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_searchEntities', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as SearchContextEntitiesResponse\n }\n\n /**\n * Clear a group of Context item errors.\n *\n * Clears the errors of one context-type partition across the organization. To clear one\n * connection or one row, use the connection route.\n *\n * **Requires:** `context:write`\n *\n * @param input - Request body; see `ClearContextItemErrors`.\n *\n * @example\n * await mgmt.context.reporting.clearItemErrors({\"contextType\": \"salesforce_object_field\"})\n */\n async clearItemErrors(input: ClearContextItemErrors): Promise<ClearItemErrorsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_clearErrors', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ClearItemErrorsResponse\n }\n\n /**\n * Clear the Context item errors of a connection.\n *\n * Clears the errors of one context-type partition for the connection, or of one row when\n * `dataPath` is given.\n *\n * **Requires:** `context:write`\n *\n * @param connectionId - Connection ID.\n * @param input - Request body; see `ClearConnectionErrors`.\n *\n * @example\n * await mgmt.context.reporting.clearConnectionErrors(\"CONNECTION_ID\", {\"contextType\": \"salesforce_object_field\"})\n */\n async clearConnectionErrors(\n connectionId: string,\n input: ClearConnectionErrors,\n ): Promise<ClearItemErrorsResponse> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_clearConnectionErrors', {\n pathParams: { connectionId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as ClearItemErrorsResponse\n }\n\n /**\n * Get recent Context activity.\n *\n * **Requires:** `context:read`\n *\n * @example\n * await mgmt.context.reporting.getNewActivity({ days: 7 })\n */\n async getNewActivity(options: { days: number }): Promise<NewActivityResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextActivityController_getNew', {\n query: { days: options.days },\n })\n return data as NewActivityResponse\n }\n\n /**\n * Get the most-used Context items.\n *\n * **Requires:** `context:read`\n *\n * @example\n * await mgmt.context.reporting.getTopUsage({ days: 7 })\n */\n async getTopUsage(options: { days: number; limit?: number }): Promise<UsageTopResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextUsageController_getTop', {\n query: { days: options.days, limit: options.limit },\n })\n return data as UsageTopResponse\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../../_pagination.js'\nimport { asRecord, invokeWithRetry } from '../../../../_request.js'\nimport { validateId, validatePageSize } from '../../../../_validation.js'\nimport type {\n ApproveSuggestion,\n ContextSuggestion,\n ContextSuggestionResolution,\n ContextSuggestionUndo,\n} from '../../../../management/types/context-suggestions.js'\n\n/** Generated base for the management `context.suggestions` resource. */\nexport class ContextSuggestionsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List context suggestions.\n *\n * Returns prioritized context suggestions visible to the caller.\n *\n * **Requires:** `context:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque token from the previous suggestion page's nextPageToken. Omit\n * for the first page.\n * @returns A page of suggestions.\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n } = {}): Promise<Page<ContextSuggestion>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize, 200)\n return this.listPage(pageSize, options.pageToken)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n ): Promise<Page<ContextSuggestion>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextSuggestionsController_list', {\n query: aipListParams(pageSize, pageToken) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'suggestions',\n (raw) => raw as ContextSuggestion,\n (token) => this.listPage(pageSize, token),\n )\n }\n\n /**\n * Approve a context suggestion.\n *\n * Applies the selected resolution option to the context items the caller can manage.\n *\n * **Requires:** `context:write`\n *\n * @param request - Request body; see `ApproveSuggestion`.\n */\n async approve(\n id: string,\n request: ApproveSuggestion,\n ): Promise<ContextSuggestionResolution> {\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ContextSuggestionsController_approve', {\n pathParams: { id },\n jsonBody: request,\n })\n return data as ContextSuggestionResolution\n }\n\n /**\n * Dismiss a context suggestion.\n *\n * Dismisses an open suggestion visible to the caller.\n *\n * **Requires:** `context:write`\n */\n async dismiss(id: string): Promise<ContextSuggestionResolution> {\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ContextSuggestionsController_dismiss', {\n pathParams: { id },\n })\n return data as ContextSuggestionResolution\n }\n\n /**\n * Undo a resolution and reopen the suggestion.\n *\n * Undoes the resolution and returns the identifier of the reopened suggestion.\n *\n * **Requires:** `context:write`\n */\n async undo(id: string): Promise<ContextSuggestionUndo> {\n validateId(id, 'id')\n const data = await invokeWithRetry(this.config, this.http, 'ContextSuggestionsController_undo', {\n pathParams: { id },\n })\n return data as ContextSuggestionUndo\n }\n}\n","import type { components } from '../_generated/v1.js'\n\nexport type ContextItem = components['schemas']['ContextItemDto']\nexport type ContextItemAncestor = components['schemas']['ContextItemAncestorDto']\nexport type ContextItemLookupRow = components['schemas']['LookupContextItemRowDto']\nexport type ContextItemsQuery = components['schemas']['QueryContextItemsRequestDto']\nexport type ContextItemsQueryResult = components['schemas']['QueryContextItemsResponseDto']\nexport type ContextItemDeletion = components['schemas']['DeleteContextItemResponseDto']\nexport type ContextItemMove = components['schemas']['MoveContextItemResponseDto']\n/** Input for `updateAccess()`; all three settings replace the current ones. */\nexport type UpdateContextItemAccessInput = components['schemas']['UpdateContextItemAccessDto']\n/** Who can view and manage an item after `updateAccess()`. */\nexport type ContextItemAccessUpdate = components['schemas']['ContextItemAccessResponseDto']\n/** Create response; ``uid`` mirrors ``contextItemId`` for list/get parity. */\nexport type CreatedContextItem = components['schemas']['CreatedContextItemResponseDto'] & {\n uid: string\n}\nexport type ContextType = string\n\nexport function withCreatedUid(\n data: components['schemas']['CreatedContextItemResponseDto'],\n): CreatedContextItem {\n return { ...data, uid: data.contextItemId }\n}\n","import { ValidationError } from '../../_exceptions.js'\nimport type { ContextItem } from '../../types/context.js'\nimport type { ManagementContextItemsResource } from './items.js'\n\nexport type UserFeedback = 'positive' | 'neutral' | 'negative'\n\nfunction requireContentDict(item: ContextItem, contextType: string): Record<string, unknown> {\n if (item.contextType !== contextType) {\n throw new ValidationError(`Expected contextType ${contextType}, got ${item.contextType}.`)\n }\n if (!item.content || typeof item.content !== 'object' || Array.isArray(item.content)) {\n throw new ValidationError(`Context item ${item.uid} has no object content; cannot merge ${contextType} fields.`)\n }\n return item.content as Record<string, unknown>\n}\n\nexport function mergeNoteContent(\n existing: Record<string, unknown>,\n options: { title: string; body: string },\n): Record<string, unknown> {\n return { ...existing, title: options.title, content: options.body }\n}\n\nexport function mergeLinkContent(\n existing: Record<string, unknown>,\n options: { title?: string; url?: string },\n): Record<string, unknown> {\n const merged = { ...existing }\n if (options.title !== undefined) merged.title = options.title\n if (options.url !== undefined) merged.url = options.url\n return merged\n}\n\nexport function mergeSavedQueryContent(\n existing: Record<string, unknown>,\n options: {\n name: string\n query: string\n connectionId?: string\n path?: string[]\n },\n): Record<string, unknown> {\n const merged: Record<string, unknown> = { ...existing, name: options.name, query: options.query }\n if (options.connectionId !== undefined) merged.connectionId = options.connectionId\n if (options.path !== undefined) merged.path = options.path\n return merged\n}\n\nasync function resolveExistingContent(\n items: ManagementContextItemsResource,\n uid: string,\n contextType: string,\n existing?: ContextItem,\n): Promise<Record<string, unknown>> {\n const item = existing ?? (await items.get(uid))\n return requireContentDict(item, contextType)\n}\n\nexport async function updateWithMergedContent(\n items: ManagementContextItemsResource,\n uid: string,\n options: {\n contextType: string\n mergedContent: Record<string, unknown>\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n): Promise<ContextItem> {\n if (options.existing) requireContentDict(options.existing, options.contextType)\n return items.update(uid, {\n contextType: options.contextType,\n content: options.mergedContent,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\n}\n\nexport async function resolveAndUpdateNote(\n items: ManagementContextItemsResource,\n uid: string,\n options: {\n title: string\n body: string\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n): Promise<ContextItem> {\n const content = await resolveExistingContent(items, uid, 'note', options.existing)\n return updateWithMergedContent(items, uid, {\n contextType: 'note',\n mergedContent: mergeNoteContent(content, { title: options.title, body: options.body }),\n existing: options.existing,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\n}\n\nexport async function resolveAndUpdateSavedQuery(\n items: ManagementContextItemsResource,\n uid: string,\n options: {\n name: string\n query: string\n connectionId?: string\n path?: string[]\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n): Promise<ContextItem> {\n const content = await resolveExistingContent(items, uid, 'saved_query', options.existing)\n return updateWithMergedContent(items, uid, {\n contextType: 'saved_query',\n mergedContent: mergeSavedQueryContent(content, options),\n existing: options.existing,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\n}\n\nexport async function resolveAndUpdateLink(\n items: ManagementContextItemsResource,\n uid: string,\n options: {\n title?: string\n url?: string\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n): Promise<ContextItem> {\n if (\n options.title === undefined &&\n options.url === undefined &&\n options.description === undefined &&\n options.userFeedback === undefined &&\n options.topics === undefined\n ) {\n throw new ValidationError('Provide at least one field to update.')\n }\n if (options.title === undefined && options.url === undefined) {\n return items.update(uid, {\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\n }\n const content = await resolveExistingContent(items, uid, 'link', options.existing)\n return updateWithMergedContent(items, uid, {\n contextType: 'link',\n mergedContent: mergeLinkContent(content, { title: options.title, url: options.url }),\n existing: options.existing,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type {\n Dashboard,\n DashboardDraftSnapshot,\n DashboardVersion,\n} from '../../../../types/context-dashboards.js'\nimport type {\n DashboardExecutionCancelledResponse,\n DashboardFilterOptionsResponse,\n DashboardHistoryEntryResponse,\n DashboardTileExecutionResponse,\n EmailDashboard,\n ExecuteDashboardFilterOptions,\n ExecuteDashboardTile,\n} from '../../../../types/context-operations.js'\n\n/** Generated base for the management `context.dashboards` resource. */\nexport class ContextDashboardsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * Delete a dashboard.\n *\n * Removes the dashboard from every listing and deletes its alert workflows. It cannot be restored\n * through the API.\n *\n * **Requires:** `context:write`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * ```ts\n * await mgmt.context.dashboards.delete('DASHBOARD_ID')\n * ```\n */\n async delete(dashboardId: string): Promise<void> {\n validateId(dashboardId, 'dashboardId')\n await invokeWithRetry(this.config, this.http, 'DashboardsController_delete', {\n pathParams: { dashboardId },\n })\n }\n\n /**\n * List dashboard draft snapshots.\n *\n * Returns ids and timestamps of the most recent draft snapshots. Editors only.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * ```ts\n * const snapshots = await mgmt.context.dashboards.listDraftSnapshots('DASHBOARD_ID')\n * snapshots.map((snapshot) => snapshot.uid)\n * ```\n */\n async listDraftSnapshots(dashboardId: string): Promise<DashboardDraftSnapshot[]> {\n validateId(dashboardId, 'dashboardId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_listDraftSnapshots', {\n pathParams: { dashboardId },\n })\n return asRecord(data).snapshots as DashboardDraftSnapshot[]\n }\n\n /**\n * Cancel an ownership transfer.\n *\n * Owner only. Clears the pending transfer and returns the dashboard.\n *\n * **Requires:** `context:write`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * ```ts\n * await mgmt.context.dashboards.cancelOwnershipTransfer('DASHBOARD_ID')\n * ```\n */\n async cancelOwnershipTransfer(dashboardId: string): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_cancelOwnership', {\n pathParams: { dashboardId },\n })\n return asRecord(data) as unknown as Dashboard\n }\n\n /**\n * Accept an ownership transfer.\n *\n * Recipient only. Makes you the owner and clears the pending transfer.\n *\n * **Requires:** `context:write`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * ```ts\n * await mgmt.context.dashboards.acceptOwnershipTransfer('DASHBOARD_ID')\n * ```\n */\n async acceptOwnershipTransfer(dashboardId: string): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_acceptOwnership', {\n pathParams: { dashboardId },\n })\n return asRecord(data) as unknown as Dashboard\n }\n\n /**\n * List dashboard versions.\n *\n * Returns the published versions, newest first, each with its full definition. Draft snapshots\n * are not included. The response is not paginated and can be large.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * ```ts\n * const versions = await mgmt.context.dashboards.listVersions('DASHBOARD_ID')\n * versions.map((version) => [version.uid, version.versionNumber])\n * ```\n */\n async listVersions(dashboardId: string): Promise<DashboardVersion[]> {\n validateId(dashboardId, 'dashboardId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_listVersions', {\n pathParams: { dashboardId },\n })\n return asRecord(data).versions as DashboardVersion[]\n }\n\n /**\n * Get a dashboard version.\n *\n * Returns the dashboard as it was in the given version. For a draft snapshot (editors only) the\n * view is reported as active and selectedVersion.versionNumber is null.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n * @param versionId - Version id, or a draft snapshot id for editors.\n *\n * @example\n * ```ts\n * const old = await mgmt.context.dashboards.getVersion('DASHBOARD_ID', 'VERSION_ID')\n * old.selectedVersion.versionNumber\n * ```\n */\n async getVersion(\n dashboardId: string,\n versionId: string,\n ): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n validateId(versionId, 'versionId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_getVersion', {\n pathParams: { dashboardId, versionId },\n })\n return asRecord(data) as unknown as Dashboard\n }\n\n /**\n * Restore a dashboard version.\n *\n * Replaces the current draft with the content of the given version. The outgoing draft is kept as\n * a draft snapshot. Returns the draft view.\n *\n * **Requires:** `context:write`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n * @param versionId - Version id, or a draft snapshot id for editors.\n *\n * @example\n * ```ts\n * await mgmt.context.dashboards.restoreVersion('DASHBOARD_ID', 'VERSION_ID')\n * ```\n */\n async restoreVersion(\n dashboardId: string,\n versionId: string,\n ): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n validateId(versionId, 'versionId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_restore', {\n pathParams: { dashboardId, versionId },\n })\n return asRecord(data) as unknown as Dashboard\n }\n\n /**\n * List dashboard history.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n *\n * @example\n * await mgmt.context.dashboards.listHistory(\"DASHBOARD_ID\", { kind: \"published\" })\n */\n async listHistory(\n dashboardId: string,\n options: { kind: string },\n ): Promise<DashboardHistoryEntryResponse[]> {\n validateId(dashboardId, 'dashboard_id')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_history', {\n pathParams: { dashboardId },\n query: { kind: options.kind },\n })\n return data as DashboardHistoryEntryResponse[]\n }\n\n /**\n * Email a published dashboard link.\n *\n * **Requires:** `context:write`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n * @param input - Request body; see `EmailDashboard`.\n *\n * @example\n * await mgmt.context.dashboards.email(\"DASHBOARD_ID\", {\"email\": \"member@example.com\", \"requestId\": \"65fe8d02-3bb0-41d4-980a-10dc9ebbc6ba\"})\n */\n async email(\n dashboardId: string,\n input: EmailDashboard,\n ): Promise<void> {\n validateId(dashboardId, 'dashboard_id')\n await invokeWithRetry(this.config, this.http, 'DashboardsController_email', {\n pathParams: { dashboardId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n }\n\n /**\n * Run a dashboard tile.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n * @param input - Request body; see `ExecuteDashboardTile`.\n *\n * @example\n * await mgmt.context.dashboards.executeTile(\"DASHBOARD_ID\", {\"tileId\": \"tile-id\", \"filters\": {}})\n */\n async executeTile(\n dashboardId: string,\n input: ExecuteDashboardTile,\n ): Promise<DashboardTileExecutionResponse> {\n validateId(dashboardId, 'dashboard_id')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_execute', {\n pathParams: { dashboardId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as DashboardTileExecutionResponse\n }\n\n /**\n * Get options for a dashboard filter.\n *\n * **Requires:** `context:read`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n * @param filterId - Dashboard filter ID.\n * @param input - Request body; see `ExecuteDashboardFilterOptions`.\n *\n * @example\n * await mgmt.context.dashboards.getFilterOptions(\"DASHBOARD_ID\", \"FILTER_ID\", {})\n */\n async getFilterOptions(\n dashboardId: string,\n filterId: string,\n input: ExecuteDashboardFilterOptions,\n ): Promise<DashboardFilterOptionsResponse> {\n validateId(dashboardId, 'dashboard_id')\n validateId(filterId, 'filter_id')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_filterOptions', {\n pathParams: { dashboardId, filterId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as DashboardFilterOptionsResponse\n }\n\n /**\n * Cancel a dashboard tile query.\n *\n * **Requires:** `context:write`\n *\n * @param dashboardId - Dashboard id, as shown in the app URL.\n * @param executionId - Execution ID supplied when running the query.\n *\n * @example\n * await mgmt.context.dashboards.cancelExecution(\"DASHBOARD_ID\", \"EXECUTION_ID\")\n */\n async cancelExecution(\n dashboardId: string,\n executionId: string,\n ): Promise<DashboardExecutionCancelledResponse> {\n validateId(dashboardId, 'dashboard_id')\n validateId(executionId, 'execution_id')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_cancelExecution', {\n pathParams: { dashboardId, executionId },\n })\n return data as DashboardExecutionCancelledResponse\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../../_config.js'\nimport type { HttpClient } from '../../../../../_http.js'\nimport { asRecord, invokeWithRetry } from '../../../../../_request.js'\nimport { validateId } from '../../../../../_validation.js'\nimport type {\n DashboardElementResult,\n DashboardElementsList,\n} from '../../../../../types/context-dashboards.js'\n\n/** Generated base for the management `context.dashboards.elements` resource. */\nexport class ContextDashboardsElementsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly dashboardId: number | string,\n ) {}\n\n /**\n * List dashboard elements.\n *\n * Lists tabs and every tile and filter on the dashboard draft with id, kind, title and layout.\n * Filters also carry sqlReferences, the exact templates tile SQL must use to reference them.\n * Returns the current draftRevision.\n *\n * **Requires:** `context:read`\n *\n * @example\n * ```ts\n * const listed = await mgmt.context.dashboards.elements('DASHBOARD_ID').list()\n * listed.elements.map((element) => element.id)\n * ```\n */\n async list(): Promise<DashboardElementsList> {\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_listElements', {\n pathParams: { dashboardId: this.dashboardId },\n })\n return asRecord(data) as unknown as DashboardElementsList\n }\n\n /**\n * Get a dashboard element.\n *\n * Returns the full draft configuration of one dashboard element, including SQL, chart settings\n * and filter options, with the current draftRevision.\n *\n * **Requires:** `context:read`\n *\n * @param elementId - The dashboard element id to read.\n *\n * @example\n * ```ts\n * const result = await mgmt.context.dashboards.elements('DASHBOARD_ID').get('ELEMENT_ID')\n * result.element.title\n * ```\n */\n async get(elementId: string): Promise<DashboardElementResult> {\n validateId(elementId, 'elementId')\n const data = await invokeWithRetry(this.config, this.http, 'DashboardsController_getElement', {\n pathParams: { dashboardId: this.dashboardId, elementId },\n })\n return asRecord(data) as unknown as DashboardElementResult\n }\n}\n","import type { ModusConfig } from '../../_config.js'\nimport { ContextDashboardsResourceBase } from '../../_generated/resources/management/context/dashboards.js'\nimport { ContextDashboardsElementsResourceBase } from '../../_generated/resources/management/context/dashboards/elements.js'\nimport type { HttpClient } from '../../_http.js'\nimport { asRecord, invokeWithRetry } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type {\n CreateDashboardElementInput,\n CreateDashboardInput,\n Dashboard,\n CreatedDashboardElement,\n DashboardPublishResult,\n DashboardView,\n PublishDashboardInput,\n TransferDashboardOwnershipInput,\n UpdateDashboardAccessInput,\n UpdateDashboardDraftInput,\n UpdateDashboardElementInput,\n UpdateDashboardLayoutInput,\n} from '../../types/context-dashboards.js'\n\n/**\n * Tiles and filters on one dashboard draft.\n *\n * Call path: `mgmt.context.dashboards.elements(dashboardId)`.\n *\n * Every change takes the `draftRevision` it is based on as `expectedRevision`;\n * a stale value is rejected with a `ConflictError`.\n */\nexport class ManagementDashboardElementsResource extends ContextDashboardsElementsResourceBase {\n /** @internal */\n constructor(\n http: HttpClient,\n config: ModusConfig,\n dashboardId: string,\n ) {\n super(http, config, dashboardId)\n }\n\n /**\n * Add a blank tile or filter to the dashboard draft.\n *\n * Modus assigns the new element's id; configure it afterwards with `update()`.\n *\n * @param input.expectedRevision - The `draftRevision` your change is based on.\n * @param input.kind - `chart`, `kpi`, `table`, `markdown` or `filter`.\n * @param input.title - Title shown on the element.\n * @param input.tabId - Destination tab; defaults to the first tab.\n * @param input.layout - Grid position with `x` (0-11), `y`, `w` (1-12) and `h`.\n * @returns The created element and the new `draftRevision`.\n * @throws ConflictError - The draft changed since `expectedRevision`; list the\n * elements again and retry with the new revision.\n * @example\n * ```ts\n * const created = await mgmt.context.dashboards.elements('DASHBOARD_ID').create({\n * expectedRevision: 3,\n * kind: 'chart',\n * title: 'Sales by region',\n * layout: { x: 0, y: 4, w: 6, h: 4 },\n * })\n * ```\n */\n async create(input: CreateDashboardElementInput): Promise<CreatedDashboardElement> {\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_createElement', {\n pathParams: { dashboardId: this.dashboardId },\n jsonBody: {\n expectedRevision: input.expectedRevision,\n kind: input.kind,\n title: input.title,\n layout: input.layout,\n ...(input.tabId !== undefined ? { tabId: input.tabId } : {}),\n },\n }),\n ) as unknown as CreatedDashboardElement\n }\n\n /**\n * Change settings of one tile or filter on the dashboard draft.\n *\n * @param elementId - Id of the tile or filter to change.\n * @param input.expectedRevision - The `draftRevision` your change is based on.\n * @param input.patch - The settings to change, for example `{ title: 'Sales' }`\n * or `{ defaultValue: null }`. `null` clears a setting that supports clearing.\n * @returns The whole dashboard after the change, including the new `draftRevision`.\n * @throws ConflictError - The draft changed since `expectedRevision`.\n * @throws NotFoundError - The dashboard or the element does not exist, or you cannot\n * edit the dashboard.\n * @example\n * ```ts\n * const dashboard = await mgmt.context.dashboards\n * .elements('DASHBOARD_ID')\n * .update('ELEMENT_ID', { expectedRevision: 3, patch: { title: 'Revenue' } })\n * ```\n */\n async update(elementId: string, input: UpdateDashboardElementInput): Promise<Dashboard> {\n validateId(elementId, 'elementId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_updateElement', {\n pathParams: { dashboardId: this.dashboardId, elementId },\n jsonBody: { expectedRevision: input.expectedRevision, patch: input.patch },\n }),\n ) as unknown as Dashboard\n }\n}\n\n/**\n * Dashboards in the Modus knowledge base.\n *\n * Call path: `mgmt.context.dashboards` after `new ModusManagement(...)`.\n *\n * - `list()`, `get()`, `create()`, `updateDraft()`, `publish()`, `delete()` — dashboards.\n * - `listVersions()`, `getVersion()`, `restoreVersion()`, `listDraftSnapshots()` — history.\n * - `updateAccess()` — who can open and edit a dashboard.\n * - `requestOwnershipTransfer()`, `acceptOwnershipTransfer()`, `cancelOwnershipTransfer()`.\n * - `elements(dashboardId)` — list, get, create and update tiles and filters.\n * - `updateLayout(dashboardId, input)` — move or resize several elements at once.\n */\nexport class ManagementDashboardsResource extends ContextDashboardsResourceBase {\n /** @internal */\n constructor(\n http: HttpClient,\n config: ModusConfig,\n ) {\n super(http, config)\n }\n\n /**\n * List dashboards with their full definitions.\n *\n * @param options.view - `active` (default) lists published dashboards you can open;\n * `draft` lists the drafts of dashboards you can edit.\n * @returns Every matching dashboard. The list is not paginated.\n * @example\n * ```ts\n * const drafts = await mgmt.context.dashboards.list({ view: 'draft' })\n * drafts.map((dashboard) => [dashboard.id, dashboard.draftRevision])\n * ```\n */\n async list(options: { view?: DashboardView } = {}): Promise<Dashboard[]> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_list', {\n query: { view: options.view },\n }),\n )\n return data.dashboards as Dashboard[]\n }\n\n /**\n * Get one dashboard with its full definition.\n *\n * @param dashboardId - Id of the dashboard.\n * @param options.view - `active` (default) returns the published version; `draft`\n * returns the working draft and requires edit access.\n * @returns The dashboard, including `draftRevision` for the next change.\n * @throws NotFoundError - The dashboard does not exist or you cannot open it.\n * @example\n * ```ts\n * const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })\n * draft.draftRevision\n * ```\n */\n async get(dashboardId: string, options: { view?: DashboardView } = {}): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_get', {\n pathParams: { dashboardId },\n query: { view: options.view },\n }),\n ) as unknown as Dashboard\n }\n\n /**\n * Create a dashboard draft.\n *\n * The new dashboard is not visible to others until you `publish()` it.\n *\n * @param input.title - Dashboard title.\n * @param input.definition - Tiles, filters and layout, for example\n * `{ tiles: [], filters: [] }`. Element ids must be unique.\n * @param input.description - Optional dashboard description.\n * @param input.access - Optional `visibility`, `groupPermissions` and `sharedWith`.\n * Defaults to private.\n * @returns The created dashboard in its draft view.\n * @throws ModusError - The definition or access settings are invalid.\n * @example\n * ```ts\n * const dashboard = await mgmt.context.dashboards.create({\n * title: 'Revenue',\n * definition: { tiles: [], filters: [] },\n * })\n * dashboard.id\n * ```\n */\n async create(input: CreateDashboardInput): Promise<Dashboard> {\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_create', {\n jsonBody: {\n title: input.title,\n description: input.description,\n definition: input.definition,\n access: input.access,\n },\n }),\n ) as unknown as Dashboard\n }\n\n /**\n * Replace the whole draft definition, and optionally the title and description.\n *\n * @param dashboardId - Id of the dashboard.\n * @param input.expectedRevision - The `draftRevision` your change is based on.\n * @param input.definition - The complete new definition. Tiles and filters left\n * out are removed.\n * @param input.title - New title; unchanged when omitted.\n * @param input.description - New description; unchanged when omitted.\n * @returns The dashboard draft after the change, including the new `draftRevision`.\n * @throws ConflictError - The draft changed since `expectedRevision`; get the draft\n * again and retry with the new revision.\n * @throws NotFoundError - The dashboard does not exist or you cannot edit it.\n * @example\n * ```ts\n * const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })\n * await mgmt.context.dashboards.updateDraft('DASHBOARD_ID', {\n * expectedRevision: draft.draftRevision,\n * definition: draft.definition,\n * title: 'Revenue',\n * })\n * ```\n */\n async updateDraft(dashboardId: string, input: UpdateDashboardDraftInput): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_updateDraft', {\n pathParams: { dashboardId },\n jsonBody: {\n expectedRevision: input.expectedRevision,\n title: input.title,\n description: input.description,\n definition: input.definition,\n },\n }),\n ) as unknown as Dashboard\n }\n\n /**\n * Publish the draft as a new version that everyone with access sees.\n *\n * Alert workflows defined on the dashboard are updated to match.\n *\n * @param dashboardId - Id of the dashboard.\n * @param input.expectedRevision - The `draftRevision` you reviewed and want to publish.\n * @returns The published `dashboard` and the new `version`.\n * @throws ConflictError - The draft changed since `expectedRevision`.\n * @throws NotFoundError - The dashboard does not exist or you cannot edit it.\n * @example\n * ```ts\n * const result = await mgmt.context.dashboards.publish('DASHBOARD_ID', { expectedRevision: 4 })\n * result.version.versionNumber\n * ```\n */\n async publish(dashboardId: string, input: PublishDashboardInput): Promise<DashboardPublishResult> {\n validateId(dashboardId, 'dashboardId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_publish', {\n pathParams: { dashboardId },\n jsonBody: { expectedRevision: input.expectedRevision },\n }),\n ) as unknown as DashboardPublishResult\n }\n\n /**\n * Replace who can open and edit a dashboard.\n *\n * All three settings are required and replace the current ones.\n *\n * @param dashboardId - Id of the dashboard.\n * @param input.visibility - `shared` (the owner plus the groups in\n * `groupPermissions`) or `private` (the owner plus the users in `sharedWith`).\n * @param input.groupPermissions - Group id to `{ use, manage }`. Used only when shared.\n * @param input.sharedWith - Users such as `{ email: 'ana@example.com', permission: 'use' }`.\n * Used only when private.\n * @returns The dashboard with its new access settings.\n * @throws NotFoundError - The dashboard does not exist or you cannot edit it.\n * @throws ModusError - A group, user or permission is invalid.\n * @example\n * ```ts\n * await mgmt.context.dashboards.updateAccess('DASHBOARD_ID', {\n * visibility: 'private',\n * groupPermissions: {},\n * sharedWith: [{ email: 'ana@example.com', permission: 'use' }],\n * })\n * ```\n */\n async updateAccess(dashboardId: string, input: UpdateDashboardAccessInput): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_updateAccess', {\n pathParams: { dashboardId },\n jsonBody: {\n visibility: input.visibility,\n groupPermissions: input.groupPermissions,\n sharedWith: input.sharedWith,\n },\n }),\n ) as unknown as Dashboard\n }\n\n /**\n * Ask another member of your organization to take ownership of a dashboard.\n *\n * Only the owner can request a transfer. Ownership moves when the recipient\n * calls `acceptOwnershipTransfer()`.\n *\n * @param dashboardId - Id of the dashboard.\n * @param input.newOwnerUserId - User id of the member who should become the owner.\n * @returns The dashboard with `pendingOwnershipTransfer` set.\n * @throws PermissionDeniedError - You are not the owner.\n * @throws NotFoundError - The dashboard does not exist or you cannot open it.\n * @example\n * ```ts\n * await mgmt.context.dashboards.requestOwnershipTransfer('DASHBOARD_ID', {\n * newOwnerUserId: 'USER_ID',\n * })\n * ```\n */\n async requestOwnershipTransfer(\n dashboardId: string,\n input: TransferDashboardOwnershipInput,\n ): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n validateId(input.newOwnerUserId, 'newOwnerUserId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_transferOwnership', {\n pathParams: { dashboardId },\n jsonBody: { newOwnerUserId: input.newOwnerUserId },\n }),\n ) as unknown as Dashboard\n }\n\n /**\n * Work with the tiles and filters of one dashboard draft.\n *\n * @param dashboardId - Id of the dashboard.\n * @returns A resource bound to that dashboard.\n * @example\n * ```ts\n * await mgmt.context.dashboards.elements('DASHBOARD_ID').list()\n * ```\n */\n elements(dashboardId: string): ManagementDashboardElementsResource {\n validateId(dashboardId, 'dashboardId')\n return new ManagementDashboardElementsResource(this.http, this.config, dashboardId)\n }\n\n /**\n * Move or resize several tiles and filters in one change.\n *\n * @param dashboardId - Id of the dashboard.\n * @param input.expectedRevision - The `draftRevision` your change is based on.\n * @param input.elements - Every element to place, each with `elementId` and its\n * final `layout`.\n * @returns The whole dashboard after the change, including the new `draftRevision`.\n * @throws ConflictError - The draft changed since `expectedRevision`.\n * @example\n * ```ts\n * await mgmt.context.dashboards.updateLayout('DASHBOARD_ID', {\n * expectedRevision: 3,\n * elements: [{ elementId: 'ELEMENT_ID', layout: { x: 0, y: 0, w: 12, h: 2 } }],\n * })\n * ```\n */\n async updateLayout(dashboardId: string, input: UpdateDashboardLayoutInput): Promise<Dashboard> {\n validateId(dashboardId, 'dashboardId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'DashboardsController_updateLayout', {\n pathParams: { dashboardId },\n jsonBody: { expectedRevision: input.expectedRevision, elements: input.elements,\n ...(input.tabs !== undefined ? { tabs: input.tabs } : {}),\n },\n }),\n ) as unknown as Dashboard\n }\n}\n","import { readdir, readFile, stat } from 'node:fs/promises'\nimport { dirname, join, relative } from 'node:path'\nimport type { ModusConfig } from '../../_config.js'\nimport { ModusError, ValidationError } from '../../_exceptions.js'\nimport { ContextFilesResourceBase } from '../../_generated/resources/management/context/files.js'\nimport type { HttpClient } from '../../_http.js'\nimport { asRecord, invokeWithRetry } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type {\n BulkFinalizeResult,\n BulkUploadFromUrlsResult,\n BulkUploadUrlsResult,\n FileUpload,\n FinalizeInput,\n UploadDirFailure,\n UploadDirResult,\n UploadFileInput,\n UploadFromUrlInput,\n UploadProgressCallback,\n UploadUrlInput,\n UploadUrlSlot,\n WaitUntil,\n} from '../../types/context-files.js'\n\n/** Bulk `createUploadUrls` / `uploadFromUrls` request cap — matches the backend. */\nexport const MAX_BULK_UPLOAD_FILES = 100\n\nconst DEFAULT_PUT_TIMEOUT_MS = 60_000\nconst DEFAULT_POLL_INTERVAL_MS = 500\nconst DEFAULT_UPLOAD_TIMEOUT_MS = 120_000\nconst DEFAULT_CONCURRENCY = 10\n// `pending` is gone from the public enum: an upload has no resource until it\n// is finalized. Kept at rank 0 so an older server still reporting it is\n// ordered below `processing` rather than treated as unknown.\nconst STATUS_ORDER: Record<string, number> = { pending: 0, processing: 1, ready: 2 }\nconst WAIT_UNTIL_VALUES = new Set<WaitUntil>(['processing', 'ready'])\n\n/**\n * The server owns the extension→MIME table (`EXTENSION_MIME_MAP` in\n * `@modus/file-uploads`) and resolves it whenever a client sends\n * `application/octet-stream`. Sending that instead of guessing locally keeps\n * one source of truth: a client-side table inevitably drifts from the server's\n * allow-list, and a guess the server rejects fails the upload for no reason.\n */\nconst DEFER_CONTENT_TYPE_TO_SERVER = 'application/octet-stream'\n\n/** A missing path (or one under a regular file, ENOTDIR) is bad caller input, so it throws ValidationError like a wrong file type does. */\nasync function statInput(path: string) {\n try {\n return await stat(path)\n } catch (error) {\n const code = (error as { code?: unknown }).code\n if (code === 'ENOENT' || code === 'ENOTDIR') throw new ValidationError(`No such file or directory: ${path}`)\n throw error\n }\n}\n\nfunction validateWaitUntil(waitUntil: string): asserts waitUntil is WaitUntil {\n if (!WAIT_UNTIL_VALUES.has(waitUntil as WaitUntil)) {\n throw new ValidationError(`waitUntil must be one of ${[...WAIT_UNTIL_VALUES].join(', ')}, got ${waitUntil}`)\n }\n}\n\nfunction validateBulkSize(count: number, name: string): void {\n if (count === 0) throw new ValidationError(`${name} must not be empty`)\n if (count > MAX_BULK_UPLOAD_FILES) {\n throw new ValidationError(`${name} must have at most ${MAX_BULK_UPLOAD_FILES} entries, got ${count}`)\n }\n}\n\nfunction statusSatisfies(status: string, waitUntil: WaitUntil): boolean {\n if (status === 'failed') return true\n return (STATUS_ORDER[status] ?? 0) >= STATUS_ORDER[waitUntil]\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\nfunction chunked<T>(items: readonly T[], size: number): T[][] {\n const out: T[][] = []\n for (let i = 0; i < items.length; i += size) out.push(items.slice(i, i + size))\n return out\n}\n\n/** Join an optional destination prefix onto a walk-relative folder label. Empty prefix is a no-op. */\nfunction joinDestination(prefix: string | undefined, relative: string | undefined): string | undefined {\n const head = prefix === undefined || prefix.length === 0 ? undefined : prefix\n const tail =\n relative === undefined || relative.length === 0\n ? undefined\n : relative\n if (head !== undefined && tail !== undefined) return `${head}/${tail}`\n return head ?? tail\n}\n\nexport type BatchUploadOptions = {\n concurrency?: number\n waitUntil?: WaitUntil\n onProgress?: UploadProgressCallback\n folderPath?: string\n}\n\n/** Bounded-concurrency map, preserving input order — the async twin of a thread pool. */\nasync function mapWithConcurrency<T, R>(\n items: readonly T[],\n concurrency: number,\n worker: (item: T) => Promise<R>,\n onItemDone?: (result: R) => void,\n): Promise<R[]> {\n const results: R[] = new Array(items.length)\n let cursor = 0\n async function run(): Promise<void> {\n for (;;) {\n const index = cursor++\n if (index >= items.length) return\n const result = await worker(items[index] as T)\n results[index] = result\n onItemDone?.(result)\n }\n }\n await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, run))\n return results\n}\n\nasync function walkFiles(root: string, recursive: boolean): Promise<string[]> {\n const out: string[] = []\n async function walk(dir: string): Promise<void> {\n const entries = await readdir(dir, { withFileTypes: true })\n entries.sort((a, b) => a.name.localeCompare(b.name))\n for (const entry of entries) {\n if (entry.name.startsWith('.') || entry.isSymbolicLink()) continue\n const full = join(dir, entry.name)\n if (entry.isDirectory()) {\n if (recursive) await walk(full)\n } else if (entry.isFile()) {\n out.push(full)\n }\n }\n }\n await walk(root)\n return out\n}\n\n// Servers released before `headers` existed omit it; their PUT needs only Content-Type.\ntype PutSlot = Pick<UploadUrlSlot, 'uploadUrl' | 'contentType'> & { headers?: Record<string, string> }\n\nasync function putBytes(fetchImpl: typeof fetch, slot: PutSlot, data: Uint8Array, timeoutMs: number): Promise<void> {\n const response = await fetchImpl(slot.uploadUrl, {\n method: 'PUT',\n body: data,\n headers: { 'Content-Type': slot.contentType, ...slot.headers },\n signal: AbortSignal.timeout(timeoutMs),\n })\n if (!response.ok) {\n const text = await response.text().catch(() => '')\n throw new ModusError(`Upload PUT to presigned URL failed with HTTP ${response.status}.`, {\n statusCode: response.status,\n body: text ? text.slice(0, 500) : undefined,\n })\n }\n}\n\nfunction createSlotsPayload(files: readonly UploadUrlInput[]): Record<string, unknown> {\n return {\n files: files.map((f) => ({ fileName: f.fileName, contentType: f.contentType, fileSize: f.fileSize })),\n }\n}\n\nfunction uploadFromUrlsPayload(urls: readonly UploadFromUrlInput[]): Record<string, unknown> {\n return {\n urls: urls.map((u) => ({\n url: u.url,\n ...(u.fileName !== undefined ? { fileName: u.fileName } : {}),\n ...(u.folderPath !== undefined ? { folderPath: u.folderPath } : {}),\n })),\n }\n}\n\ntype UploadPath = UploadFileInput\ntype SlotAssignment = UploadPath & { slot: UploadUrlSlot }\n\nfunction assignSlots(\n batch: readonly UploadPath[],\n result: BulkUploadUrlsResult,\n failed: UploadDirFailure[],\n): SlotAssignment[] {\n const failedIndices = new Set(result.failed.map((f) => f.index))\n for (const f of result.failed) {\n failed.push({ path: batch[f.index]?.path ?? '', error: f.error })\n }\n const remaining = batch.filter((_, i) => !failedIndices.has(i))\n const uploaded = result.uploaded\n if (uploaded.length < remaining.length) {\n for (const file of remaining.slice(uploaded.length)) {\n failed.push({ path: file.path, error: 'Server returned fewer upload slots than requested files.' })\n }\n }\n const paired = Math.min(remaining.length, uploaded.length)\n const assignments: SlotAssignment[] = []\n for (let i = 0; i < paired; i++) {\n assignments.push({ ...(remaining[i] as UploadPath), slot: uploaded[i] as UploadUrlSlot })\n }\n return assignments\n}\n\n/**\n * Durable file uploads for `ModusManagement`.\n *\n * Call path: `mgmt.context.files` after `new ModusManagement(...)`.\n *\n * - `upload(path)` / `uploadDir(dirPath)` — presign + PUT + poll convenience helpers.\n * - `createUploadUrl(s)`, `uploadFromUrl(s)`, `get`, `list` — raw operations.\n * Hierarchy browsing is available through `mgmt.context.items.list`.\n */\nexport class ManagementContextFilesResource extends ContextFilesResourceBase {\n /** @internal */\n constructor(\n http: HttpClient,\n config: ModusConfig,\n ) {\n super(http, config)\n }\n\n /**\n * Get a presigned S3 PUT URL for one file.\n *\n * @param input.fileName - Original file name — used to build the S3 object key.\n * @param input.contentType - MIME type. Allowed categories: PDF, images, text,\n * Office/OpenDocument documents, audio, and video.\n * @param input.fileSize - File size in bytes. Rejected above 50MB.\n * @returns Presigned upload slot. PUT the raw bytes to `uploadUrl` within 15\n * minutes, sending `headers` unchanged, then call `finalize(slot.uploadId, slot.fileName)`. Pass the\n * slot's own `fileName` rather than your local basename — the server may\n * sanitize the requested name when it mints the key, and finalization\n * re-derives the key from `uploadId` and `fileName`.\n */\n async createUploadUrl(input: UploadUrlInput): Promise<UploadUrlSlot> {\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_uploadUrl', {\n jsonBody: { fileName: input.fileName, contentType: input.contentType, fileSize: input.fileSize },\n }),\n ) as unknown as UploadUrlSlot\n }\n\n /**\n * Get presigned S3 PUT URLs for up to 100 files in one call.\n *\n * @param files - Files to create upload slots for (max 100).\n * @returns Slots for every file that passed validation, plus per-index\n * failures (bad MIME type, oversize) for the rest — never a partial 4xx.\n */\n async createUploadUrls(files: readonly UploadUrlInput[]): Promise<BulkUploadUrlsResult> {\n validateBulkSize(files.length, 'files')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_uploadUrls', {\n jsonBody: createSlotsPayload(files),\n }),\n ) as unknown as BulkUploadUrlsResult\n }\n\n /**\n * Fetch one file from a URL and land it as durable context.\n *\n * @param url - Source URL to fetch (SSRF-guarded, 50MB cap, same MIME\n * allow-list as `createUploadUrl`).\n * @param options.fileName - Override file name. Inferred from the URL path when omitted.\n * @param options.folderPath - Root-relative folder to upload under.\n * @returns File upload resource with status `processing` — parsing continues async.\n */\n async uploadFromUrl(url: string, options: { fileName?: string; folderPath?: string } = {}): Promise<FileUpload> {\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_uploadFromUrl', {\n jsonBody: {\n url,\n ...(options.fileName !== undefined ? { fileName: options.fileName } : {}),\n ...(options.folderPath !== undefined ? { folderPath: options.folderPath } : {}),\n },\n }),\n ) as unknown as FileUpload\n }\n\n /**\n * Fetch up to 100 files from URLs in one call.\n *\n * @param urls - URLs to fetch and upload (max 100).\n * @returns File upload resources for every URL that landed, plus per-index\n * failures for the rest — never a partial 4xx.\n */\n async uploadFromUrls(urls: readonly UploadFromUrlInput[]): Promise<BulkUploadFromUrlsResult> {\n validateBulkSize(urls.length, 'urls')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_uploadFromUrls', {\n jsonBody: uploadFromUrlsPayload(urls),\n }),\n ) as unknown as BulkUploadFromUrlsResult\n }\n\n /**\n * Turn a file already PUT to a presigned URL into durable context.\n *\n * Call this once the PUT completes. The server locates the object from\n * `uploadId` + `fileName` and validates the bytes that actually arrived.\n * Safe to retry — a second call returns the same resource.\n *\n * @param uploadId - Upload id returned by `createUploadUrl`.\n * @param fileName - File name returned alongside it.\n * @returns The file upload resource, status `\"processing\"`.\n */\n async finalize(uploadId: string, fileName: string, options: { folderPath?: string } = {}): Promise<FileUpload> {\n validateId(uploadId, 'uploadId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_finalize', {\n pathParams: { uploadId },\n jsonBody: { fileName, ...(options.folderPath !== undefined ? { folderPath: options.folderPath } : {}) },\n }),\n ) as unknown as FileUpload\n }\n\n /**\n * Finalize up to 100 uploads in one call.\n *\n * What makes directory upload cheap: 2000 files cost 20 requests here rather\n * than 2000.\n *\n * @param uploads - Uploads to finalize (max 100).\n * @returns Resources for every upload that finalized, plus per-index\n * failures for the rest — never a partial 4xx.\n */\n async finalizeMany(uploads: readonly FinalizeInput[]): Promise<BulkFinalizeResult> {\n validateBulkSize(uploads.length, 'uploads')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_finalizeMany', {\n jsonBody: {\n uploads: uploads.map((u) => ({\n uploadId: u.uploadId,\n fileName: u.fileName,\n ...(u.folderPath !== undefined ? { folderPath: u.folderPath } : {}),\n })),\n },\n }),\n ) as unknown as BulkFinalizeResult\n }\n\n /**\n * Upload an explicit list of local files.\n *\n * Same machinery as `uploadDir`, without the directory walk — use it when\n * the caller already knows which files to send.\n *\n * @param paths - Paths to local files.\n * @param options.concurrency - Max concurrent PUTs (default 10).\n * @param options.waitUntil - `\"processing\"` (default) or `\"ready\"`.\n * @param options.onProgress - Optional progress callback after each file.\n * @param options.folderPath - Root-relative folder to upload under. Nested\n * files keep their existing relative folder labels under this prefix.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const result = await mgmt.context.files.uploadFiles(\n * ['./q3.pdf', './notes.md'],\n * { folderPath: 'reports/2026' },\n * )\n * ```\n */\n async uploadFiles(\n paths: readonly (string | UploadFileInput)[],\n options: BatchUploadOptions = {},\n ): Promise<UploadDirResult> {\n return this.uploadPaths(paths.map((input) => typeof input === 'string' ? { path: input } : input), options)\n }\n\n /**\n * Upload a local file and wait for it to reach `\"processing\"` or `\"ready\"`.\n *\n * Gets a presigned URL, PUTs the file bytes, then polls `get()`\n * until the upload leaves `\"pending\"` (or reaches `\"ready\"`/`\"failed\"`).\n *\n * @param path - Path to a local file.\n * @param options.waitUntil - `\"processing\"` (parsing started, default) or\n * `\"ready\"` (parsing finished).\n * @param options.pollIntervalMs - Milliseconds between status polls.\n * @param options.timeoutMs - Max milliseconds to wait before raising.\n * @param options.folderPath - Root-relative folder to upload under. Example:\n * `{ folderPath: 'reports/2026' }` places `./report.pdf` at `reports/2026`.\n * @returns The file upload resource once it reaches `waitUntil` (or `\"failed\"`).\n * @throws {ModusError} If the PUT fails, or polling times out.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const file = await mgmt.context.files.upload('./report.pdf', { folderPath: 'reports/2026' })\n * ```\n */\n async upload(\n path: string,\n options: {\n waitUntil?: WaitUntil\n pollIntervalMs?: number\n timeoutMs?: number\n folderPath?: string\n } = {},\n ): Promise<FileUpload> {\n const waitUntil = options.waitUntil ?? 'processing'\n validateWaitUntil(waitUntil)\n const fileStat = await statInput(path)\n if (!fileStat.isFile()) throw new ValidationError(`Not a file: ${path}`)\n const fileName = path.split(/[/\\\\]/).pop() as string\n const slot = await this.createUploadUrl({\n fileName,\n contentType: DEFER_CONTENT_TYPE_TO_SERVER,\n fileSize: fileStat.size,\n })\n const data = await readFile(path)\n await putBytes(this.config.fetch, slot, data, DEFAULT_PUT_TIMEOUT_MS)\n // Finalize returns the resource already at `processing`, so it replaces the\n // first poll rather than adding a round trip. Only `waitUntil: 'ready'`\n // needs to keep polling afterwards.\n const finalized = await this.finalize(slot.uploadId, slot.fileName, {\n ...(options.folderPath !== undefined ? { folderPath: options.folderPath } : {}),\n })\n if (statusSatisfies(finalized.status, waitUntil)) return finalized\n return this.pollUntil(\n slot.uploadId,\n waitUntil,\n options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS,\n options.timeoutMs ?? DEFAULT_UPLOAD_TIMEOUT_MS,\n )\n }\n\n private async pollUntil(\n uploadId: string,\n waitUntil: WaitUntil,\n pollIntervalMs: number,\n timeoutMs: number,\n ): Promise<FileUpload> {\n const deadline = Date.now() + timeoutMs\n for (;;) {\n const item = await this.get(uploadId)\n if (statusSatisfies(item.status, waitUntil)) return item\n if (Date.now() >= deadline) {\n throw new ModusError(\n `Timed out after ${timeoutMs}ms waiting for upload ${JSON.stringify(uploadId)} to reach ` +\n `status ${JSON.stringify(waitUntil)}; last status was ${JSON.stringify(item.status)}.`,\n )\n }\n await sleep(pollIntervalMs)\n }\n }\n\n /**\n * Upload every file in a local directory.\n *\n * Walks `path` (skipping hidden files/directories and symlinks), pages\n * through `createUploadUrls()` in batches of up to 100, then PUTs and polls\n * each file with up to `concurrency` in flight at once. A failure on one\n * file does not stop the others — check `result.failed`.\n *\n * @param path - Path to a local directory.\n * @param options.recursive - Recurse into subdirectories (default `true`).\n * @param options.concurrency - Max concurrent PUT+poll operations (default 10).\n * @param options.waitUntil - `\"processing\"` (default) or `\"ready\"` — same as `upload()`.\n * @param options.onProgress - Optional progress callback after each file.\n * @param options.folderPath - Root-relative folder to upload under. Nested\n * files keep their path relative to `path` under this prefix. Example:\n * `uploadDir('./docs', { folderPath: 'reports' })` places `./docs/a.txt` at\n * `reports` and `./docs/nested/b.txt` at `reports/nested`.\n * @returns `UploadDirResult` with every successful `FileUpload` and every\n * per-file failure (slot creation or PUT/poll), each tagged with its local path.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const result = await mgmt.context.files.uploadDir('./docs', { folderPath: 'reports' })\n * ```\n */\n async uploadDir(\n path: string,\n options: {\n recursive?: boolean\n concurrency?: number\n waitUntil?: WaitUntil\n onProgress?: UploadProgressCallback\n folderPath?: string\n } = {},\n ): Promise<UploadDirResult> {\n const waitUntil = options.waitUntil ?? 'processing'\n validateWaitUntil(waitUntil)\n const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY\n if (concurrency < 1) throw new ValidationError(`concurrency must be >= 1, got ${concurrency}`)\n const dirStat = await statInput(path)\n if (!dirStat.isDirectory()) throw new ValidationError(`Not a directory: ${path}`)\n\n const files = await walkFiles(path, options.recursive ?? true)\n return this.uploadPaths(files.map((file) => {\n const folderPath = relative(path, dirname(file)).replace(/\\\\/g, '/')\n return { path: file, ...(folderPath.length > 0 ? { folderPath } : {}) }\n }), options)\n }\n\n /** Shared body of `uploadFiles` and `uploadDir`: presign in batches of 100,\n * PUT with bounded concurrency, then bulk-finalize the batch. */\n private async uploadPaths(\n files: readonly UploadPath[],\n options: BatchUploadOptions,\n ): Promise<UploadDirResult> {\n const waitUntil = options.waitUntil ?? 'processing'\n validateWaitUntil(waitUntil)\n const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY\n if (concurrency < 1) throw new ValidationError(`concurrency must be >= 1, got ${concurrency}`)\n\n const prefixed = files.map((file) => {\n const folderPath = joinDestination(options.folderPath, file.folderPath)\n return { path: file.path, ...(folderPath !== undefined ? { folderPath } : {}) }\n })\n\n const uploaded: FileUpload[] = []\n const failed: UploadDirFailure[] = []\n const total = files.length\n let completed = 0\n const emit = () => {\n completed += 1\n options.onProgress?.({\n completed,\n total,\n succeeded: uploaded.length,\n failed: failed.length,\n })\n }\n\n for (const batch of chunked(prefixed, MAX_BULK_UPLOAD_FILES)) {\n const failedBefore = failed.length\n const slots = await this.createSlots(batch, failed)\n // createSlots can report several failures from one synchronous call, so tick\n // `failed` up one at a time here — reusing `emit()` would report the final\n // `failed.length` on every tick and break the completed = succeeded + failed\n // invariant for all but the last of them.\n for (let reported = failedBefore + 1; reported <= failed.length; reported += 1) {\n completed += 1\n options.onProgress?.({ completed, total, succeeded: uploaded.length, failed: reported })\n }\n await this.uploadBatch(slots, waitUntil, concurrency, (result) => {\n if ('error' in result) failed.push(result)\n else uploaded.push(result)\n emit()\n })\n }\n return { uploaded, failed }\n }\n\n private async createSlots(batch: readonly UploadPath[], failed: UploadDirFailure[]): Promise<SlotAssignment[]> {\n const readable: UploadPath[] = []\n const inputs: UploadUrlInput[] = []\n for (const file of batch) {\n try {\n const fileStat = await stat(file.path)\n const fileName = file.path.split(/[/\\\\]/).pop() as string\n inputs.push({ fileName, contentType: DEFER_CONTENT_TYPE_TO_SERVER, fileSize: fileStat.size })\n readable.push(file)\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n failed.push({ path: file.path, error: message })\n }\n }\n if (inputs.length === 0) return []\n const result = await this.createUploadUrls(inputs)\n return assignSlots(readable, result, failed)\n }\n\n private async uploadBatch(\n slots: readonly SlotAssignment[],\n waitUntil: WaitUntil,\n concurrency: number,\n onOutcome?: (result: FileUpload | UploadDirFailure) => void,\n ): Promise<(FileUpload | UploadDirFailure)[]> {\n if (slots.length === 0) return []\n const out: (FileUpload | UploadDirFailure)[] = []\n\n // PUT everything first, collecting the ones whose bytes landed.\n type PutOutcome = { landed: SlotAssignment } | { failure: UploadDirFailure }\n const put = await mapWithConcurrency<SlotAssignment, PutOutcome>(\n slots,\n concurrency,\n async ({ path, folderPath, slot }) => {\n try {\n const data = await readFile(path)\n await putBytes(this.config.fetch, slot, data, DEFAULT_PUT_TIMEOUT_MS)\n return { landed: { path, ...(folderPath !== undefined ? { folderPath } : {}), slot } }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return { failure: { path, error: message } }\n }\n },\n (outcome) => {\n // Emit PUT failures as each concurrent worker finishes — do not wait for\n // the rest of the batch / finalize before progress moves.\n if ('failure' in outcome) {\n out.push(outcome.failure)\n onOutcome?.(outcome.failure)\n }\n },\n )\n const landed: SlotAssignment[] = []\n for (const entry of put) {\n if ('failure' in entry) {\n // already recorded + emitted in onItemDone\n continue\n }\n landed.push(entry.landed)\n }\n if (landed.length === 0) return out\n\n // One bulk finalize for the whole batch — the reason a 2000-file directory\n // costs 20 requests here instead of 2000.\n const result = await this.finalizeMany(\n landed.map(({ slot, folderPath }) => ({\n uploadId: slot.uploadId,\n fileName: slot.fileName,\n ...(folderPath !== undefined ? { folderPath } : {}),\n })),\n )\n const failedIndices = new Set(result.failed.map((f) => f.index))\n for (const f of result.failed) {\n const failure: UploadDirFailure = { path: landed[f.index]?.path ?? '', error: f.error }\n out.push(failure)\n onOutcome?.(failure)\n }\n const finalized = result.finalized\n const remaining = landed.filter((_, i) => !failedIndices.has(i))\n\n if (waitUntil !== 'ready') {\n for (const item of finalized) {\n out.push(item)\n onOutcome?.(item)\n }\n return out\n }\n\n // Only `ready` needs polling; `processing` is already satisfied by the\n // finalize response.\n await mapWithConcurrency(\n remaining,\n concurrency,\n async ({ path, slot }) => {\n try {\n return await this.pollUntil(slot.uploadId, waitUntil, DEFAULT_POLL_INTERVAL_MS, DEFAULT_UPLOAD_TIMEOUT_MS)\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return { path, error: message } satisfies UploadDirFailure\n }\n },\n (item) => {\n out.push(item)\n onOutcome?.(item)\n },\n )\n return out\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../../_pagination.js'\nimport { asRecord, invokeWithRetry } from '../../../../_request.js'\nimport { validateId, validatePageSize } from '../../../../_validation.js'\nimport type { FileUpload } from '../../../../types/context-files.js'\n\n/** Generated base for the management `context.files` resource. */\nexport class ContextFilesResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List file uploads.\n *\n * Returns a page of durable landed file uploads. Uploads that have not landed yet are visible via\n * `GET /context/files/{uploadId}`, not this list.\n *\n * **Requires:** `context:read`\n *\n * @param options.pageSize - Items per page. Defaults to 50.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @returns A page of files.\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n } = {}): Promise<Page<FileUpload>> {\n const pageSize = options.pageSize ?? 50\n validatePageSize(pageSize, 200)\n return this.listPage(pageSize, options.pageToken)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n ): Promise<Page<FileUpload>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_list', {\n query: aipListParams(pageSize, pageToken) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'files',\n (raw) => raw as FileUpload,\n (token) => this.listPage(pageSize, token),\n )\n }\n\n /**\n * Get a file upload.\n *\n * Returns status + metadata for one upload. Prefers the durable landed context item; falls back\n * to in-flight upload status while the object has not landed yet. 404 if neither exists.\n *\n * **Requires:** `context:read`\n *\n * @param uploadId - Upload id returned by `createUploadUrl` / `createUploadUrls`.\n */\n async get(uploadId: string): Promise<FileUpload> {\n validateId(uploadId, 'uploadId')\n const data = await invokeWithRetry(this.config, this.http, 'ContextFilesController_get', {\n pathParams: { uploadId },\n })\n return asRecord(data) as unknown as FileUpload\n }\n}\n","import type { OperationId } from '../../_generated/operations.js'\nimport type { ModusConfig } from '../../_config.js'\nimport type { HttpClient } from '../../_http.js'\nimport { updateBody, updateMaskQuery } from '../../_query.js'\nimport { aipListParams, buildAipPage, type Page } from '../../_pagination.js'\nimport { asRecord, invokeWithRetry } from '../../_request.js'\nimport { ValidationError } from '../../_exceptions.js'\nimport { validatePageSize } from '../../_validation.js'\nimport type {\n ContextItem,\n ContextItemAccessUpdate,\n ContextItemDeletion,\n ContextItemMove,\n UpdateContextItemAccessInput,\n} from '../../types/context.js'\nimport type { UserFeedback } from './_content-merge.js'\n\nfunction contextListParams(\n pageSize: number,\n pageToken: string | undefined,\n filters: ListContextItemsFilters = {},\n): Record<string, string | number | boolean | readonly string[] | undefined | null> {\n const extra: Record<string, string | readonly string[]> = {}\n if (filters.contextType !== undefined) extra.contextTypes = [filters.contextType]\n if (filters.parentUids !== undefined) {\n extra.parentUids = filters.parentUids.length === 0 ? '' : [...filters.parentUids]\n }\n if (filters.ancestorUids !== undefined) {\n extra.ancestorUids = filters.ancestorUids.length === 0 ? '' : [...filters.ancestorUids]\n }\n if (filters.connectionIds !== undefined) {\n extra.connectionIds = filters.connectionIds.length === 0 ? '' : [...filters.connectionIds]\n }\n return aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | readonly string[] | undefined | null\n >\n}\n\ntype ListContextItemsFilters = {\n contextType?: string\n parentUids?: readonly string[]\n ancestorUids?: readonly string[]\n connectionIds?: readonly string[]\n}\n\n/** The move request body; a caller sending both destinations gets an error instead of one being dropped. */\nfunction moveBody(options: { destinationFolderUid?: string | null; destinationFolderPath?: string }): Record<string, unknown> {\n if (options.destinationFolderPath === undefined) return { destinationFolderUid: options.destinationFolderUid }\n if (options.destinationFolderUid !== undefined) {\n throw new ValidationError('Pass destinationFolderUid or destinationFolderPath, not both')\n }\n return { destinationFolderPath: options.destinationFolderPath }\n}\n\nfunction parseContextItem(raw: unknown): ContextItem {\n return raw as ContextItem\n}\n\nexport class ManagementContextItemsResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\n\n /**\n * List context items in the knowledge base.\n *\n * @param options.pageSize - Items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`.\n * @param options.contextType - Filter to one context type (for example `\"note\"`).\n * @param options.parentUids - Exact ordered native ancestry chain for direct\n * children. Omit to leave parent unrestricted; pass `[]` for the known-empty\n * root. Native UIDs are exact tokens; for a folder's children send ancestry\n * UIDs plus the last `dataPath` token, not the hashed context-item `uid`.\n * @param options.ancestorUids - Ordered UID ancestry prefix for strict\n * descendants. Omit to leave unrestricted; pass `[]` for every item with\n * non-null ancestry.\n * @param options.connectionIds - Restrict to these connection ids. Omit to\n * leave unfiltered; pass `[]` to match none. The Files root is\n * `connectionIds: ['files']` with `parentUids: []`.\n * @returns A page of context items.\n *\n * @example\n * ```ts\n * const rootFiles = await mgmt.context.items.list({\n * connectionIds: ['files'],\n * contextType: 'file_upload',\n * parentUids: [],\n * })\n * ```\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n contextType?: string\n parentUids?: readonly string[]\n ancestorUids?: readonly string[]\n connectionIds?: readonly string[]\n } = {}): Promise<Page<ContextItem>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken, {\n contextType: options.contextType,\n parentUids: options.parentUids,\n ancestorUids: options.ancestorUids,\n connectionIds: options.connectionIds,\n })\n }\n\n private async listPage(\n pageSize: number,\n pageToken: string | undefined,\n filters: ListContextItemsFilters,\n ): Promise<Page<ContextItem>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextItemsController_list', {\n query: contextListParams(pageSize, pageToken, filters),\n }),\n )\n return buildAipPage(data, 'contextItems', parseContextItem, (token) =>\n this.listPage(pageSize, token, filters),\n )\n }\n\n /**\n * Retrieve one context item by uid.\n *\n * @param uid - Context item uid.\n * @returns The context item.\n */\n async get(uid: string): Promise<ContextItem> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_get', {\n pathParams: { uid },\n })\n return parseContextItem(data)\n }\n\n /**\n * Update a context item.\n *\n * Only the fields you pass are changed. To clear a field, name it in\n * `updateMask` and leave its argument unset: it is sent as `null`.\n *\n * @param uid - Context item uid.\n * @param options.content - Replacement type-specific content.\n * @param options.contextType - Item type (for example `\"note\"`). Required when `content` is supplied.\n * @param options.description - New description.\n * @param options.userFeedback - Feedback verdict: `\"positive\"`, `\"neutral\"`, or `\"negative\"`.\n * @param options.topics - Replacement topic tags. Pass `[]` to clear all tags.\n * @param options.updateMask - Comma-separated field names to update or clear.\n * @returns The updated context item.\n */\n async update(\n uid: string,\n options: {\n content?: unknown\n contextType?: string\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n updateMask?: string\n } = {},\n ): Promise<ContextItem> {\n const body = updateBody({\n content: options.content,\n contextType: options.contextType,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n }, options.updateMask)\n await invokeWithRetry(this.config, this.http, 'ContextItemsController_update', {\n pathParams: { uid },\n query: updateMaskQuery(options.updateMask),\n jsonBody: body,\n })\n return this.get(uid)\n }\n\n /**\n * Delete a context item. Deleting a Files folder also deletes all its contents.\n *\n * @param uid - Context item uid.\n * @returns Deletion confirmation details.\n */\n async delete(uid: string): Promise<ContextItemDeletion> {\n const data = await invokeWithRetry(this.config, this.http, 'ContextItemsController_delete', {\n pathParams: { uid },\n })\n return data as ContextItemDeletion\n }\n\n /**\n * Move a live file or Files folder.\n *\n * Pass exactly one destination: `destinationFolderUid` (an existing folder,\n * or `null` for the Files root), or `destinationFolderPath` (a root-relative\n * path such as `reports/2026`; missing folders on it are created with the\n * move). Same-parent moves succeed as a no-op. Does not rename or merge folders.\n *\n * @param uid - Stored context-item uid of the file or folder to move.\n * @param options.destinationFolderUid - Stored context-item uid of the\n * destination folder, or `null` for the Files root.\n * @param options.destinationFolderPath - Root-relative destination folder path.\n * @returns How many items changed parent (`0` is a successful no-op).\n * @throws {NotFoundError} The source is missing or not visible.\n * @throws {ModusError} The destination is missing, not a Files folder, or\n * the move would create a cycle (HTTP 400).\n * @throws {PermissionDeniedError} The destination exists but is not writable\n * for this caller.\n * @throws {ConflictError} A sibling with the same name already exists.\n *\n * @example\n * ```ts\n * const moved = await mgmt.context.items.move('PLACEHOLDER_UID', {\n * destinationFolderUid: 'PLACEHOLDER_FOLDER_UID',\n * })\n * console.log(moved.movedItems)\n * ```\n */\n async move(\n uid: string,\n options:\n | { destinationFolderUid: string | null; destinationFolderPath?: never }\n | { destinationFolderPath: string; destinationFolderUid?: never },\n ): Promise<ContextItemMove> {\n const data = await invokeWithRetry(\n this.config,\n this.http,\n 'ContextItemsController_move' as OperationId,\n {\n pathParams: { uid },\n jsonBody: moveBody(options),\n },\n )\n return data as ContextItemMove\n }\n\n /**\n * Replace who can view and manage a note, saved query, link or uploaded file.\n *\n * All three settings are required and replace the current ones. You cannot\n * remove your own manage access. An item created before items had owners\n * becomes yours on the first change.\n *\n * @param uid - UUID of the context item.\n * @param input.visibility - `shared` (the owner plus the groups in\n * `groupPermissions`) or `private` (the owner plus the users in `sharedWith`).\n * @param input.groupPermissions - Group id to `{ use, manage }`. Used only when shared.\n * @param input.sharedWith - Users such as `{ email: 'ana@example.com', permission: 'use' }`.\n * Used only when private.\n * @returns The item's new access settings and whether you can still manage it.\n * @throws {NotFoundError} The item does not exist or you cannot view it.\n * @throws {PermissionDeniedError} You can view the item but not manage it.\n * @throws {ModusError} The item is another type, a group or user is invalid,\n * or the change would remove your own manage access.\n *\n * @example\n * ```ts\n * await mgmt.context.items.updateAccess('PLACEHOLDER_UID', {\n * visibility: 'private',\n * groupPermissions: {},\n * sharedWith: [{ email: 'ana@example.com', permission: 'use' }],\n * })\n * ```\n */\n async updateAccess(\n uid: string,\n input: UpdateContextItemAccessInput,\n ): Promise<ContextItemAccessUpdate> {\n const data = await invokeWithRetry(\n this.config,\n this.http,\n 'ContextItemAccessController_updateAccess' as OperationId,\n {\n pathParams: { uid },\n jsonBody: {\n visibility: input.visibility,\n groupPermissions: input.groupPermissions,\n sharedWith: input.sharedWith,\n },\n },\n )\n return data as ContextItemAccessUpdate\n }\n}\n","import { ContextArtifactsResourceBase } from '../../_generated/resources/management/context/artifacts.js'\nimport { ContextArtifactCommentsResourceBase } from '../../_generated/resources/management/context/artifactComments.js'\nimport { ContextDashboardAlertsResourceBase } from '../../_generated/resources/management/context/dashboardAlerts.js'\nimport { ContextGraphResourceBase } from '../../_generated/resources/management/context/graph.js'\nimport { ContextOrgLearningsResourceBase } from '../../_generated/resources/management/context/orgLearnings.js'\nimport { ContextReportingResourceBase } from '../../_generated/resources/management/context/reporting.js'\nimport { ContextSuggestionsResourceBase } from '../../_generated/resources/management/context/suggestions.js'\nimport type { OperationId } from '../../_generated/operations.js'\nimport type { ModusConfig } from '../../_config.js'\nimport type { HttpClient } from '../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../_request.js'\nimport type { ContextItem, CreatedContextItem } from '../../types/context.js'\nimport { withCreatedUid } from '../../types/context.js'\nimport { CustomContextItemsResource } from '../../resources/context/custom-items.js'\nimport {\n resolveAndUpdateLink,\n resolveAndUpdateNote,\n resolveAndUpdateSavedQuery,\n type UserFeedback,\n} from './_content-merge.js'\nimport { ManagementDashboardsResource } from './dashboards.js'\nimport { ManagementContextFilesResource } from './files.js'\nimport { ManagementContextItemsResource } from './items.js'\n\n/** Review suggestions using the same visibility rules as the Context page. */\nexport class ContextSuggestionsResource extends ContextSuggestionsResourceBase {}\n\n/** Manage artifact drafts, folders, publications, and versions. */\nexport class ContextArtifactsResource extends ContextArtifactsResourceBase {}\n\n/** List and manage artifact comment threads. */\nexport class ContextArtifactCommentsResource extends ContextArtifactCommentsResourceBase {}\n\n/** Configure and manage published dashboard alerts. */\nexport class ContextDashboardAlertsResource extends ContextDashboardAlertsResourceBase {}\n\n/** Read the Context graph and its node relations. */\nexport class ContextGraphResource extends ContextGraphResourceBase {}\n\n/** List and manage organization learnings. */\nexport class ContextOrgLearningsResource extends ContextOrgLearningsResourceBase {}\n\n/** Read Context reports and manage coverage refreshes. */\nexport class ContextReportingResource extends ContextReportingResourceBase {}\n\n/**\n * Create and update context items (notes, links, saved queries, file uploads).\n *\n * Call path: `mgmt.context` after `new ModusManagement(...)`.\n */\nexport class ManagementContextResource {\n readonly suggestions: ContextSuggestionsResource\n readonly items: ManagementContextItemsResource\n readonly customItems: CustomContextItemsResource\n readonly files: ManagementContextFilesResource\n readonly dashboards: ManagementDashboardsResource\n readonly artifacts: ContextArtifactsResource\n readonly artifactComments: ContextArtifactCommentsResource\n readonly dashboardAlerts: ContextDashboardAlertsResource\n readonly graph: ContextGraphResource\n readonly orgLearnings: ContextOrgLearningsResource\n readonly reporting: ContextReportingResource\n\n /** @internal */\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {\n this.suggestions = new ContextSuggestionsResource(http, config)\n this.items = new ManagementContextItemsResource(http, config)\n this.customItems = new CustomContextItemsResource(http, config)\n this.files = new ManagementContextFilesResource(http, config)\n this.dashboards = new ManagementDashboardsResource(http, config)\n this.artifacts = new ContextArtifactsResource(http, config)\n this.artifactComments = new ContextArtifactCommentsResource(http, config)\n this.dashboardAlerts = new ContextDashboardAlertsResource(http, config)\n this.graph = new ContextGraphResource(http, config)\n this.orgLearnings = new ContextOrgLearningsResource(http, config)\n this.reporting = new ContextReportingResource(http, config)\n }\n\n /**\n * Add a free-form text note to the knowledge base.\n *\n * @param title - Note title.\n * @param content - Note body (markdown).\n * @returns The created context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const note = await mgmt.context.createNote('Runbook', '# Steps\\n1. Check logs')\n * ```\n */\n createNote(title: string, content: string): Promise<CreatedContextItem> {\n return this.create('ContextCreatorsController_createNote', omitUndefined({ title, content }))\n }\n\n /**\n * Update a note's title and markdown body.\n *\n * Preserves server-owned fields on the existing content blob. Pass `existing`\n * to skip a fetch when you already have the item from a list call.\n *\n * @param uid - Context item uid.\n * @param options.title - New title.\n * @param options.body - New markdown body.\n * @param options.existing - Optional cached item to avoid a GET.\n * @returns The updated context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const item = await mgmt.context.updateNote('PLACEHOLDER_UID', {\n * title: 'Runbook',\n * body: '# Steps\\n1. Check logs\\n2. Escalate',\n * })\n * ```\n */\n updateNote(\n uid: string,\n options: {\n title: string\n body: string\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n ): Promise<ContextItem> {\n return resolveAndUpdateNote(this.items, uid, options)\n }\n\n /**\n * Save a SQL query to the knowledge base.\n *\n * @param name - Display name for the query.\n * @param options.connectionId - Connection the query runs against.\n * @param options.query - SQL text.\n * @param options.path - Optional hierarchy path segments.\n * @returns The created context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const query = await mgmt.context.createSavedQuery('Monthly ARR', {\n * connectionId: 'conn_warehouse',\n * query: 'select * from arr_monthly',\n * })\n * ```\n */\n createSavedQuery(\n name: string,\n options: {\n query?: string\n connectionId: string\n description?: string\n path?: string[]\n },\n ): Promise<CreatedContextItem> {\n return this.create(\n 'ContextCreatorsController_createSavedQuery',\n omitUndefined({\n name,\n query: options.query,\n connectionId: options.connectionId,\n description: options.description,\n path: options.path,\n }),\n )\n }\n\n /**\n * Update a saved query's name, SQL, and optional connection metadata.\n *\n * @param uid - Context item uid.\n * @param options.name - New display name.\n * @param options.query - New SQL text.\n * @param options.existing - Optional cached item to avoid a GET.\n * @returns The updated context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const item = await mgmt.context.updateSavedQuery('PLACEHOLDER_UID', {\n * name: 'Monthly ARR',\n * query: 'select sum(amount) from arr_monthly',\n * })\n * ```\n */\n updateSavedQuery(\n uid: string,\n options: {\n name: string\n query: string\n connectionId?: string\n path?: string[]\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n ): Promise<ContextItem> {\n return resolveAndUpdateSavedQuery(this.items, uid, options)\n }\n\n /**\n * Add a URL to the knowledge base.\n *\n * @param url - Link URL.\n * @param options.title - Optional display title.\n * @param options.isCrawl - When true, crawl linked pages into context.\n * @param options.pageLimit - Maximum pages to crawl when `isCrawl` is true.\n * @returns The created context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const link = await mgmt.context.createLink('https://docs.example.com/runbook', {\n * title: 'Ops runbook',\n * })\n * ```\n */\n createLink(\n url: string,\n options: { title?: string; isCrawl?: boolean; pageLimit?: number } = {},\n ): Promise<CreatedContextItem> {\n return this.create(\n 'ContextCreatorsController_createLink',\n omitUndefined({\n url,\n title: options.title,\n isCrawl: options.isCrawl,\n pageLimit: options.pageLimit,\n }),\n )\n }\n\n /**\n * Update link metadata on an existing item.\n *\n * Merges `title` and/or `url` into the stored content blob. Does not re-fetch or re-crawl the URL.\n *\n * @param uid - Context item uid.\n * @param options.title - New display title.\n * @param options.url - New URL.\n * @param options.existing - Optional cached item to avoid a GET.\n * @returns The updated context item.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const item = await mgmt.context.updateLink('PLACEHOLDER_UID', {\n * title: 'Ops runbook (2025)',\n * })\n * ```\n */\n updateLink(\n uid: string,\n options: {\n title?: string\n url?: string\n existing?: ContextItem\n description?: string\n userFeedback?: UserFeedback\n topics?: string[]\n },\n ): Promise<ContextItem> {\n return resolveAndUpdateLink(this.items, uid, options)\n }\n\n /** @internal */\n private async create(operationId: OperationId, payload: Record<string, unknown>): Promise<CreatedContextItem> {\n const data = await invokeWithRetry(this.config, this.http, operationId, {\n jsonBody: payload,\n })\n return withCreatedUid(data as Parameters<typeof withCreatedUid>[0])\n }\n}\n\nexport type { UserFeedback } from './_content-merge.js'\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../../_request.js'\nimport { validateId, validatePageSize } from '../../../_validation.js'\nimport type {\n CreatePersonalAssistant,\n PersonalAssistant,\n PersonalAssistantId,\n UpdatePersonalAssistant,\n} from '../../../types/assistants.js'\nimport type {\n McpExposureCatalog,\n McpExposureCatalogRequest,\n} from '../../../management/scopes/mcp-exposure-catalog.js'\nimport type {\n Scope,\n ScopeCachedDescription,\n ScopeGenerateDescriptionRequest,\n ScopeGeneratedDescription,\n ScopeGoalOptions,\n ScopeMcpConnection,\n ScopeMcpConnectionDetail,\n ScopeMcpConnectionList,\n ScopeMcpCreateRequest,\n ScopeMcpDiscoverRequest,\n ScopeMcpDiscoverResponse,\n ScopeVariationList,\n SelectableCallTarget,\n} from '../../../types/scopes.js'\nimport type { VariationView } from '../../../types/views.js'\n\n/** Generated base for the management `scopes` resource. */\nexport class ScopesResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List scopes.\n *\n * Returns a paginated page of scopes the caller can at least `use`. Scopes the caller cannot see\n * are filtered out. Pagination uses an opaque token returned in `nextPageToken`.\n *\n * **Requires:** `scopes:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @param options.search - Case-insensitive substring filter on scope name.\n * @param options.view - Variation view. `active` reads the deployed version, or the latest draft\n * when nothing is published. `draft` reads the latest builder snapshot. `published` reads only\n * the published version, and only scopes you can use.\n * @param options.managerId - Return only scopes supervised by this manager scope id.\n * @returns A page of scopes.\n *\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * for await (const scope of (await mgmt.scopes.list()).autoPagingIter()) {\n * console.log(scope.id, scope.name, scope.status)\n * }\n * ```\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n search?: string\n view?: VariationView\n managerId?: number\n } = {}): Promise<Page<Scope>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken, options.search, options.view, options.managerId)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n search?: string,\n view?: VariationView,\n managerId?: number,\n ): Promise<Page<Scope>> {\n const extra: Record<string, string | number> = {}\n if (search !== undefined) extra.search = search\n if (view !== undefined) extra.view = view\n if (managerId !== undefined) extra.managerId = managerId\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ScopesController_list', {\n query: aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'scopes',\n (raw) => raw as Scope,\n (token) => this.listPage(pageSize, token, search, view, managerId),\n )\n }\n\n /**\n * Get a scope.\n *\n * Returns a scope. `view=active` (default) is the deployed version, or the latest draft when\n * nothing is published. `view=draft` is the latest edits. `view=published` is only the published\n * version, and only if you can use the scope. Returns 404 if you cannot access it.\n *\n * **Requires:** `scopes:read`\n *\n * @param scopeId - Numeric scope id.\n * @param options.view - Which version to read. Defaults to `active`. `published` is only the\n * published version, and only if you can use the scope.\n *\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const scope = await mgmt.scopes.get('PLACEHOLDER_SCOPE_ID')\n * console.log(scope.name, scope.status)\n * ```\n */\n async get(\n scopeId: number | string,\n options: { view?: VariationView } = {},\n ): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_get', {\n pathParams: { id: scopeId },\n query: { view: options.view },\n })\n return data as Scope\n }\n\n /**\n * Delete a scope.\n *\n * Deletes a scope. The scope can be restored later with POST /scopes/{id}/restore. Returns 404 if\n * the scope does not exist or is already deleted.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n *\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * await mgmt.scopes.delete('PLACEHOLDER_SCOPE_ID')\n * ```\n */\n async delete(scopeId: number | string): Promise<void> {\n validateId(scopeId, 'scope_id')\n await invokeWithRetry(this.config, this.http, 'ScopesController_delete', {\n pathParams: { id: scopeId },\n })\n }\n\n /**\n * Preview MCP exposure catalog.\n *\n * Lists tools this scope can expose to MCP clients. A field you send replaces the current draft;\n * a field you omit stays as stored. Nothing is saved. Entries you cannot access are left out, and\n * stored selections on them are counted in hiddenSelectedCount.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n * @param request - Request body; see `McpExposureCatalogRequest`.\n *\n * @example\n * ```ts\n * const catalog = await mgmt.scopes.mcpExposureCatalog(42, {})\n * catalog.discoveryAllowed\n * ```\n */\n async mcpExposureCatalog(\n scopeId: number | string,\n request: McpExposureCatalogRequest,\n ): Promise<McpExposureCatalog> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_mcpExposureCatalog', {\n pathParams: { id: scopeId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as McpExposureCatalog\n }\n\n /**\n * Restore a deleted scope.\n *\n * Restores a previously deleted scope and returns it. Restoring a scope that is already active\n * returns it unchanged.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n */\n async restore(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_restore', {\n pathParams: { id: scopeId },\n jsonBody: {},\n })\n return data as Scope\n }\n\n /**\n * Cancel ownership transfer.\n *\n * Cancels a pending ownership transfer. The current owner may cancel, the pending recipient may\n * decline, and for a scope with no owner an organization owner may cancel.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n */\n async cancelOwnershipTransfer(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_cancelOwnershipTransfer', {\n pathParams: { id: scopeId },\n })\n return data as Scope\n }\n\n /**\n * Accept ownership transfer.\n *\n * Accepts a pending ownership transfer. Only the pending recipient may invoke this action.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n */\n async acceptOwnershipTransfer(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_acceptOwnershipTransfer', {\n pathParams: { id: scopeId },\n jsonBody: {},\n })\n return data as Scope\n }\n\n /**\n * List scope versions.\n *\n * Lists a scope's versions, newest first. Returns 404 if you cannot access the scope.\n *\n * **Requires:** `scopes:read`\n *\n * @param scopeId - Numeric scope id.\n * @param options.limit - Max versions to return. Defaults to 100 and is capped there.\n */\n async listVariations(\n scopeId: number | string,\n options: { limit?: number } = {},\n ): Promise<ScopeVariationList> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_listVariations', {\n pathParams: { id: scopeId },\n query: { limit: options.limit },\n })\n return data as ScopeVariationList\n }\n\n /**\n * List the tools an MCP server advertises.\n *\n * Stateless discovery — connects to the supplied MCP URL with the supplied auth config and\n * returns the advertised tool definitions. No connection row is persisted.\n *\n * **Requires:** `scopes:write`\n *\n * @param request - Request body; see `ScopeMcpDiscoverRequest`.\n */\n async discoverMcpConnections(request: ScopeMcpDiscoverRequest): Promise<ScopeMcpDiscoverResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'ScopeMcpConnectionsController_discover', {\n jsonBody: request,\n })\n return data as ScopeMcpDiscoverResponse\n }\n\n /**\n * Test + save an MCP connection on a scope.\n *\n * Three-step saga: validate the MCP URL (SSRF/shape check), list tools, persist auth credentials\n * in AWS Secrets Manager, then write the snapshot row. On snapshot-insert failure the secret is\n * rolled back. Returns the persisted connection summary.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n * @param request - Request body; see `ScopeMcpCreateRequest`.\n */\n async createMcpConnection(\n scopeId: number | string,\n request: ScopeMcpCreateRequest,\n ): Promise<ScopeMcpConnection> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeMcpConnectionsController_create', {\n pathParams: { id: scopeId },\n jsonBody: request,\n })\n return data as ScopeMcpConnection\n }\n\n /**\n * List MCP connections attached to a scope.\n *\n * Returns the scope’s MCP connections, newest first. The caller must be able to use the scope.\n *\n * **Requires:** `scopes:read`\n *\n * @param scopeId - Numeric scope id.\n */\n async listMcpConnections(scopeId: number | string): Promise<ScopeMcpConnectionList> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeMcpConnectionsController_list', {\n pathParams: { id: scopeId },\n })\n return data as ScopeMcpConnectionList\n }\n\n /**\n * Read a single MCP connection.\n *\n * Returns the full snapshot (including the rich tool definitions with input schemas) for one MCP\n * connection on a scope. Caller must at least `use` the scope. Requires `scopes:read`.\n *\n * **Requires:** `scopes:read`\n *\n * @param scopeId - Numeric scope id.\n * @param connectionId - MCP connection UUID.\n */\n async getMcpConnection(\n scopeId: number | string,\n connectionId: number | string,\n ): Promise<ScopeMcpConnectionDetail> {\n validateId(scopeId, 'scope_id')\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeMcpConnectionsController_get', {\n pathParams: { id: scopeId, connId: connectionId },\n })\n return data as ScopeMcpConnectionDetail\n }\n\n /**\n * Fetch the cached generated description for a scope.\n *\n * Returns the latest generated description for the requested variation, or the active variation\n * if omitted. Returns null when no description exists. Requires access to the scope.\n *\n * **Requires:** `scopes:read`\n *\n * @param scopeId - Numeric scope id.\n * @param options.variationId - Variation UUID. When omitted, the scope's active variation is\n * used.\n */\n async getGeneratedDescription(\n scopeId: number | string,\n options: { variationId?: string } = {},\n ): Promise<ScopeCachedDescription> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeDescriptionController_getGenerated', {\n pathParams: { id: scopeId },\n query: { variationId: options.variationId },\n })\n return data as ScopeCachedDescription\n }\n\n /**\n * Generate a scope description.\n *\n * Synchronously generates an AI description for the scope's configuration via the LLM gateway. If\n * a description already exists for the target variation and `force=false`, the cached value is\n * returned without invoking the LLM (`cached: true`). Requires manage permission on the scope.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n * @param request - Request body; see `ScopeGenerateDescriptionRequest`.\n */\n async generateDescription(\n scopeId: number | string,\n request: ScopeGenerateDescriptionRequest,\n ): Promise<ScopeGeneratedDescription> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeDescriptionController_generate', {\n pathParams: { id: scopeId },\n jsonBody: request,\n })\n return data as ScopeGeneratedDescription\n }\n\n /**\n * List selectable call targets.\n *\n * Lists scopes that the given scope may call.\n *\n * **Requires:** `scopes:read`\n *\n * @param scopeId - Numeric scope id.\n */\n async listSelectableCallTargets(scopeId: number | string): Promise<SelectableCallTarget[]> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopesController_selectableCallTargets', {\n pathParams: { id: scopeId },\n })\n return data as SelectableCallTarget[]\n }\n\n /**\n * Suggest scope goals.\n *\n * Drafts example goals from the connections the caller can use and the scope purpose. The caller\n * must be able to manage the scope.\n *\n * **Requires:** `scopes:write`\n *\n * @param scopeId - Numeric scope id.\n */\n async getGoalOptions(scopeId: number | string): Promise<ScopeGoalOptions> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeGoalOptionsController_get', {\n pathParams: { id: scopeId },\n })\n return data as ScopeGoalOptions\n }\n\n /**\n * List assistants.\n *\n * Lists assistants the caller can use or manage, including their conversation identifiers.\n *\n * **Requires:** `scopes:read`\n */\n async listAssistants(): Promise<PersonalAssistant[]> {\n const data = await invokeWithRetry(this.config, this.http, 'AssistantsController_list')\n return data as PersonalAssistant[]\n }\n\n /**\n * Create an assistant.\n *\n * Creates an assistant owned by the authenticated person and publishes its scope.\n *\n * **Requires:** `scopes:write`\n *\n * @param request - Request body; see `CreatePersonalAssistant`.\n */\n async createAssistant(request: CreatePersonalAssistant): Promise<PersonalAssistantId> {\n const data = await invokeWithRetry(this.config, this.http, 'AssistantsController_create', {\n jsonBody: request,\n })\n return data as PersonalAssistantId\n }\n\n /**\n * Update an assistant.\n *\n * Updates an assistant the authenticated person is allowed to manage.\n *\n * **Requires:** `scopes:write`\n *\n * @param assistantId - Assistant UUID.\n * @param request - Request body; see `UpdatePersonalAssistant`.\n */\n async updateAssistant(\n assistantId: number | string,\n request: UpdatePersonalAssistant,\n ): Promise<PersonalAssistantId> {\n validateId(assistantId, 'assistant_id')\n const data = await invokeWithRetry(this.config, this.http, 'AssistantsController_update', {\n pathParams: { id: assistantId },\n jsonBody: request,\n })\n return data as PersonalAssistantId\n }\n\n /**\n * Delete an assistant.\n *\n * Deletes an assistant owned or managed by the authenticated person.\n *\n * **Requires:** `scopes:write`\n *\n * @param assistantId - Assistant UUID.\n */\n async deleteAssistant(assistantId: number | string): Promise<void> {\n validateId(assistantId, 'assistant_id')\n await invokeWithRetry(this.config, this.http, 'AssistantsController_remove', {\n pathParams: { id: assistantId },\n })\n }\n}\n","const EVERYONE_GROUP_ID = '__everyone__'\n\nexport function accessConfigWireForCreate(guardrails: string[]): Record<string, unknown> {\n return {\n visibility: 'shared',\n groupPermissions: { [EVERYONE_GROUP_ID]: { use: true, manage: true } },\n guardrails,\n sharedWith: [],\n }\n}\n\nexport function accessConfigWireForUpdate(\n existing: Record<string, unknown> | undefined,\n guardrails: string[],\n): Record<string, unknown> {\n if (!existing || Object.keys(existing).length === 0) {\n return accessConfigWireForCreate(guardrails)\n }\n return { ...existing, guardrails }\n}\n\nexport function accessFromSkillResponse(raw: Record<string, unknown>): Record<string, unknown> {\n const value = raw.accessConfig ?? raw.access_config\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n return value as Record<string, unknown>\n }\n return {}\n}\n\nexport function accessConfigBodyForCreate(\n guardrails?: string[],\n): Record<string, unknown> | undefined {\n if (guardrails === undefined) return undefined\n return accessConfigWireForCreate(guardrails)\n}\n\nexport async function accessConfigBodyForUpdate(\n guardrails: string[] | undefined,\n loadResource: () => Promise<Record<string, unknown>>,\n): Promise<Record<string, unknown> | undefined> {\n if (guardrails === undefined) return undefined\n const existing = accessFromSkillResponse(await loadResource())\n return accessConfigWireForUpdate(existing, guardrails)\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../../_pagination.js'\nimport { updateMaskQuery } from '../../../../_query.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../../../_request.js'\nimport { validateId, validatePageSize } from '../../../../_validation.js'\nimport type {\n Memory,\n MemorySearchRequest,\n MemorySearchResult,\n MemoryUpdate,\n} from '../../../../management/types/memories.js'\n\n/** Generated base for the management `scopes.memories` resource. */\nexport class ScopesMemoriesResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly scopeId: number | string,\n ) {}\n\n /**\n * List scope memories.\n *\n * Returns a page of the scope’s memories (up to 1000 total). Pass `nextPageToken` as `pageToken`\n * to fetch the next page. Optional `userId` filters to one end user.\n *\n * **Requires:** `scopes:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @param options.userId - Narrow results to memories tagged with this end-user id.\n * @returns A page of memories.\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n userId?: string\n } = {}): Promise<Page<Memory>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken, options.userId)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n userId?: string,\n ): Promise<Page<Memory>> {\n validateId(this.scopeId, 'scope_id')\n const extra: Record<string, string> = {}\n if (userId !== undefined) extra.userId = userId\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ScopeMemoriesController_list', {\n pathParams: { id: this.scopeId },\n query: aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'memories',\n (raw) => raw as Memory,\n (token) => this.listPage(pageSize, token, userId),\n )\n }\n\n /**\n * Search scope memories.\n *\n * Returns memories ranked by semantic similarity to the supplied `query`. Caller must at least\n * `use` the scope. Optional `userId` and `limit` body fields narrow the result set (legacy parity\n * with `search-memories`).\n *\n * **Requires:** `scopes:read`\n *\n * @param request - Request body; see `MemorySearchRequest`.\n */\n async search(request: MemorySearchRequest): Promise<MemorySearchResult> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeMemoriesController_search', {\n pathParams: { id: this.scopeId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as MemorySearchResult\n }\n\n /**\n * Update a memory.\n *\n * Updates one memory. Supply at least one of `memory` or `metadata`. Use `updateMask` to limit\n * which fields change.\n *\n * **Requires:** `scopes:write`\n *\n * @param memoryId - Opaque memory id as returned by the list / search endpoints.\n * @param update - Request body; see `MemoryUpdate`.\n * @param options.updateMask - Comma-separated list of fields to update. Omit to update all\n * provided fields.\n */\n async update(\n memoryId: string,\n update: MemoryUpdate,\n options: { updateMask?: string } = {},\n ): Promise<void> {\n validateId(memoryId, 'memory_id')\n validateId(this.scopeId, 'scope_id')\n await invokeWithRetry(this.config, this.http, 'ScopeMemoriesController_update', {\n pathParams: { id: this.scopeId, memoryId },\n query: updateMaskQuery(options.updateMask),\n jsonBody: omitUndefined(update as Record<string, unknown>),\n })\n }\n\n /**\n * Delete a memory.\n *\n * Deletes one memory. Returns 404 if the memory does not exist or is already deleted.\n *\n * **Requires:** `scopes:write`\n *\n * @param memoryId - Opaque memory id as returned by the list / search endpoints.\n */\n async delete(memoryId: string): Promise<void> {\n validateId(memoryId, 'memory_id')\n validateId(this.scopeId, 'scope_id')\n await invokeWithRetry(this.config, this.http, 'ScopeMemoriesController_delete', {\n pathParams: { id: this.scopeId, memoryId },\n })\n }\n}\n","import { ScopesMemoriesResourceBase } from '../../_generated/resources/management/scopes/memories.js'\n\n/** Long-term memory stored per scope. */\nexport class ScopeMemoriesResource extends ScopesMemoriesResourceBase {}\n","import { randomUUID } from 'node:crypto'\nimport { ScopesEvaluationsResourceBase } from '../../_generated/resources/management/scopes/evaluations.js'\nimport { invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type { AddEvaluationCase, EvaluationCase, UpdateEvaluationCase } from '../types/evaluations.js'\n\n/** Scheduled and manual scope evaluations. */\nexport class ScopeEvaluationsResource extends ScopesEvaluationsResourceBase {\n /**\n * Add one evaluation case and return the stored case.\n *\n * @param input.task - What the scope should do. An empty string is allowed.\n * @param input.expectedOutput - What a correct result looks like. An empty string is allowed.\n * @param input.id - Stable id. Omit it and the client assigns one before the request, so a retry sends the same id.\n * @returns The stored evaluation case, including its id.\n * @throws ConflictError An evaluation case with this id already exists. A retry after the case was stored returns this error. An identical body is not treated as success.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const added = await mgmt.scopes.evaluations(42).addCase({\n * task: \"Summarize last quarter's revenue\",\n * expectedOutput: 'A one-paragraph summary with the total',\n * })\n * console.log(added.id)\n * ```\n */\n async addCase(input: AddEvaluationCase): Promise<EvaluationCase> {\n validateId(this.scopeId, 'scope_id')\n const id = input.id ?? randomUUID()\n validateId(id, 'id')\n return await invokeWithRetry(this.config, this.http, 'ScopesController_addEvaluationCase', {\n pathParams: { id: this.scopeId },\n jsonBody: omitUndefined({ ...input, id }),\n }) as EvaluationCase\n }\n\n /**\n * Change the task, the expected output, or both, for one evaluation case.\n *\n * @param caseId - Id of the case to change.\n * @param patch.task - Replacement task. Omit to leave it unchanged.\n * @param patch.expectedOutput - Replacement expected output. Omit to leave it unchanged.\n * @returns The evaluation case after the change.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const updated = await mgmt.scopes.evaluations(42).updateCase('CASE_ID', {\n * task: 'Summarize revenue in two sentences',\n * })\n * console.log(updated.task)\n * ```\n */\n async updateCase(caseId: string, patch: UpdateEvaluationCase): Promise<EvaluationCase> {\n validateId(this.scopeId, 'scope_id')\n validateId(caseId, 'case_id')\n return await invokeWithRetry(this.config, this.http, 'ScopesController_updateEvaluationCase', {\n pathParams: { id: this.scopeId, caseId },\n jsonBody: omitUndefined(patch),\n }) as EvaluationCase\n }\n\n /**\n * Remove one evaluation case. The other cases stay as they are.\n *\n * @param caseId - Id of the case to remove.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * await mgmt.scopes.evaluations(42).deleteCase('CASE_ID')\n * ```\n */\n async deleteCase(caseId: string): Promise<void> {\n validateId(this.scopeId, 'scope_id')\n validateId(caseId, 'case_id')\n await invokeWithRetry(this.config, this.http, 'ScopesController_deleteEvaluationCase', {\n pathParams: { id: this.scopeId, caseId },\n })\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../../../_request.js'\nimport { validateId, validatePageSize } from '../../../../_validation.js'\nimport type {\n EvaluationConfig,\n EvaluationRun,\n EvaluationRunWithResults,\n TriggerEvaluationRunResponse,\n UpdateEvaluationConfig,\n} from '../../../../management/types/evaluations.js'\n\n/** Generated base for the management `scopes.evaluations` resource. */\nexport class ScopesEvaluationsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly scopeId: number | string,\n ) {}\n\n /**\n * Get evaluation configuration.\n *\n * Returns the evaluation configuration for a scope, including judge settings, schedule cadence,\n * and notification preferences.\n *\n * **Requires:** `scopes:read`\n */\n async getConfig(): Promise<EvaluationConfig> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'EvaluationsController_getConfig', {\n pathParams: { id: this.scopeId },\n })\n return data as EvaluationConfig\n }\n\n /**\n * Update evaluation configuration.\n *\n * Updates the evaluation configuration for a scope. Changes to the schedule cadence are synced\n * automatically.\n *\n * **Requires:** `scopes:write`\n *\n * @param update - Request body; see `UpdateEvaluationConfig`.\n */\n async updateConfig(update: UpdateEvaluationConfig): Promise<EvaluationConfig> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'EvaluationsController_updateConfig', {\n pathParams: { id: this.scopeId },\n jsonBody: omitUndefined(update as Record<string, unknown>),\n })\n return data as EvaluationConfig\n }\n\n /**\n * Trigger evaluation run.\n *\n * Triggers a manual evaluation run for the scope. The run executes asynchronously.\n *\n * **Requires:** `scopes:write`\n *\n * @returns Evaluation run accepted and queued. The run executes asynchronously; poll `GET\n * /scopes/{id}/evaluations/runs/{runId}` for status.\n */\n async triggerRun(): Promise<TriggerEvaluationRunResponse> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'EvaluationsController_triggerRun', {\n pathParams: { id: this.scopeId },\n })\n return data as TriggerEvaluationRunResponse\n }\n\n /**\n * List evaluation runs.\n *\n * Returns a paginated list of evaluation runs for the scope, ordered by most recent first.\n *\n * **Requires:** `scopes:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @returns A page of runs.\n */\n listRuns(options: {\n pageSize?: number\n pageToken?: string\n } = {}): Promise<Page<EvaluationRun>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listRunsPage(pageSize, options.pageToken)\n }\n\n protected async listRunsPage(\n pageSize: number,\n pageToken: string | undefined,\n ): Promise<Page<EvaluationRun>> {\n validateId(this.scopeId, 'scope_id')\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'EvaluationsController_listRuns', {\n pathParams: { id: this.scopeId },\n query: aipListParams(pageSize, pageToken) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'runs',\n (raw) => raw as EvaluationRun,\n (token) => this.listRunsPage(pageSize, token),\n )\n }\n\n /**\n * Get evaluation run.\n *\n * Returns details of an evaluation run including all per-case results.\n *\n * **Requires:** `scopes:read`\n *\n * @param runId - Run ID.\n */\n async getRun(runId: string): Promise<EvaluationRunWithResults> {\n validateId(this.scopeId, 'scope_id')\n validateId(runId, 'run_id')\n const data = await invokeWithRetry(this.config, this.http, 'EvaluationsController_getRun', {\n pathParams: { id: this.scopeId, runId },\n })\n return data as EvaluationRunWithResults\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type { ScopeInterface } from '../../../../management/scopes/interfaces.js'\n\n/** Generated base for the management `scopes.interfaces` resource. */\nexport class ScopesInterfacesResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly scopeId: number | string,\n ) {}\n\n /**\n * List the chat interfaces of a scope.\n *\n * Returns the chat interfaces (at most one per chat platform) that let people use this scope from\n * chat. Requires manage permission on the scope, because the config lists allowed emails.\n *\n * **Requires:** `scopes:read`\n */\n async list(): Promise<ScopeInterface[]> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeInterfacesController_list', {\n pathParams: { id: this.scopeId },\n })\n return (data as { interfaces: ScopeInterface[] }).interfaces\n }\n\n /**\n * Remove a scope interface.\n *\n * Removes one chat interface from the scope. Mentions on that chat platform stop reaching this\n * scope immediately.\n *\n * **Requires:** `scopes:write`\n *\n * @param interfaceId - Interface id (UUID).\n */\n async delete(interfaceId: string): Promise<void> {\n validateId(this.scopeId, 'scope_id')\n validateId(interfaceId, 'interface_id')\n await invokeWithRetry(this.config, this.http, 'ScopeInterfacesController_delete', {\n pathParams: { id: this.scopeId, interfaceId },\n })\n }\n}\n","import { ScopesInterfacesResourceBase } from '../../_generated/resources/management/scopes/interfaces.js'\nimport { updateBody, updateMaskQuery } from '../../_query.js'\nimport { invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type { components } from '../../_generated/v1.js'\n\nexport type ScopeInterface = components['schemas']['ScopeInterfaceDto']\nexport type AddScopeInterface = components['schemas']['AddScopeInterfaceDto']\nexport type UpdateScopeInterface = components['schemas']['UpdateScopeInterfaceDto']\n\nexport class ScopeInterfacesResource extends ScopesInterfacesResourceBase {\n\n /**\n * Add a Slack or Microsoft Teams interface to this scope.\n *\n * @param options - Interface type, optional name and config.\n * @returns The created interface.\n */\n async create(options: AddScopeInterface): Promise<ScopeInterface> {\n validateId(this.scopeId, 'scope_id')\n return await invokeWithRetry(this.config, this.http, 'ScopeInterfacesController_add', {\n pathParams: { id: this.scopeId },\n jsonBody: omitUndefined(options),\n }) as ScopeInterface\n }\n\n /**\n * Update an interface on this scope.\n *\n * @param interfaceId - Interface id.\n * @param options - Updated name and/or config.\n * @param updateMask - Optional comma-separated field names to update.\n * @returns The updated interface.\n */\n async update(interfaceId: string, options: UpdateScopeInterface, updateMask?: string): Promise<ScopeInterface> {\n validateId(this.scopeId, 'scope_id')\n validateId(interfaceId, 'interface_id')\n return await invokeWithRetry(this.config, this.http, 'ScopeInterfacesController_update', {\n pathParams: { id: this.scopeId, interfaceId },\n query: updateMaskQuery(updateMask),\n jsonBody: updateBody(options, updateMask),\n }) as ScopeInterface\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../../_config.js'\nimport type { HttpClient } from '../../../../_http.js'\nimport { invokeWithRetry } from '../../../../_request.js'\nimport { validateId } from '../../../../_validation.js'\nimport type {\n SetSupervisionRequest,\n Supervision,\n} from '../../../../management/scopes/supervision.js'\nimport type { SupervisionView } from '../../../../types/views.js'\n\n/** Generated base for the management `scopes.supervision` resource. */\nexport class ScopesSupervisionResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n protected readonly scopeId: number | string,\n ) {}\n\n /**\n * Read the scope subordinate supervision list.\n *\n * Returns the list of subordinate scope ids managed by this scope. `?view=active` (default) reads\n * the deployed supervision set; `?view=draft` reads the most recent builder snapshot. Returns 404\n * when the caller cannot at least `use` the scope.\n *\n * **Requires:** `scopes:read`\n *\n * @param options.view - Which variation snapshot to read. Defaults to `active`.\n */\n async get(options: { view?: SupervisionView } = {}): Promise<Supervision> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeSupervisionController_get', {\n pathParams: { id: this.scopeId },\n query: { view: options.view },\n })\n return data as Supervision\n }\n\n /**\n * Replace draft subordinate supervision list.\n *\n * Replaces the draft subordinate list; an empty array clears it. Each scope you add must exist\n * and be one you can use; scopes already listed can be kept or removed. Requires manage\n * permission on the supervisor. A deployed scope picks it up at the next deploy; a never-deployed\n * one shows it at once.\n *\n * **Requires:** `scopes:write`\n *\n * @param request - Request body; see `SetSupervisionRequest`.\n */\n async set(request: SetSupervisionRequest): Promise<Supervision> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeSupervisionController_set', {\n pathParams: { id: this.scopeId },\n jsonBody: request,\n })\n return data as Supervision\n }\n\n /**\n * Replace active subordinate supervision list.\n *\n * Replaces the active subordinate list without a deploy; an empty array clears it. Each scope you\n * add must exist and be one you can use; scopes already in the list can be kept or removed.\n * Requires manage permission on the supervisor.\n *\n * **Requires:** `scopes:write`\n *\n * @param request - Request body; see `SetSupervisionRequest`.\n */\n async setActive(request: SetSupervisionRequest): Promise<Supervision> {\n validateId(this.scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, 'ScopeSupervisionController_setActive', {\n pathParams: { id: this.scopeId },\n jsonBody: request,\n })\n return data as Supervision\n }\n}\n","import { ScopesSupervisionResourceBase } from '../../_generated/resources/management/scopes/supervision.js'\nimport type { components } from '../../_generated/v1.js'\n\nexport type Supervision = components['schemas']['SupervisionDto']\nexport type SetSupervisionRequest = components['schemas']['SetSupervisionRequestDto']\n\nexport class ScopeSupervisionResource extends ScopesSupervisionResourceBase {}\n","import { ScopesResourceBase } from '../../_generated/resources/management/scopes.js'\nimport type { OperationId } from '../../_generated/operations.js'\nimport { updateBody, updateMaskQuery } from '../../_query.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport { ScopeConversationsResource } from '../../resources/scopes/conversations.js'\nimport type { Scope } from '../../types/scopes.js'\nimport {\n accessConfigBodyForCreate,\n accessConfigBodyForUpdate,\n} from '../_access-config.js'\nimport type { components } from '../../_generated/v1.js'\nimport type { JsonObjectListInput } from '../types/json-blob.js'\nimport type { ToolsetInput } from '../types/toolset.js'\nimport { ScopeMemoriesResource } from './memories.js'\nimport { ScopeEvaluationsResource } from './evaluations.js'\nimport { ScopeInterfacesResource } from './interfaces.js'\nimport { ScopeSupervisionResource } from './supervision.js'\n\n/** The canonical `/api/v1/scopes` management operationIds. */\ninterface ManagementScopesOperations {\n readonly list: OperationId\n readonly get: OperationId\n readonly create: OperationId\n readonly update: OperationId\n readonly deploy: OperationId\n readonly applySelectionOps: OperationId\n readonly delete: OperationId\n readonly restore: OperationId\n readonly requestOwnershipTransfer: OperationId\n readonly cancelOwnershipTransfer: OperationId\n readonly acceptOwnershipTransfer: OperationId\n readonly patchMcpConfig: OperationId\n readonly getVariation: OperationId\n}\n\n/** A connectionSet row from `scopes.get`, or a plain `{ connection_id, preferences }` object. */\ntype ConnectionSetRowInput = components['schemas']['ConnectionSetItemDto']\n\nconst MANAGEMENT_SCOPE_OPERATIONS: ManagementScopesOperations = {\n list: 'ScopesController_list',\n get: 'ScopesController_get',\n create: 'ScopesController_create',\n update: 'ScopesController_update',\n deploy: 'ScopesController_deploy',\n applySelectionOps: 'ScopesController_applySelectionOps',\n delete: 'ScopesController_delete',\n restore: 'ScopesController_restore',\n requestOwnershipTransfer: 'ScopesController_requestOwnershipTransfer',\n cancelOwnershipTransfer: 'ScopesController_cancelOwnershipTransfer',\n acceptOwnershipTransfer: 'ScopesController_acceptOwnershipTransfer',\n patchMcpConfig: 'ScopesController_patchMcpConfig',\n getVariation: 'ScopesController_getVariation',\n}\n\nfunction parseScope(raw: unknown): Scope {\n return raw as Scope\n}\n\nexport interface CreateScopeOptions {\n name: string\n description?: string\n expectedOutput?: string\n instructions?: string[]\n toolset?: ToolsetInput\n model?: string\n connectionSet?: ReadonlyArray<ConnectionSetRowInput>\n contextSelections?: JsonObjectListInput\n includeOwnLearnings?: boolean\n includeOrgLearnings?: boolean\n interfaces?: JsonObjectListInput\n guardrails?: string[]\n}\n\n/** @deprecated Use `CreateScopeOptions` instead. */\nexport type CreateSkillOptions = CreateScopeOptions\n\nexport interface UpdateScopeOptions {\n name?: string\n description?: string\n expectedOutput?: string\n instructions?: string[]\n toolset?: ToolsetInput\n model?: string\n connectionSet?: ReadonlyArray<ConnectionSetRowInput>\n contextSelections?: JsonObjectListInput\n interfaces?: JsonObjectListInput\n guardrails?: string[]\n /** Numeric id of the manager scope, or `null` to detach from the current manager. */\n managerId?: number | null\n evaluations?: JsonObjectListInput\n supervisionSubordinateDescriptions?: Record<string, string>\n updateMask?: string\n}\n\n/** @deprecated Use `UpdateScopeOptions` instead. */\nexport type UpdateSkillOptions = UpdateScopeOptions\n\n/**\n * Full CRUD and lifecycle for Modus scopes.\n *\n * Call path: `mgmt.scopes` after `new ModusManagement(...)`.\n */\nexport class ManagementScopesResource extends ScopesResourceBase {\n protected readonly ops: ManagementScopesOperations = MANAGEMENT_SCOPE_OPERATIONS\n\n /**\n * Conversations for a scope.\n *\n * @param scopeId - Scope id.\n * @returns A conversations resource scoped to the scope.\n */\n conversations(scopeId: number | string): ScopeConversationsResource {\n return new ScopeConversationsResource(this.http, this.config, scopeId)\n }\n\n /**\n * Long-term memories for a scope.\n *\n * @param scopeId - Scope id.\n * @returns A memories resource scoped to the scope.\n */\n memories(scopeId: number | string): ScopeMemoriesResource {\n return new ScopeMemoriesResource(this.http, this.config, scopeId)\n }\n\n /**\n * Evaluations for a scope.\n *\n * @param scopeId - Scope id.\n * @returns An evaluations resource scoped to the scope.\n */\n evaluations(scopeId: number | string): ScopeEvaluationsResource {\n return new ScopeEvaluationsResource(this.http, this.config, scopeId)\n }\n\n /**\n * Supervision (subordinate scopes) for a scope.\n *\n * @param scopeId - Scope id.\n * @returns A supervision resource scoped to the scope.\n */\n supervision(scopeId: number | string): ScopeSupervisionResource {\n return new ScopeSupervisionResource(this.http, this.config, scopeId)\n }\n\n /**\n * Slack and Microsoft Teams interfaces for a scope.\n *\n * @param scopeId - Scope id.\n * @returns An interfaces resource scoped to the scope.\n */\n interfaces(scopeId: number | string): ScopeInterfacesResource {\n return new ScopeInterfacesResource(this.http, this.config, scopeId)\n }\n\n /**\n * Create a new scope in the organization.\n *\n * @param options.name - Display name for the scope.\n * @param options.description - Optional description.\n * @param options.instructions - Optional system instructions.\n * @param options.model - Optional model id.\n * @param options.toolset - Optional tool selection for the scope.\n * @param options.includeOwnLearnings - Whether the scope reads what is taught while using it. Defaults to true.\n * @param options.includeOrgLearnings - Whether create adds the org-wide learnings path (`auto_generated:org`) to the scope's selections. Defaults to true; not applied when `contextSelections` already mention learnings or are context filters without a rule-based query. `false` only skips that addition: selections that already name the path still read org-wide learnings.\n * @param options.guardrails - Runtime guardrail labels (for example `\"no-pii\"`). Omit to create with no guardrails.\n * @returns The created scope (draft).\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const scope = await mgmt.scopes.create({ name: 'Support assistant', model: 'claude-sonnet-5' })\n * console.log(scope.id, scope.name)\n * ```\n */\n async create(options: CreateScopeOptions): Promise<Scope> {\n const body = omitUndefined({\n name: options.name,\n description: options.description,\n expectedOutput: options.expectedOutput,\n instructions: options.instructions,\n toolset: options.toolset,\n model: options.model,\n connectionSet: options.connectionSet,\n contextSelections: options.contextSelections,\n includeOwnLearnings: options.includeOwnLearnings,\n includeOrgLearnings: options.includeOrgLearnings,\n interfaces: options.interfaces,\n accessConfig: accessConfigBodyForCreate(options.guardrails),\n })\n const data = await invokeWithRetry(this.config, this.http, this.ops.create, {\n jsonBody: body,\n })\n return parseScope(data)\n }\n\n /**\n * Update a scope's configuration.\n *\n * Only the fields you pass are changed. To clear a field, name it in\n * `updateMask` (comma-separated field names) and leave its argument unset:\n * it is sent as `null`.\n *\n * @param scopeId - Numeric scope id.\n * @param options.guardrails - Guardrail labels to set. Fetches the current scope first to merge. Pass `[]` to clear all.\n * @param options.managerId - Numeric id of the manager scope to move this scope under, or `null`\n * to detach it. Send it alone: the server rejects it combined with other fields.\n * @param options.updateMask - Comma-separated field names to update or clear.\n * @returns The updated scope.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const scope = await mgmt.scopes.update('PLACEHOLDER_SCOPE_ID', {\n * description: 'Answers billing questions for enterprise customers.',\n * })\n * ```\n */\n async update(scopeId: number | string, options: UpdateScopeOptions = {}): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const accessConfig = await accessConfigBodyForUpdate(options.guardrails, async () =>\n asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.get, {\n pathParams: { id: scopeId },\n }),\n ),\n )\n const fields = {\n name: options.name,\n description: options.description,\n expectedOutput: options.expectedOutput,\n instructions: options.instructions,\n toolset: options.toolset,\n model: options.model,\n connectionSet: options.connectionSet,\n contextSelections: options.contextSelections,\n interfaces: options.interfaces,\n accessConfig,\n managerId: options.managerId,\n evaluations: options.evaluations,\n supervisionSubordinateDescriptions: options.supervisionSubordinateDescriptions,\n }\n const body = updateBody(fields, options.updateMask)\n const data = await invokeWithRetry(this.config, this.http, this.ops.update, {\n pathParams: { id: scopeId },\n query: updateMaskQuery(options.updateMask),\n jsonBody: body,\n })\n return parseScope(data)\n }\n\n /**\n * Publish the current draft of a scope.\n *\n * @param scopeId - Scope id.\n * @returns The published scope.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const scope = await mgmt.scopes.create({ name: 'Support assistant' })\n * const published = await mgmt.scopes.deploy(scope.id)\n * console.log(published.status)\n * ```\n */\n async deploy(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.deploy, {\n pathParams: { id: scopeId },\n jsonBody: {},\n }),\n )\n return parseScope(data.scope)\n }\n\n /**\n * Apply selection changes to a scope.\n *\n * Pass `validateOnly: true` to run the same checks and return the scope that would\n * be saved, without writing. Set a connection with `setConnectionPreferences` and\n * remove it with `removeConnection`. To add one built-in tool action, pass\n * `{ op: \"enableToolAction\", tool: \"visualization_creator\", action: \"report_generation\" }`.\n *\n * @param scopeId - Scope id.\n * @param ops - Selection changes, applied in order.\n * @param options.toolset - The scope toolset after the edit, when the edit changed it.\n * @param options.validateOnly - When true, check and return the planned scope without writing.\n * @returns The scope, or the scope that would be saved when `validateOnly` is true.\n * @example\n * ```ts\n * const mgmt = new ModusManagement()\n * const preview = await mgmt.scopes.applySelectionOps(42, [{\n * op: 'setConnectionPreferences',\n * connectionId: '11111111-1111-4111-8111-111111111111',\n * preferences: { schemaVersion: 2, mode: 'all', include: [], exclude: [] },\n * }], { validateOnly: true })\n * console.log(preview.id)\n * ```\n */\n async applySelectionOps(\n scopeId: number | string,\n ops: ReadonlyArray<Record<string, unknown>>,\n options?: { toolset?: Record<string, unknown>; validateOnly?: boolean },\n ): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, this.ops.applySelectionOps, {\n pathParams: { id: scopeId },\n jsonBody: omitUndefined({\n ops,\n toolset: options?.toolset,\n validateOnly: options?.validateOnly ? true : undefined,\n }),\n })\n return parseScope(data)\n }\n\n /**\n * Start transferring ownership of a scope to another organization member.\n *\n * The current owner calls this, and the recipient accepts. A scope with no owner (one\n * created with a service-account token) can be given one by an organization owner;\n * assigning yourself takes effect at once.\n *\n * @param scopeId - Scope id.\n * @param options.newOwnerUserId - User id of the proposed new owner.\n * @returns The scope with a pending ownership transfer.\n */\n async requestOwnershipTransfer(\n scopeId: number | string,\n options: { newOwnerUserId: string },\n ): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.requestOwnershipTransfer,\n {\n pathParams: { id: scopeId },\n jsonBody: omitUndefined({ newOwnerUserId: options.newOwnerUserId }),\n },\n )\n return parseScope(data)\n }\n\n /**\n * Update MCP server configuration for a scope.\n *\n * @param scopeId - Scope id.\n * @param options.mcpConfig - MCP configuration object.\n */\n async patchMcpConfig(\n scopeId: number | string,\n options: { mcpConfig: Record<string, unknown> },\n ): Promise<void> {\n validateId(scopeId, 'scope_id')\n await invokeWithRetry(this.config, this.http, this.ops.patchMcpConfig, {\n pathParams: { id: scopeId },\n jsonBody: omitUndefined({ config: options.mcpConfig }),\n })\n }\n\n /**\n * Retrieve a specific scope variation by uid.\n *\n * @param scopeId - Scope id.\n * @param options.variationUid - Variation uid.\n * @returns The scope variation.\n */\n async getVariation(\n scopeId: number | string,\n options: { variationUid: string },\n ): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n validateId(options.variationUid, 'variation_uid')\n const data = await invokeWithRetry(this.config, this.http, this.ops.getVariation, {\n pathParams: { id: scopeId, variationUid: options.variationUid },\n })\n return parseScope(data)\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../_pagination.js'\nimport { asRecord, invokeWithRetry } from '../../../_request.js'\nimport { validatePageSize } from '../../../_validation.js'\nimport type { AuditEvent, AuditEventOrder } from '../../../management/types/audit-events.js'\nimport type {\n AuditEventCountResponse,\n AuditFacetsResponse,\n} from '../../../types/organization-operations.js'\n\n/** Generated base for the management `auditEvents` resource. */\nexport class AuditEventsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List audit events.\n *\n * Returns who did what and when in your organization, newest first by default. Events are kept\n * for 92 days. Filter by time range, actor, action or resource; every filter matches exactly.\n * Order with `orderBy=occurredAt asc` or `occurredAt desc`. Requires an owner or admin, or a\n * token granted `audit:read`.\n *\n * **Requires:** `audit:read`\n *\n * @param options.pageSize - Items per page. Defaults to 50.\n * @param options.pageToken - Opaque token from a previous response's `nextPageToken`.\n * @param options.from - Only events at or after this time (RFC 3339).\n * @param options.to - Only events before this time (RFC 3339); exclusive.\n * @param options.resource - Only events on exactly this resource id.\n * @param options.outcome - Only events with any of these outcomes: `success` or `failure`. Repeat\n * the parameter for several values.\n * @param options.orderBy - `occurredAt asc` or `occurredAt desc` (default).\n * @returns A page of auditEvents.\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n from?: string\n to?: string\n resource?: string\n outcome?: readonly string[]\n orderBy?: AuditEventOrder\n } = {}): Promise<Page<AuditEvent>> {\n const pageSize = options.pageSize ?? 50\n validatePageSize(pageSize, 200)\n return this.listPage(pageSize, options.pageToken, options.from, options.to, options.resource, options.outcome, options.orderBy)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n from?: string,\n to?: string,\n resource?: string,\n outcome?: readonly string[],\n orderBy?: AuditEventOrder,\n ): Promise<Page<AuditEvent>> {\n const extra: Record<string, string | readonly string[]> = {}\n if (from !== undefined) extra.from = from\n if (to !== undefined) extra.to = to\n if (resource !== undefined) extra.resource = resource\n if (outcome !== undefined) extra.outcome = outcome\n if (orderBy !== undefined) extra.orderBy = orderBy\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'AuditEventsController_list', {\n query: aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'auditEvents',\n (raw) => raw as AuditEvent,\n (token) => this.listPage(pageSize, token, from, to, resource, outcome, orderBy),\n )\n }\n\n /**\n * List audit event filter values.\n *\n * Returns the distinct actions and actors of the events in a time window (at most 92 days), up to\n * 200 of each, to offer as choices for the `action` and `actorId` filters. Requires an owner or\n * admin, or a token granted `audit:read`.\n *\n * **Requires:** `audit:read`\n *\n * @param options.from - Read values from events at or after this time (RFC 3339).\n * @param options.to - Read values from events before this time (RFC 3339); exclusive.\n *\n * @example\n * await mgmt.auditEvents.listFacets({ from: \"2026-11-30T12:00:00Z\", to: \"2026-11-30T12:00:00Z\" })\n */\n async listFacets(options: { from: string; to: string }): Promise<AuditFacetsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'AuditEventsController_facets', {\n query: { from: options.from, to: options.to },\n })\n return data as AuditFacetsResponse\n }\n\n /**\n * Count audit events.\n *\n * Returns how many events an export of the same time range (at most 92 days) and filters would\n * hold, counted no further than `exportLimit + 1`: a `count` above `exportLimit` means more than\n * `exportLimit` events match and the export would be refused. Requires an owner or admin, or a\n * token granted `audit:read`.\n *\n * **Requires:** `audit:read`\n *\n * @param options.actorId - Only events by any of these actor ids. Repeat the parameter for\n * several values.\n * @param options.action - Only events with any of these exact actions, e.g. `scopes.deploy`.\n * Repeat the parameter for several values.\n * @param options.resource - Only events on exactly this resource id.\n * @param options.actorType - Only events by an actor of any of these types. Repeat the parameter\n * for several values.\n * @param options.credential - Only events authenticated with any of these credentials. Repeat the\n * parameter for several values.\n * @param options.client - Only events from any of these client kinds; `none` matches events that\n * named no client. Repeat the parameter for several values.\n * @param options.outcome - Only events with any of these outcomes: `success` or `failure`. Repeat\n * the parameter for several values.\n * @param options.from - Count events at or after this time (RFC 3339).\n * @param options.to - Count events before this time (RFC 3339); exclusive. At most 92 days after\n * `from`.\n *\n * @example\n * await mgmt.auditEvents.count({ from: \"2026-11-30T12:00:00Z\", to: \"2026-11-30T12:00:00Z\" })\n */\n async count(options: { actorId?: readonly string[]; action?: readonly string[]; resource?: string; actorType?: readonly string[]; credential?: readonly string[]; client?: readonly string[]; outcome?: readonly string[]; from: string; to: string }): Promise<AuditEventCountResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'AuditEventsController_count', {\n query: { actorId: options.actorId, action: options.action, resource: options.resource, actorType: options.actorType, credential: options.credential, client: options.client, outcome: options.outcome, from: options.from, to: options.to },\n })\n return data as AuditEventCountResponse\n }\n}\n","import { AuditEventsResourceBase } from '../_generated/resources/management/auditEvents.js'\n\nimport type { components } from '../_generated/v1.js'\nimport { getOperation, operationBaseUrl } from '../_openapi-invoke.js'\n\nexport type AuditExportRequest = components['schemas']['ExportAuditEventsDto']\n\n/** Read who did what and when in your organization. Requires an owner or admin API key. */\nexport class ManagementAuditEventsResource extends AuditEventsResourceBase {\n /**\n * Download a CSV or JSON audit export as UTF-8 text. Requires audit:read.\n * @param request - The export format, time window and optional event filters.\n * @example\n * const csv = await mgmt.auditEvents.exportFile({ from: '2026-01-01T00:00:00Z', to: '2026-01-02T00:00:00Z', format: 'csv' })\n */\n async exportFile(request: AuditExportRequest): Promise<string> {\n const op = getOperation('AuditEventsController_export')\n return this.http.postText(op.path, request, { baseUrl: operationBaseUrl(this.http, op) })\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { invokeWithRetry } from '../../../_request.js'\nimport type {\n UsageServiceAccountsReport,\n UsageUsersReport,\n UserActivityReport,\n} from '../../../types/usage.js'\n\n/** Generated base for the management `usage` resource. */\nexport class UsageResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List usage users.\n *\n * Returns the distinct acting-user emails that appear in your organization's usage over the\n * `[since, until)` window. Feeds the usage page's user filter (includes non-Modus Slack/Teams\n * users). Scoped to your organization.\n *\n * **Requires:** `usage:read`\n *\n * @param options.since - ISO8601 start of the query window (inclusive).\n * @param options.until - ISO8601 end of the query window (exclusive).\n */\n async listUsers(options: { since: string; until: string }): Promise<UsageUsersReport> {\n const data = await invokeWithRetry(this.config, this.http, 'UsageController_listUsers', {\n query: { since: options.since, until: options.until },\n })\n return data as UsageUsersReport\n }\n\n /**\n * List service accounts with usage in a time window.\n *\n * **Requires:** `usage:read`\n *\n * @param options.since - ISO8601 start of the query window (inclusive).\n * @param options.until - ISO8601 end of the query window (exclusive).\n *\n * @example\n * await management.usage.listServiceAccounts({ since: '2026-05-01T00:00:00Z', until: '2026-05-08T00:00:00Z' })\n */\n async listServiceAccounts(options: { since: string; until: string }): Promise<UsageServiceAccountsReport> {\n const data = await invokeWithRetry(this.config, this.http, 'UsageServiceAccountsController_list', {\n query: { since: options.since, until: options.until },\n })\n return data as UsageServiceAccountsReport\n }\n\n /**\n * Get user activity over a time window.\n *\n * **Requires:** `usage:read`\n *\n * @param options.since - Start of the chart window, inclusive.\n * @param options.until - End of the chart window, exclusive.\n * @param options.window_since - Start of the custom user ranking window. Supply both bounds.\n * @param options.window_until - End of the custom user ranking window.\n * @param options.sa_window_since - Start of the service-account ranking window. Supply both\n * bounds.\n * @param options.sa_window_until - End of the service-account ranking window.\n * @param options.include_modus_employees - Include employee activity when the caller has\n * permission.\n *\n * @example\n * await management.usage.getUserActivity({ since: '2026-05-01T00:00:00Z', until: '2026-05-08T00:00:00Z' })\n */\n async getUserActivity(options: { since: string; until: string; window_since?: string; window_until?: string; sa_window_since?: string; sa_window_until?: string; include_modus_employees?: boolean }): Promise<UserActivityReport> {\n const data = await invokeWithRetry(this.config, this.http, 'UserActivityController_get', {\n query: { since: options.since, until: options.until, window_since: options.window_since, window_until: options.window_until, sa_window_since: options.sa_window_since, sa_window_until: options.sa_window_until, include_modus_employees: options.include_modus_employees },\n })\n return data as UserActivityReport\n }\n}\n","import { UsageResourceBase } from '../_generated/resources/management/usage.js'\nimport { invokeWithRetry } from '../_request.js'\nimport type { UsageReport, UsageRollup } from '../types/usage.js'\n\nexport class ManagementUsageResource extends UsageResourceBase {\n /**\n * List usage metrics for your organization over a time window.\n *\n * @param options.since - Start of the window (ISO 8601, inclusive).\n * @param options.until - End of the window (ISO 8601, exclusive).\n * @param options.rollup - Bucket size for each row: `\"hour\"` or `\"day\"`.\n * @param options.model - Optional filter to a single model name.\n * @param options.userEmail - Optional filter to one or more acting-user emails.\n * @returns Usage report rows for the window.\n * @throws {UnprocessableError} When the request is rejected by the API.\n * @throws {AuthenticationError} When the API key is invalid or missing.\n */\n async list(options: {\n since: string\n until: string\n rollup: UsageRollup\n model?: string\n userEmail?: readonly string[]\n }): Promise<UsageReport> {\n const query: Record<string, string | string[]> = {\n since: options.since,\n until: options.until,\n rollup: options.rollup,\n }\n if (options.model !== undefined) query.model = options.model\n if (options.userEmail !== undefined) query.user_email = [...options.userEmail]\n const data = await invokeWithRetry(this.config, this.http, 'UsageController_list', { query })\n return data as UsageReport\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { aipListParams, buildAipPage, type Page } from '../../../_pagination.js'\nimport { asRecord, invokeWithRetry } from '../../../_request.js'\nimport { validatePageSize } from '../../../_validation.js'\nimport type { ToolCatalogEntry } from '../../../types/tools.js'\n\n/** Generated base for the management `tools` resource. */\nexport class ToolsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List available tools.\n *\n * Returns a page of known tool/integration surfaces a scope can select in its toolset, with the\n * fixed actions for built-in tools.\n *\n * **Requires:** `scopes:read`\n *\n * @param options.pageSize - Items per page. Defaults to 25.\n * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit\n * for the first page.\n * @returns A page of tools.\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n } = {}): Promise<Page<ToolCatalogEntry>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken)\n }\n\n protected async listPage(\n pageSize: number,\n pageToken: string | undefined,\n ): Promise<Page<ToolCatalogEntry>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ToolsController_list', {\n query: aipListParams(pageSize, pageToken) as Record<\n string,\n string | number | boolean | undefined | null\n >,\n }),\n )\n return buildAipPage(\n data,\n 'tools',\n (raw) => raw as ToolCatalogEntry,\n (token) => this.listPage(pageSize, token),\n )\n }\n}\n","import { ToolsResourceBase } from '../_generated/resources/management/tools.js'\n\n/** Browse the catalog of tool and integration surfaces a scope can select in its toolset. */\nexport class ManagementToolsResource extends ToolsResourceBase {}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { updateMaskQuery } from '../../../_query.js'\nimport { invokeWithRetry, omitUndefined } from '../../../_request.js'\nimport { validateId } from '../../../_validation.js'\nimport type {\n CreateMemberGroup,\n CreateSupportTicket,\n ListSupportTicketsResponse,\n MutateMemberGroupResponse,\n MutateMembers,\n MyMemberGroupIdsResponse,\n OrganizationModelSettings,\n OrganizationProfile,\n OrganizationSettings,\n SetOrgSetting,\n SettingValueResponse,\n SupportTicket,\n UpdateMemberGroup,\n UpdateOrganization,\n UpdateOrganizationProfile,\n UpdateOrganizationResponse,\n UserPreferenceInput,\n UserPreferences,\n} from '../../../types/organization-operations.js'\nimport type { MemberGroup } from '../../../management/users.js'\n\n/** Generated base for the management `users` resource. */\nexport class UsersResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List support tickets for the active org.\n *\n * Returns the 100 most-recently-created support tickets for the principal’s active organization.\n * Requires `users:read`.\n *\n * **Requires:** `users:read`\n *\n * @example\n * await mgmt.users.listSupportTickets()\n */\n async listSupportTickets(): Promise<ListSupportTicketsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'SupportTicketsController_list')\n return data as ListSupportTicketsResponse\n }\n\n /**\n * Create a support ticket for the active org.\n *\n * Inserts a row in the tenant `support_ticket` table. `creatorUserId` is taken from the principal\n * — the body fields are creator display metadata. Requires `users:write`.\n *\n * **Requires:** `users:write`\n *\n * @param input - Request body; see `CreateSupportTicket`.\n *\n * @example\n * await mgmt.users.createSupportTicket({\"title\": \"title\", \"description\": \"description\"})\n */\n async createSupportTicket(input: CreateSupportTicket): Promise<SupportTicket> {\n const data = await invokeWithRetry(this.config, this.http, 'SupportTicketsController_create', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as SupportTicket\n }\n\n /**\n * Update the active organization's Clerk public_metadata.\n *\n * Updates public metadata for the active organization. An update mask excluding publicMetadata\n * leaves it unchanged.\n *\n * **Requires:** `users:write`\n *\n * @param input - Request body; see `UpdateOrganization`.\n * @param options.updateMask - Comma-separated list of fields to update. Omit to update all\n * provided fields.\n *\n * @example\n * await mgmt.users.updateOrganization({\"publicMetadata\": {}})\n */\n async updateOrganization(\n input: UpdateOrganization,\n options: { updateMask?: string } = {},\n ): Promise<UpdateOrganizationResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'OrganizationController_update', {\n query: updateMaskQuery(options.updateMask),\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as UpdateOrganizationResponse\n }\n\n /**\n * Get the active organization company profile.\n *\n * Returns the description of the active organization.\n *\n * **Requires:** `users:read`\n *\n * @example\n * await mgmt.users.getOrganizationProfile()\n */\n async getOrganizationProfile(): Promise<OrganizationProfile> {\n const data = await invokeWithRetry(this.config, this.http, 'OrganizationController_getProfile')\n return data as OrganizationProfile\n }\n\n /**\n * Update the active organization company profile.\n *\n * Updates the description of the active organization. Restricted to organization owners.\n *\n * **Requires:** `organization-profile:write`\n *\n * @param input - Request body; see `UpdateOrganizationProfile`.\n *\n * @example\n * await mgmt.users.updateOrganizationProfile({})\n */\n async updateOrganizationProfile(input: UpdateOrganizationProfile): Promise<OrganizationProfile> {\n const data = await invokeWithRetry(this.config, this.http, 'OrganizationController_updateProfile', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as OrganizationProfile\n }\n\n /**\n * Get organization model availability.\n *\n * Returns the models hidden from new selections in the active organization.\n *\n * **Requires:** `users:read`\n *\n * @example\n * await mgmt.users.getModelSettings()\n */\n async getModelSettings(): Promise<OrganizationModelSettings> {\n const data = await invokeWithRetry(this.config, this.http, 'OrganizationController_getModelSettings')\n return data as OrganizationModelSettings\n }\n\n /**\n * Update organization model availability.\n *\n * Sets the models hidden from new selections in the active organization. Restricted to\n * organization owners and admins.\n *\n * **Requires:** `users:write`\n *\n * @param input - Request body; see `OrganizationModelSettings`.\n *\n * @example\n * await mgmt.users.updateModelSettings({\"disabledModelIds\": [\"gpt-5-mini\"]})\n */\n async updateModelSettings(input: OrganizationModelSettings): Promise<OrganizationModelSettings> {\n const data = await invokeWithRetry(this.config, this.http, 'OrganizationController_updateModelSettings', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as OrganizationModelSettings\n }\n\n /**\n * List the calling user's own member-group ids.\n *\n * Returns every group uid the caller belongs to, including \"__everyone__\" and any\n * directory-sourced groups. Lets the SPA resolve its own membership without the list endpoint\n * exposing other users' directory membership.\n *\n * **Requires:** `users:read`\n *\n * @example\n * await mgmt.users.listMyMemberGroupIds()\n */\n async listMyMemberGroupIds(): Promise<MyMemberGroupIdsResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'MemberGroupsController_mine')\n return data as MyMemberGroupIdsResponse\n }\n\n /**\n * Create a member group.\n *\n * Creates a tenant-scoped member group. Requires `users:write`. Returns 409 when the name\n * collides.\n *\n * **Requires:** `users:write`\n *\n * @param input - Request body; see `CreateMemberGroup`.\n *\n * @example\n * await mgmt.users.createMemberGroup({\"name\": \"Weekly report\"})\n */\n async createMemberGroup(input: CreateMemberGroup): Promise<MemberGroup> {\n const data = await invokeWithRetry(this.config, this.http, 'MemberGroupsController_create', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as MemberGroup\n }\n\n /**\n * Update a member group.\n *\n * Renames or re-descriptions a tenant member group. Requires `users:write`. Returns 404 for\n * unknown ids and 409 for duplicate names. Pass `?updateMask=<csv>` to restrict the write to\n * specific top-level fields; an absent mask preserves the legacy \"write every body field\"\n * behaviour.\n *\n * **Requires:** `users:write`\n *\n * @param input - Request body; see `UpdateMemberGroup`.\n * @param options.updateMask - Comma-separated list of fields to update. Omit to update all\n * provided fields.\n *\n * @example\n * await mgmt.users.updateMemberGroup(\"GROUP_ID\", {})\n */\n async updateMemberGroup(\n groupId: string,\n input: UpdateMemberGroup,\n options: { updateMask?: string } = {},\n ): Promise<MutateMemberGroupResponse> {\n validateId(groupId, 'group_id')\n const data = await invokeWithRetry(this.config, this.http, 'MemberGroupsController_update', {\n pathParams: { groupId },\n query: updateMaskQuery(options.updateMask),\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as MutateMemberGroupResponse\n }\n\n /**\n * Delete a member group.\n *\n * Deletes a tenant member group and its memberships, and removes it from every connection access\n * policy that grants it. Returns 409 when the group is the only one granted access to a\n * connection, or holds its last Manage grant. Requires `users:write`.\n *\n * **Requires:** `users:write`\n *\n * @example\n * await mgmt.users.deleteMemberGroup(\"GROUP_ID\")\n */\n async deleteMemberGroup(groupId: string): Promise<MutateMemberGroupResponse> {\n validateId(groupId, 'group_id')\n const data = await invokeWithRetry(this.config, this.http, 'MemberGroupsController_delete', {\n pathParams: { groupId },\n })\n return data as MutateMemberGroupResponse\n }\n\n /**\n * Add Clerk users to a member group.\n *\n * Adds the given Clerk user ids to the group in one call. Each user id is validated against the\n * live Clerk org roster — unknown ids return 400. Requires `users:write`.\n *\n * **Requires:** `users:write`\n *\n * @param input - Request body; see `MutateMembers`.\n *\n * @example\n * await mgmt.users.addGroupMembers(\"GROUP_ID\", {\"clerkUserIds\": [\"clerk-user-id\"]})\n */\n async addGroupMembers(\n groupId: string,\n input: MutateMembers,\n ): Promise<MutateMemberGroupResponse> {\n validateId(groupId, 'group_id')\n const data = await invokeWithRetry(this.config, this.http, 'MemberGroupsController_addMembers', {\n pathParams: { groupId },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as MutateMemberGroupResponse\n }\n\n /**\n * List the organization's settings.\n *\n * **Requires:** `users:read`\n *\n * @example\n * await mgmt.users.listOrganizationSettings()\n */\n async listOrganizationSettings(): Promise<OrganizationSettings> {\n const data = await invokeWithRetry(this.config, this.http, 'OrgSettingsController_list')\n return data as OrganizationSettings\n }\n\n /**\n * Set one of the organization's settings.\n *\n * **Requires:** `users:write`\n *\n * @param input - Request body; see `SetOrgSetting`.\n *\n * @example\n * await mgmt.users.setOrganizationSetting(\"KEY\", {\"value\": \"value\"})\n */\n async setOrganizationSetting(\n key: string,\n input: SetOrgSetting,\n ): Promise<SettingValueResponse> {\n validateId(key, 'key')\n const data = await invokeWithRetry(this.config, this.http, 'OrgSettingsController_set', {\n pathParams: { key },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as SettingValueResponse\n }\n\n /**\n * Reset one of the organization's settings to its default.\n *\n * **Requires:** `users:write`\n *\n * @example\n * await mgmt.users.resetOrganizationSetting(\"KEY\")\n */\n async resetOrganizationSetting(key: string): Promise<void> {\n validateId(key, 'key')\n await invokeWithRetry(this.config, this.http, 'OrgSettingsController_reset', {\n pathParams: { key },\n })\n }\n\n /**\n * List the caller's preferences.\n *\n * **Requires:** `users:read`\n *\n * @example\n * await mgmt.users.listPreferences()\n */\n async listPreferences(): Promise<UserPreferences> {\n const data = await invokeWithRetry(this.config, this.http, 'UserPreferencesController_list')\n return data as UserPreferences\n }\n\n /**\n * Set one of the caller's preferences.\n *\n * **Requires:** `preferences:write`\n *\n * @param input - Request body; see `UserPreferenceInput`.\n *\n * @example\n * await mgmt.users.setPreference(\"KEY\", {\"visibility\": \"shared\", \"groupPermissions\": {}, \"sharedWith\": []})\n */\n async setPreference(\n key: string,\n input: UserPreferenceInput,\n ): Promise<SettingValueResponse> {\n validateId(key, 'key')\n const data = await invokeWithRetry(this.config, this.http, 'UserPreferencesController_set', {\n pathParams: { key },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as SettingValueResponse\n }\n\n /**\n * Reset one of the caller's preferences to the system default.\n *\n * **Requires:** `preferences:write`\n *\n * @example\n * await mgmt.users.resetPreference(\"KEY\")\n */\n async resetPreference(key: string): Promise<void> {\n validateId(key, 'key')\n await invokeWithRetry(this.config, this.http, 'UserPreferencesController_reset', {\n pathParams: { key },\n })\n }\n\n /**\n * Add a Clerk user to a member group.\n *\n * Adds the Clerk user to the group; a user already in it is left as is. The user id is validated\n * against the live Clerk org roster — an unknown id returns 400. Requires `users:write`.\n *\n * **Requires:** `users:write`\n *\n * @example\n * await mgmt.users.addGroupMember(\"GROUP_ID\", \"USER_ID\")\n */\n async addGroupMember(\n groupId: string,\n userId: string,\n ): Promise<MutateMemberGroupResponse> {\n validateId(groupId, 'group_id')\n validateId(userId, 'user_id')\n const data = await invokeWithRetry(this.config, this.http, 'MemberGroupsController_addMember', {\n pathParams: { groupId, userId },\n })\n return data as MutateMemberGroupResponse\n }\n\n /**\n * Remove a Clerk user from a member group.\n *\n * Removes the Clerk user from the group. Idempotent — a no-op for a user not in the group.\n * Requires `users:write`.\n *\n * **Requires:** `users:write`\n *\n * @example\n * await mgmt.users.removeGroupMember(\"GROUP_ID\", \"USER_ID\")\n */\n async removeGroupMember(\n groupId: string,\n userId: string,\n ): Promise<MutateMemberGroupResponse> {\n validateId(groupId, 'group_id')\n validateId(userId, 'user_id')\n const data = await invokeWithRetry(this.config, this.http, 'MemberGroupsController_removeMember', {\n pathParams: { groupId, userId },\n })\n return data as MutateMemberGroupResponse\n }\n}\n","import { UsersResourceBase } from '../_generated/resources/management/users.js'\nimport type { components } from '../_generated/v1.js'\nimport { invokeWithRetry } from '../_request.js'\n\nexport type MemberGroup = components['schemas']['MemberGroupDto']\nexport type OrgMember = components['schemas']['OrgMemberDto']\n\nexport class ManagementUsersResource extends UsersResourceBase {\n\n /** List member groups in the organization. */\n async listMemberGroups(): Promise<MemberGroup[]> {\n const data = (await invokeWithRetry(\n this.config, this.http, 'MemberGroupsController_list',\n )) as { groups: MemberGroup[] }\n return data.groups\n }\n\n /** List organization members. */\n async listOrgMembers(): Promise<OrgMember[]> {\n const data = (await invokeWithRetry(\n this.config, this.http, 'OrgMembersController_list',\n )) as { members: OrgMember[] }\n return data.members\n }\n}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../../_request.js'\nimport { validateId } from '../../../_validation.js'\nimport type {\n ConnectGitFork,\n GitConnectFork,\n GitDisconnect,\n GitForkState,\n GitStatus,\n GitSyncState,\n} from '../../../types/git.js'\n\n/** Generated base for the management `git` resource. */\nexport class GitResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * Get git connection status.\n *\n * **Requires:** `users:read`\n */\n async getStatus(): Promise<GitStatus> {\n const data = await invokeWithRetry(this.config, this.http, 'GitSyncController_getStatus')\n return data as GitStatus\n }\n\n /**\n * List git sync state.\n *\n * **Requires:** `users:read`\n */\n async listSyncState(): Promise<GitSyncState> {\n const data = await invokeWithRetry(this.config, this.http, 'GitSyncController_listSyncState')\n return data as GitSyncState\n }\n\n /**\n * Get git fork state.\n *\n * **Requires:** `users:read`\n */\n async getForkState(options: { connectionId: string }): Promise<GitForkState> {\n const data = await invokeWithRetry(this.config, this.http, 'GitSyncController_listForkState', {\n query: { connectionId: options.connectionId },\n })\n return data as GitForkState\n }\n\n /**\n * Disconnect git.\n *\n * **Requires:** `users:write`\n */\n async disconnect(): Promise<GitDisconnect> {\n const data = await invokeWithRetry(this.config, this.http, 'GitSyncController_disconnect')\n return data as GitDisconnect\n }\n\n /**\n * Connect a git fork.\n *\n * **Requires:** `users:write`\n *\n * @param connectionId - Git connection ID.\n * @param request - Request body; see `ConnectGitFork`.\n */\n async connectFork(\n connectionId: string,\n request: ConnectGitFork,\n ): Promise<GitConnectFork> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'GitSyncController_connectPublicFork', {\n pathParams: { connectionId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as GitConnectFork\n }\n}\n","import { GitResourceBase } from '../_generated/resources/management/git.js'\n\n/** Manage the organization's Git connection. */\nexport class ManagementGitResource extends GitResourceBase {}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../../_request.js'\nimport type {\n LlmProviderCatalog,\n ModelRouting,\n ReplaceModelRouting,\n} from '../../../types/provider-catalog.js'\n\n/** Generated base for the management `llm` resource. */\nexport class LlmResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * List LLM provider metadata.\n *\n * Lists provider identifiers, aliases, types, and health without credential or configuration\n * details.\n *\n * **Requires:** `users:write`\n */\n async listProviders(): Promise<LlmProviderCatalog> {\n const data = await invokeWithRetry(this.config, this.http, 'LlmController_listProviderCatalog')\n return data as LlmProviderCatalog\n }\n\n /**\n * Get model routing configuration.\n *\n * **Requires:** `llm-routing:manage`\n */\n async getModelRouting(): Promise<ModelRouting> {\n const data = await invokeWithRetry(this.config, this.http, 'LlmController_getModelRouting')\n return data as ModelRouting\n }\n\n /**\n * Replace model routing configuration.\n *\n * **Requires:** `llm-routing:manage`\n *\n * @param request - Request body; see `ReplaceModelRouting`.\n */\n async replaceModelRouting(request: ReplaceModelRouting): Promise<ModelRouting> {\n const data = await invokeWithRetry(this.config, this.http, 'LlmController_replaceModelRouting', {\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as ModelRouting\n }\n}\n","import { LlmResourceBase } from '../_generated/resources/management/llm.js'\n/** Read organization LLM provider metadata. */\nexport class ManagementLlmResource extends LlmResourceBase {}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../../_request.js'\nimport type {\n GroupAccessResponse,\n ReplaceGroupAccess,\n ReplaceSensitivityOverrides,\n SecuritySummary,\n SensitivityOverridesResponse,\n} from '../../../types/organization-operations.js'\n\n/** Generated base for the management `security` resource. */\nexport class SecurityResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * Get DLP sensitivity summary.\n *\n * Returns level counts (sensitive/flagged items) plus two sunburst chart trees: one by data\n * location (integration → asset) and one by DLP category. Requires `security:read`.\n *\n * **Requires:** `security:read`\n *\n * @example\n * await mgmt.security.getSummary()\n */\n async getSummary(): Promise<SecuritySummary> {\n const data = await invokeWithRetry(this.config, this.http, 'SecurityController_getSummary')\n return data as SecuritySummary\n }\n\n /**\n * List sensitivity level overrides.\n *\n * Lists per-org overrides that override the platform defaults for DLP info-type sensitivity\n * levels. Requires `security:read`.\n *\n * **Requires:** `security:read`\n *\n * @example\n * await mgmt.security.listOverrides()\n */\n async listOverrides(): Promise<SensitivityOverridesResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'SecurityController_listOverrides')\n return data as SensitivityOverridesResponse\n }\n\n /**\n * Replace sensitivity level overrides.\n *\n * Replaces ALL per-org sensitivity overrides in a single transaction. An empty array clears all\n * overrides, restoring platform defaults. Requires `security:write`.\n *\n * **Requires:** `security:write`\n *\n * @param input - Request body; see `ReplaceSensitivityOverrides`.\n *\n * @example\n * await mgmt.security.replaceOverrides({\"overrides\": []})\n */\n async replaceOverrides(input: ReplaceSensitivityOverrides): Promise<SensitivityOverridesResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'SecurityController_replaceOverrides', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as SensitivityOverridesResponse\n }\n\n /**\n * List group sensitivity access.\n *\n * Lists which member groups are allowed to access which sensitivity levels. Requires\n * `security:read`.\n *\n * **Requires:** `security:read`\n *\n * @example\n * await mgmt.security.listGroupAccess()\n */\n async listGroupAccess(): Promise<GroupAccessResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'SecurityController_listGroupAccess')\n return data as GroupAccessResponse\n }\n\n /**\n * Replace group sensitivity access.\n *\n * Replaces ALL group → level access assignments in a single transaction. An empty array clears\n * all assignments. Requires `security:write`.\n *\n * **Requires:** `security:write`\n *\n * @param input - Request body; see `ReplaceGroupAccess`.\n *\n * @example\n * await mgmt.security.replaceGroupAccess({\"entries\": []})\n */\n async replaceGroupAccess(input: ReplaceGroupAccess): Promise<GroupAccessResponse> {\n const data = await invokeWithRetry(this.config, this.http, 'SecurityController_replaceGroupAccess', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as GroupAccessResponse\n }\n}\n","import { SecurityResourceBase } from '../_generated/resources/management/security.js'\n/** Manage sensitivity classifications and access. */\nexport class ManagementSecurityResource extends SecurityResourceBase {}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../../_request.js'\nimport { validateId } from '../../../_validation.js'\nimport type {\n ActivateDirectorySync,\n DirectorySyncActivation,\n DirectorySyncDisabled,\n DirectorySyncGroups,\n DirectorySyncMappedGroup,\n DirectorySyncMappedGroups,\n DirectorySyncOverview,\n DirectorySyncRetry,\n DirectorySyncSetup,\n DirectorySyncUsedGroup,\n MapDirectorySyncGroup,\n MapDirectorySyncGroups,\n} from '../../../types/provider-catalog.js'\n\n/** Generated base for the management `directorySync` resource. */\nexport class DirectorySyncResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * Get directory sync overview.\n *\n * Returns directory sync status without diagnostic details.\n *\n * **Requires:** `users:read`\n */\n async getOverview(): Promise<DirectorySyncOverview> {\n const data = await invokeWithRetry(this.config, this.http, 'DirectorySyncController_getOverview')\n return data as DirectorySyncOverview\n }\n\n /**\n * Get directory sync DWD setup parameters.\n *\n * Returns the domain-wide-delegation client ID, service account address, and scopes an admin\n * authorizes in the Workspace console. Returns 503 when the platform DWD secret is unconfigured.\n *\n * **Requires:** `users:write`\n */\n async getSetup(): Promise<DirectorySyncSetup> {\n const data = await invokeWithRetry(this.config, this.http, 'DirectorySyncController_getSetup')\n return data as DirectorySyncSetup\n }\n\n /**\n * Activate directory sync.\n *\n * Starts directory sync for Google Workspace using the delegation authorized in Google Admin, or\n * re-enables the Microsoft Entra tenant already on file.\n *\n * **Requires:** `users:write`\n *\n * @param input - Request body; see `ActivateDirectorySync`.\n */\n async activate(input: ActivateDirectorySync): Promise<DirectorySyncActivation> {\n const data = await invokeWithRetry(this.config, this.http, 'DirectorySyncController_activate', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as DirectorySyncActivation\n }\n\n /**\n * Disable directory sync for the active org.\n *\n * Marks the tenant directory-sync row disabled. The `google_workspace` connection row and\n * discovered catalog are kept, not deleted. Returns 404 when directory sync was never configured.\n *\n * **Requires:** `users:write`\n */\n async disable(): Promise<DirectorySyncDisabled> {\n const data = await invokeWithRetry(this.config, this.http, 'DirectorySyncController_disable')\n return data as DirectorySyncDisabled\n }\n\n /**\n * Retry the directory catalog sync now.\n *\n * Starts the catalog walk immediately after a failed or silently-dead attempt, instead of waiting\n * for the daily schedule. Returns 409 when a walk is already running, sync is disabled, or the\n * last walk succeeded; 429 inside the per-org cooldown; 503 when the walk could not be started.\n *\n * **Requires:** `users:write`\n */\n async retry(): Promise<DirectorySyncRetry> {\n const data = await invokeWithRetry(this.config, this.http, 'DirectorySyncController_retry')\n return data as DirectorySyncRetry\n }\n\n /**\n * Browse the synced directory group catalog.\n *\n * Lists synced directory groups with optional name and in-use filters and cursor pagination.\n * Returns 404 when directory sync is disabled.\n *\n * **Requires:** one of `skills:write`, `agents:write`, `connections:manage`, `context:write`,\n * `users:write`\n *\n * @param options.query - Case-insensitive substring filter on the catalog display name.\n * @param options.cursor - Opaque keyset cursor from a previous response's `nextCursor`. Omit for\n * the first page.\n * @param options.pageSize - Max catalog rows per page. Defaults to 25, max 100.\n * @param options.inUse - When true, only return groups already in use (backed by a member group).\n * Defaults to false (all groups).\n */\n async listGroups(options: { query?: string; cursor?: string; pageSize?: number; inUse?: boolean } = {}): Promise<DirectorySyncGroups> {\n const data = await invokeWithRetry(this.config, this.http, 'DirectorySyncController_listGroups', {\n query: { query: options.query, cursor: options.cursor, pageSize: options.pageSize, inUse: options.inUse },\n })\n return data as DirectorySyncGroups\n }\n\n /**\n * Put a synced directory group to use.\n *\n * Marks a directory group in use and starts member sync. Returns 404 for an unknown group, 409\n * when unavailable, and 429 when the sync limit is reached.\n *\n * **Requires:** one of `skills:write`, `agents:write`, `connections:manage`, `context:write`,\n * `users:write`\n *\n * @param externalId - Provider ID returned by the directory group catalog.\n */\n async useGroup(externalId: number | string): Promise<DirectorySyncUsedGroup> {\n validateId(externalId, 'external_id')\n const data = await invokeWithRetry(this.config, this.http, 'DirectorySyncController_useGroup', {\n pathParams: { externalId },\n })\n return data as DirectorySyncUsedGroup\n }\n\n /**\n * Convert native member groups into directory-backed ones.\n *\n * Atomically maps native groups to directory groups and starts membership refresh. Invalid\n * mappings return 409.\n *\n * **Requires:** `users:write`\n *\n * @param input - Request body; see `MapDirectorySyncGroups`.\n */\n async mapGroups(input: MapDirectorySyncGroups): Promise<DirectorySyncMappedGroups> {\n const data = await invokeWithRetry(this.config, this.http, 'DirectorySyncController_mapGroups', {\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as DirectorySyncMappedGroups\n }\n\n /**\n * Convert a native member group into a directory-backed one.\n *\n * Re-points the frozen native member group at a synced directory group, so its membership going\n * forward comes from the identity provider. Triggers the org's directory-members orchestrator\n * once to refresh membership promptly. Returns 409 when the mapping is invalid.\n *\n * **Requires:** `users:write`\n *\n * @param memberGroupUid - Native member group ID.\n * @param input - Request body; see `MapDirectorySyncGroup`.\n */\n async mapGroup(\n memberGroupUid: number | string,\n input: MapDirectorySyncGroup,\n ): Promise<DirectorySyncMappedGroup> {\n validateId(memberGroupUid, 'member_group_uid')\n const data = await invokeWithRetry(this.config, this.http, 'DirectorySyncController_mapGroup', {\n pathParams: { memberGroupUid },\n jsonBody: omitUndefined(input as Record<string, unknown>),\n })\n return data as DirectorySyncMappedGroup\n }\n}\n","import { DirectorySyncResourceBase } from '../_generated/resources/management/directorySync.js'\n/** Read directory synchronization status. */\nexport class ManagementDirectorySyncResource extends DirectorySyncResourceBase {}\n","// Auto-generated resource bases. Do not edit by hand.\n\nimport type { ModusConfig } from '../../../_config.js'\nimport type { HttpClient } from '../../../_http.js'\nimport { invokeWithRetry, omitUndefined } from '../../../_request.js'\nimport { validateId } from '../../../_validation.js'\nimport type {\n ConnectionDeletion,\n ConnectionDiscovery,\n ConnectionGroupAccess,\n ConnectionProbe,\n ConnectionSuggestionRequest,\n ConnectionSuggestionResponse,\n ConnectionViews,\n DisconnectedIntegrationAccount,\n IntegrationAccounts,\n IntegrationAppActions,\n IntegrationApps,\n PausedConnectionsPage,\n PlatformActions,\n RenameConnection,\n RenamedConnection,\n ResolveWorkspaceTreeDisplays,\n SlackChannelRefresh,\n SlackChannels,\n SlackConnectionRules,\n StartConnectionDiscovery,\n TestEnvironmentLoad,\n UpdateConnectionCachePolicy,\n UpdateConnectionGroupAccess,\n UpdateConnectionProfiles,\n UpdateConnectionSettings,\n UpdateWorkspaceAccess,\n UpdatedConnectionCachePolicy,\n UpdatedConnectionGroupAccess,\n UpdatedConnectionProfiles,\n UpdatedConnectionSettings,\n UpdatedWorkspaceAccess,\n WorkspaceTreeDisplayLabels,\n WorkspaceTreePage,\n} from '../../../types/managed-connections.js'\nimport type {\n McpServerProbe,\n McpServerProbeRequest,\n McpServerToolCount,\n McpServerTools,\n McpServerUnsavedTest,\n McpServers,\n} from '../../../types/mcp-servers.js'\n\n/** Generated base for the management `connections` resource. */\nexport class ConnectionsResourceBase {\n /** @internal */\n constructor(\n protected readonly http: HttpClient,\n protected readonly config: ModusConfig,\n ) {}\n\n /**\n * Delete a connection.\n *\n * Deletes a connection and starts cleanup. Personal connections require their owner; other\n * connections require management access.\n *\n * **Requires:** one of `connections:manage`, `context:write`, `connections:own`\n */\n async delete(connectionId: number | string): Promise<ConnectionDeletion> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionManagementController_deleteManagedConnection', {\n pathParams: { connectionId },\n jsonBody: {},\n })\n return data as ConnectionDeletion\n }\n\n /**\n * Get Slack connection rules.\n *\n * **Requires:** `context:read`\n */\n async getSlackRules(connectionId: number | string): Promise<SlackConnectionRules> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'SlackConnectionController_slackConnectionRules', {\n pathParams: { connectionId },\n })\n return data as SlackConnectionRules\n }\n\n /**\n * Refresh Slack channels.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n */\n async refreshSlackChannels(connectionId: number | string): Promise<SlackChannelRefresh> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'SlackConnectionController_refreshInventory', {\n pathParams: { connectionId },\n jsonBody: {},\n })\n return data as SlackChannelRefresh\n }\n\n /**\n * List paused connections.\n *\n * Lists paused connections visible to the caller.\n *\n * **Requires:** `context:read`\n */\n async listPaused(): Promise<PausedConnectionsPage> {\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionManagementController_listPausedOverview')\n return data as PausedConnectionsPage\n }\n\n /**\n * List connection views.\n *\n * Lists saved connections. A row with `accessDenied: true` (no Use) carries only its identity.\n * `canManage: true` means you hold Manage, which lets you edit the connection and wire it into\n * scopes; a usable row with no `error` and `canManage: false` returns `settings: {}`.\n *\n * **Requires:** `context:read`\n */\n async listViews(options: { limit?: number; categories?: readonly string[]; operation?: string; connectionIds?: readonly string[]; includeDisabled?: boolean } = {}): Promise<ConnectionViews> {\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionSettingsController_views', {\n query: { limit: options.limit, categories: options.categories, operation: options.operation, connectionIds: options.connectionIds, includeDisabled: options.includeDisabled },\n })\n return data as ConnectionViews\n }\n\n /**\n * Get connection group access.\n *\n * Returns each group's grant. `use` lets the group's members reach the connection through scopes;\n * `manage` also lets them edit it, change its access and wire it into scopes, and always includes\n * `use`. Needs a role that can view integrations, and Use on the connection.\n *\n * **Requires:** `context:read`\n */\n async getAccess(connectionId: number | string): Promise<ConnectionGroupAccess> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionSettingsController_getAccess', {\n pathParams: { connectionId },\n })\n return data as ConnectionGroupAccess\n }\n\n /**\n * Update connection group access.\n *\n * Replaces the groups' grants; `{use: false, manage: true}` is stored as Use and Manage. Where\n * separate grants are enabled, `{use: true, manage: false}` grants Use only, and returns 400\n * unless a group with members keeps `manage` and you keep it too.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n *\n * @param request - Request body; see `UpdateConnectionGroupAccess`.\n */\n async updateAccess(\n connectionId: number | string,\n request: UpdateConnectionGroupAccess,\n ): Promise<UpdatedConnectionGroupAccess> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionSettingsController_updateAccess', {\n pathParams: { connectionId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as UpdatedConnectionGroupAccess\n }\n\n /**\n * List integration apps.\n *\n * **Requires:** `context:read`\n */\n async listApps(options: { search?: string; after?: string; before?: string; limit?: number } = {}): Promise<IntegrationApps> {\n const data = await invokeWithRetry(this.config, this.http, 'PipedreamController_listApps', {\n query: { search: options.search, after: options.after, before: options.before, limit: options.limit },\n })\n return data as IntegrationApps\n }\n\n /**\n * List integration app actions.\n *\n * **Requires:** `context:read`\n */\n async listAppActions(\n slug: number | string,\n options: { q?: string; after?: string; before?: string; limit?: number } = {},\n ): Promise<IntegrationAppActions> {\n validateId(slug, 'slug')\n const data = await invokeWithRetry(this.config, this.http, 'PipedreamController_listActions', {\n pathParams: { slug },\n query: { q: options.q, after: options.after, before: options.before, limit: options.limit },\n })\n return data as IntegrationAppActions\n }\n\n /**\n * Update connection profiles.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n *\n * @param request - Request body; see `UpdateConnectionProfiles`.\n */\n async updateProfiles(\n connectionId: number | string,\n request: UpdateConnectionProfiles,\n ): Promise<UpdatedConnectionProfiles> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionSettingsController_updateProfiles', {\n pathParams: { connectionId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as UpdatedConnectionProfiles\n }\n\n /**\n * Update workspace access.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n *\n * @param request - Request body; see `UpdateWorkspaceAccess`.\n */\n async updateWorkspaceAccess(\n connectionId: number | string,\n request: UpdateWorkspaceAccess,\n ): Promise<UpdatedWorkspaceAccess> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionSettingsController_updateWorkspaceAccess', {\n pathParams: { connectionId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as UpdatedWorkspaceAccess\n }\n\n /**\n * Update connection cache policy.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n *\n * @param request - Request body; see `UpdateConnectionCachePolicy`.\n */\n async updateCachePolicy(\n connectionId: number | string,\n request: UpdateConnectionCachePolicy,\n ): Promise<UpdatedConnectionCachePolicy> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionSettingsController_updateCachePolicy', {\n pathParams: { connectionId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as UpdatedConnectionCachePolicy\n }\n\n /**\n * Rename a connection.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n *\n * @param request - Request body; see `RenameConnection`.\n */\n async updateName(\n connectionId: number | string,\n request: RenameConnection,\n ): Promise<RenamedConnection> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionSettingsController_updateName', {\n pathParams: { connectionId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as RenamedConnection\n }\n\n /**\n * List workspace tree children.\n *\n * **Requires:** `context:read`\n *\n * @param options.objectType - The tree family whose nodes are listed.\n * @param options.cursor - Continuation token from a previous page.\n * @param options.parent - Typed id-path of the parent node; omit for the roots.\n */\n async listTreeChildren(\n connectionId: number | string,\n options: { objectType: string; cursor?: string; pageSize?: number; parent?: string },\n ): Promise<WorkspaceTreePage> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionCapabilitiesController_treeChildren', {\n pathParams: { connectionId },\n query: { objectType: options.objectType, cursor: options.cursor, pageSize: options.pageSize, parent: options.parent },\n })\n return data as WorkspaceTreePage\n }\n\n /**\n * Search a connection workspace tree.\n *\n * **Requires:** `context:read`\n *\n * @param options.cursor - Continuation token from a previous page.\n */\n async searchTree(\n connectionId: number | string,\n options: { objectType: string; cursor?: string; pageSize?: number; query: string },\n ): Promise<WorkspaceTreePage> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionCapabilitiesController_treeSearch', {\n pathParams: { connectionId },\n query: { objectType: options.objectType, cursor: options.cursor, pageSize: options.pageSize, query: options.query },\n })\n return data as WorkspaceTreePage\n }\n\n /**\n * List integration actions.\n *\n * **Requires:** `context:read`\n */\n async listActions(\n platform: number | string,\n options: { connectionMode?: string; connectionId?: string } = {},\n ): Promise<PlatformActions> {\n validateId(platform, 'platform')\n const data = await invokeWithRetry(this.config, this.http, 'HostedConnectionsController_listActions', {\n pathParams: { platform },\n query: { connectionMode: options.connectionMode, connectionId: options.connectionId },\n })\n return data as PlatformActions\n }\n\n /**\n * List MCP servers.\n *\n * Lists the MCP server connections visible to the caller.\n *\n * **Requires:** `context:read`\n */\n async listMcpServers(): Promise<McpServers> {\n const data = await invokeWithRetry(this.config, this.http, 'McpServersController_list')\n return data as McpServers\n }\n\n /**\n * Probe an MCP server.\n *\n * Checks an MCP server URL for reachability and supported authentication.\n *\n * **Requires:** `context:read` and one of `connections:manage`, `context:write`\n *\n * @param request - Request body; see `McpServerProbeRequest`.\n */\n async probeMcpServer(request: McpServerProbeRequest): Promise<McpServerProbe> {\n const data = await invokeWithRetry(this.config, this.http, 'McpServersController_probe', {\n jsonBody: request,\n })\n return data as McpServerProbe\n }\n\n /**\n * Test an MCP server.\n *\n * Tests an unsaved MCP server configuration using supplied credentials.\n *\n * **Requires:** `context:read` and one of `connections:manage`, `context:write`\n *\n * @param request - Request body; see `McpServerUnsavedTest`.\n */\n async testUnsavedMcpServer(request: McpServerUnsavedTest): Promise<McpServerToolCount> {\n const data = await invokeWithRetry(this.config, this.http, 'McpServersController_testUnsaved', {\n jsonBody: request,\n })\n return data as McpServerToolCount\n }\n\n /**\n * Test a saved MCP server.\n *\n * Tests a saved MCP server connection available to the caller.\n *\n * **Requires:** `context:read` and one of `connections:manage`, `context:write`\n *\n * @param connectionId - MCP server connection UUID.\n */\n async testMcpServer(connectionId: number | string): Promise<McpServerToolCount> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'McpServersController_test', {\n pathParams: { connectionId },\n })\n return data as McpServerToolCount\n }\n\n /**\n * Refresh MCP server tools.\n *\n * Refreshes the tool snapshot for a saved MCP server connection.\n *\n * **Requires:** `context:read` and one of `connections:manage`, `context:write`\n *\n * @param connectionId - MCP server connection UUID.\n */\n async refreshMcpServerTools(connectionId: number | string): Promise<McpServerTools> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'McpServersController_refreshTools', {\n pathParams: { connectionId },\n })\n return data as McpServerTools\n }\n\n /**\n * Update connection settings.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n *\n * @param request - Request body; see `UpdateConnectionSettings`.\n */\n async updateSettings(\n connectionId: number | string,\n request: UpdateConnectionSettings,\n ): Promise<UpdatedConnectionSettings> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionCapabilitiesController_updateSettings', {\n pathParams: { connectionId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as UpdatedConnectionSettings\n }\n\n /**\n * Probe a connection.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n */\n async probe(connectionId: number | string): Promise<ConnectionProbe> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionSettingsController_probePublic', {\n pathParams: { connectionId },\n jsonBody: {},\n })\n return data as ConnectionProbe\n }\n\n /**\n * Start connection discovery.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n *\n * @param request - Request body; see `StartConnectionDiscovery`.\n */\n async startDiscovery(\n connectionId: number | string,\n request: StartConnectionDiscovery,\n ): Promise<ConnectionDiscovery> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionSettingsController_startDiscovery', {\n pathParams: { connectionId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as ConnectionDiscovery\n }\n\n /**\n * Disconnect an integration account.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n */\n async disconnectAccount(accountId: number | string): Promise<DisconnectedIntegrationAccount> {\n validateId(accountId, 'account_id')\n const data = await invokeWithRetry(this.config, this.http, 'PipedreamController_disconnectAccount', {\n pathParams: { accountId },\n })\n return data as DisconnectedIntegrationAccount\n }\n\n /**\n * Resolve workspace tree display labels.\n *\n * **Requires:** `context:read` and one of `connections:manage`, `context:write`\n *\n * @param request - Request body; see `ResolveWorkspaceTreeDisplays`.\n */\n async resolveTreeDisplays(\n connectionId: number | string,\n request: ResolveWorkspaceTreeDisplays,\n ): Promise<WorkspaceTreeDisplayLabels> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionCapabilitiesController_resolveDisplays', {\n pathParams: { connectionId },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as WorkspaceTreeDisplayLabels\n }\n\n /**\n * Load a test environment.\n *\n * **Requires:** one of `connections:manage`, `context:write`\n */\n async loadTestEnvironment(): Promise<TestEnvironmentLoad> {\n const data = await invokeWithRetry(this.config, this.http, 'EraConnectionsController_load', {\n jsonBody: {},\n })\n return data as TestEnvironmentLoad\n }\n\n /**\n * List Slack channels.\n *\n * **Requires:** `context:read`\n */\n async listSlackChannels(\n connectionId: number | string,\n options: { searchQuery?: string; offset?: number; limit?: number } = {},\n ): Promise<SlackChannels> {\n validateId(connectionId, 'connection_id')\n const data = await invokeWithRetry(this.config, this.http, 'SlackConnectionController_slackChannels', {\n pathParams: { connectionId },\n query: { searchQuery: options.searchQuery, offset: options.offset, limit: options.limit },\n })\n return data as SlackChannels\n }\n\n /**\n * Get connection setup suggestions.\n *\n * **Requires:** `context:read`\n *\n * @param request - Request body; see `ConnectionSuggestionRequest`.\n */\n async suggestSetup(\n platform: number | string,\n request: ConnectionSuggestionRequest,\n ): Promise<ConnectionSuggestionResponse> {\n validateId(platform, 'platform')\n const data = await invokeWithRetry(this.config, this.http, 'ConnectionSuggestionsController_suggestion', {\n pathParams: { platform },\n jsonBody: omitUndefined(request as Record<string, unknown>),\n })\n return data as ConnectionSuggestionResponse\n }\n\n /**\n * List connected integration accounts.\n *\n * **Requires:** `context:read`\n */\n async listAccountSummaries(options: { app?: string; oauthAppId?: string; after?: string; before?: string; limit?: number } = {}): Promise<IntegrationAccounts> {\n const data = await invokeWithRetry(this.config, this.http, 'PipedreamController_listAccountSummaries', {\n query: { app: options.app, oauthAppId: options.oauthAppId, after: options.after, before: options.before, limit: options.limit },\n })\n return data as IntegrationAccounts\n }\n}\n","import { ConnectionsResourceBase } from '../_generated/resources/management/connections.js'\nimport { asRecord, invokeWithRetry } from '../_request.js'\nimport { validateId } from '../_validation.js'\n\n/** Manage connections in the organization. */\nexport class ManagementConnectionsResource extends ConnectionsResourceBase {\n /**\n * Prepare an approval recipient for a connection.\n *\n * @param connectionId - Connection ID.\n * @param approverEmail - Email of the person who will approve.\n * @returns Provider-specific delivery details.\n * @example\n * await management.connections.prepareApprovalDelivery('connection-id', 'approver@example.com')\n */\n async prepareApprovalDelivery(connectionId: string, approverEmail: string): Promise<Record<string, unknown>> {\n validateId(connectionId, 'connectionId')\n return asRecord(asRecord(await invokeWithRetry(this.config, this.http, 'ConnectionCapabilitiesController_preparePublicApprovalDelivery', {\n pathParams: { connectionId }, jsonBody: { approverEmail },\n })).result)\n }\n}\n","import { ModusClientBase } from '../_client-base.js'\nimport type { ModusOptions } from '../_config.js'\nimport { ManagementWorkflowsResource } from './workflows/agents.js'\nimport { ManagementContextResource } from './context/context.js'\nimport { ManagementScopesResource } from './scopes/skills.js'\nimport { ManagementAuditEventsResource } from './audit-events.js'\nimport { ManagementUsageResource } from './usage.js'\nimport { ManagementToolsResource } from './tools.js'\nimport { ManagementUsersResource } from './users.js'\nimport { ManagementGitResource } from './git.js'\nimport { ManagementLlmResource } from './llm.js'\nimport { ManagementSecurityResource } from './security.js'\nimport { ManagementDirectorySyncResource } from './directory-sync.js'\nimport { ManagementConnectionsResource } from './connections.js'\n\n/**\n * Configure scopes, workflows, context, usage, audit events, tools, and users.\n *\n * Call path: `const mgmt = new ModusManagement(...)` then `mgmt.scopes`, `mgmt.context`, …\n *\n * @param options - Client configuration (`apiKey`, `baseUrl`, `timeoutMs`, `maxRetries`).\n */\nexport class ModusManagement extends ModusClientBase {\n readonly scopes: ManagementScopesResource\n readonly workflows: ManagementWorkflowsResource\n readonly context: ManagementContextResource\n readonly usage: ManagementUsageResource\n readonly auditEvents: ManagementAuditEventsResource\n readonly tools: ManagementToolsResource\n readonly users: ManagementUsersResource\n readonly git: ManagementGitResource\n readonly llm: ManagementLlmResource\n readonly security: ManagementSecurityResource\n readonly directorySync: ManagementDirectorySyncResource\n readonly connections: ManagementConnectionsResource\n\n constructor(options: ModusOptions = {}) {\n super(options)\n this.scopes = new ManagementScopesResource(this.http, this.config)\n this.workflows = new ManagementWorkflowsResource(this.http, this.config)\n this.context = new ManagementContextResource(this.http, this.config)\n this.usage = new ManagementUsageResource(this.http, this.config)\n this.auditEvents = new ManagementAuditEventsResource(this.http, this.config)\n this.tools = new ManagementToolsResource(this.http, this.config)\n this.users = new ManagementUsersResource(this.http, this.config)\n this.git = new ManagementGitResource(this.http, this.config)\n this.llm = new ManagementLlmResource(this.http, this.config)\n this.security = new ManagementSecurityResource(this.http, this.config)\n this.directorySync = new ManagementDirectorySyncResource(this.http, this.config)\n this.connections = new ManagementConnectionsResource(this.http, this.config)\n }\n}\n\nexport type { ModusOptions }\nexport type { ModusConfig } from '../_config.js'\nexport type { ManagementScopesResource } from './scopes/skills.js'\nexport type { ScopeMemoriesResource } from './scopes/memories.js'\nexport type { ScopeEvaluationsResource } from './scopes/evaluations.js'\nexport type { ScopeSupervisionResource, SetSupervisionRequest, Supervision } from './scopes/supervision.js'\nexport type { McpExposureCatalog, McpExposureCatalogRequest } from './scopes/mcp-exposure-catalog.js'\nexport type {\n AddScopeInterface,\n ScopeInterface,\n ScopeInterfacesResource,\n UpdateScopeInterface,\n} from './scopes/interfaces.js'\nexport type { ManagementWorkflowsResource } from './workflows/agents.js'\nexport type {\n AddAgentInterface,\n AgentInterface,\n UpdateAgentInterface,\n WorkflowInterfacesResource,\n} from './workflows/interfaces.js'\nexport type { ManagementContextResource } from './context/context.js'\nexport type { ManagementContextItemsResource } from './context/items.js'\nexport type { BatchUploadOptions, ManagementContextFilesResource } from './context/files.js'\nexport type { ManagementDashboardElementsResource, ManagementDashboardsResource } from './context/dashboards.js'\nexport type { ManagementUsageResource } from './usage.js'\nexport type { AuditExportRequest, ManagementAuditEventsResource } from './audit-events.js'\nexport type { AuditEvent, AuditEventOrder } from './types/audit-events.js'\nexport type { ManagementToolsResource } from './tools.js'\nexport type { ManagementUsersResource, MemberGroup, OrgMember } from './users.js'\nexport type { ManagementGitResource } from './git.js'\nexport type { ManagementLlmResource } from './llm.js'\nexport type { ManagementSecurityResource } from './security.js'\nexport type { ManagementDirectorySyncResource } from './directory-sync.js'\nexport type {\n LlmProviderCatalog,\n DirectorySyncOverview,\n DirectorySyncSetup,\n DirectorySyncActivation,\n DirectorySyncDisabled,\n DirectorySyncRetry,\n DirectorySyncGroups,\n DirectorySyncUsedGroup,\n DirectorySyncMappedGroups,\n ActivateDirectorySync,\n MapDirectorySyncGroups,\n MapDirectorySyncGroup,\n DirectorySyncMappedGroup,\n} from '../types/provider-catalog.js'\nexport type { ManagementConnectionsResource } from './connections.js'\nexport type { ConnectionDeletion, UpdateConnectionGroupAccess, UpdatedConnectionGroupAccess } from '../types/managed-connections.js'\nexport type { GitStatus, GitSyncState, GitForkState, GitConnectFork, GitDisconnect, ConnectGitFork } from '../types/git.js'\nexport type {\n AddEvaluationCase,\n EvaluationCase,\n EvaluationConfig,\n EvaluationRun,\n EvaluationRunWithResults,\n TriggerEvaluationRunResponse,\n UpdateEvaluationCase,\n UpdateEvaluationConfig,\n} from './types/evaluations.js'\nexport type { JsonObjectInput, JsonObjectListInput } from './types/json-blob.js'\nexport type { ContextSuggestionsResource } from './context/context.js'\nexport type { ApproveSuggestion, ContextSuggestion, ContextSuggestionResolution, ContextSuggestionUndo } from './types/context-suggestions.js'\nexport type { CreatedContextItem } from '../types/context.js'\nexport type { ToolCatalogEntry } from '../types/tools.js'\nexport type {\n UsageBucket,\n UsageEntity,\n UsageEntityStatus,\n UsageReport,\n UsageRollup,\n UsageTotals,\n UsageUser,\n UsageServiceAccountsReport,\n UserActivityReport,\n UsageUsersReport,\n} from '../types/usage.js'\nexport type {\n CreateScopeOptions,\n UpdateScopeOptions,\n CreateSkillOptions,\n UpdateSkillOptions,\n} from './scopes/skills.js'\nexport type {\n CreateWorkflowOptions,\n UpdateWorkflowOptions,\n CreateAgentOptions,\n UpdateAgentOptions,\n TriggerInput,\n AgentSelectionInput,\n WorkflowGraphInput,\n} from './workflows/agents.js'\nexport type { UserFeedback } from './context/context.js'\nexport type {\n ContextItemAccessUpdate,\n ContextItemDeletion,\n ContextItemMove,\n UpdateContextItemAccessInput,\n} from '../types/context.js'\nexport type {\n BulkFinalizeResult,\n BulkUploadFromUrlsResult,\n BulkUploadUrlsResult,\n FinalizeInput,\n FailedUploadFromUrl,\n FailedUploadUrl,\n FinalizeFailure,\n FileUpload,\n FileUploadStatus,\n UploadDirFailure,\n UploadDirResult,\n UploadFileInput,\n UploadFromUrlInput,\n UploadProgress,\n UploadProgressCallback,\n UploadUrlInput,\n UploadUrlSlot,\n WaitUntil,\n} from '../types/context-files.js'\nexport type {\n CreateDashboardElementInput,\n CreateDashboardInput,\n Dashboard,\n DashboardDraftSnapshot,\n DashboardElementKind,\n DashboardElementLayout,\n DashboardElementPatch,\n DashboardElementResult,\n CreatedDashboardElement,\n DashboardElementsList,\n DashboardElementSummary,\n DashboardLayoutElement,\n DashboardPublishResult,\n DashboardVersion,\n DashboardView,\n PublishDashboardInput,\n TransferDashboardOwnershipInput,\n UpdateDashboardAccessInput,\n UpdateDashboardDraftInput,\n UpdateDashboardElementInput,\n UpdateDashboardLayoutInput,\n} from '../types/context-dashboards.js'\nexport type { PlatformToolsetEntry, ToolsetInput, ToolsetRules, ToolsetSlot } from './types/toolset.js'\nexport type {\n Memory,\n MemorySearchRequest,\n MemorySearchResult,\n MemoryUpdate,\n} from './types/memories.js'\n\nexport type { WorkflowEmailAddress } from '../types/workflows.js'\nexport type {\n ScopeVariationList, SelectableCallTarget, ScopeMcpDiscoverRequest, ScopeMcpDiscoverResponse,\n ScopeMcpCreateRequest, ScopeMcpConnection, ScopeMcpConnectionDetail, ScopeMcpConnectionList,\n ScopeCachedDescription, ScopeGenerateDescriptionRequest, ScopeGeneratedDescription,\n} from '../types/scopes.js'\n\nexport type * as ContextOperations from '../types/context-operations.js'\nexport type * as ConnectionOperations from '../types/managed-connections.js'\nexport type * as AuditOperations from './types/audit-events.js'\nexport type {\n ContextArtifactsResource, ContextArtifactCommentsResource, ContextDashboardAlertsResource,\n ContextGraphResource, ContextOrgLearningsResource, ContextReportingResource,\n} from './context/context.js'\n\nexport type * from '../types/organization-operations.js'\n\nexport type { UpdateConnectionProfiles, UpdatedConnectionProfiles, UpdateWorkspaceAccess, UpdatedWorkspaceAccess, UpdateConnectionCachePolicy, UpdatedConnectionCachePolicy, RenameConnection, RenamedConnection } from '../types/managed-connections.js'\nexport type { ScopeGoalOptions } from '../types/scopes.js'\n\n\nexport type { UpdateConnectionSettings, UpdatedConnectionSettings } from '../types/managed-connections.js'\n\nexport type { McpServers, McpServerProbeRequest, McpServerProbe, McpServerUnsavedTest, McpServerToolCount, McpServerTools } from '../types/mcp-servers.js'\n\nexport type { ConnectionProbe, StartConnectionDiscovery, ConnectionDiscovery } from '../types/managed-connections.js'\n\nexport type { ResolveWorkspaceTreeDisplays, WorkspaceTreeDisplayLabels } from '../types/managed-connections.js'\nexport type { ModelRouting, ReplaceModelRouting } from '../types/provider-catalog.js'\nexport type { PersonalAssistant, CreatePersonalAssistant, UpdatePersonalAssistant, PersonalAssistantId } from '../types/assistants.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBO,IAAM,wBAAN,MAA4B;AAAA;AAAA,EAEjC,YACqB,MACA,QACnB;AAFmB;AACA;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8BH,KAAK,UAOD,CAAC,GAA4B;AAC/B,UAAM,WAAW,QAAQ,YAAY;AACrC,qBAAiB,QAAQ;AACzB,WAAO,KAAK,SAAS,UAAU,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,MAAM,QAAQ,MAAM,QAAQ,gBAAgB;AAAA,EACxH;AAAA,EAEA,MAAgB,SACd,UACA,WACA,QACA,MACA,MACA,kBACyB;AACzB,UAAM,QAA0C,CAAC;AACjD,QAAI,WAAW,OAAW,OAAM,SAAS;AACzC,QAAI,SAAS,OAAW,OAAM,OAAO;AACrC,QAAI,SAAS,OAAW,OAAM,OAAO;AACrC,QAAI,qBAAqB,OAAW,OAAM,mBAAmB;AAC7D,UAAM,OAAO;AAAA,MACX,MAAM,gBAAgB,KAAK,QAAQ,KAAK,MAAM,4BAA4B;AAAA,QACxE,OAAO,cAAc,UAAU,WAAW,KAAK;AAAA,MAIjD,CAAC;AAAA,IACH;AACA,WAAO;AAAA,MACL;AAA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