@getmodus/sdk 0.4.0 → 0.6.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 +2 -2
- package/dist/{chunk-I56O44TR.js → chunk-HEHHN4D6.js} +70 -4
- package/dist/chunk-HEHHN4D6.js.map +1 -0
- package/dist/{conversations-Cq6OVlpQ.d.cts → conversations-BRg8gEKX.d.cts} +1378 -98
- package/dist/{conversations-Cq6OVlpQ.d.ts → conversations-BRg8gEKX.d.ts} +1378 -98
- package/dist/index.cjs +69 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/management/index.cjs +396 -3
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +150 -3
- package/dist/management/index.d.ts +150 -3
- package/dist/management/index.js +331 -1
- package/dist/management/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-I56O44TR.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/_query.ts","../../src/management/_access-config.ts","../../src/management/workflows/interfaces.ts","../../src/management/workflows/agents.ts","../../src/types/context.ts","../../src/management/context/_content-merge.ts","../../src/management/context/items.ts","../../src/management/context/context.ts","../../src/management/scopes/memories.ts","../../src/management/scopes/evaluations.ts","../../src/management/scopes/supervision.ts","../../src/management/scopes/skills.ts","../../src/management/usage.ts","../../src/management/tools.ts","../../src/management/users.ts","../../src/management/index.ts"],"sourcesContent":["export function updateMaskQuery(\n updateMask?: string,\n): Record<string, string> | undefined {\n if (updateMask === undefined) return undefined\n if (!updateMask.trim()) {\n throw new Error('update_mask must be a non-empty comma-separated list of field names')\n }\n return { updateMask }\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","import 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 { 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 {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n private readonly workflowId: number | string,\n ) {}\n\n /** List interfaces attached to this workflow. */\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 }) as { interfaces: AgentInterface[] }\n return data.interfaces\n }\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: updateMask === undefined ? omitUndefined(options) : options,\n }) as AgentInterface\n }\n\n /**\n * Delete an interface from this workflow.\n *\n * @param interfaceId - Interface id.\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 /** Delete every interface from this workflow. */\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","import type { ModusConfig } from '../../_config.js'\nimport type { OperationId } from '../../_generated/operations.js'\nimport type { HttpClient } from '../../_http.js'\nimport { updateMaskQuery } from '../../_query.js'\nimport { aipListParams, buildAipPage, type Page } from '../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId, validatePageSize } from '../../_validation.js'\nimport type { Workflow, WorkflowType } from '../../types/workflows.js'\nimport type { VariationView } from '../../types/views.js'\nimport {\n accessConfigBodyForCreate,\n accessConfigBodyForUpdate,\n} from '../_access-config.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 workflowsListParams(\n pageSize: number,\n pageToken: string | undefined,\n search?: string,\n type?: WorkflowType,\n view?: VariationView,\n includeVariation?: boolean,\n): Record<string, string | number | boolean | undefined | null> {\n const extra: Record<string, string | number | boolean | undefined | null> = {}\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 return aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >\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 guardrails?: string[]\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 guardrails?: string[]\n updateMask?: string\n}\n\n/** @deprecated Use `UpdateWorkflowOptions` instead. */\nexport type UpdateAgentOptions = UpdateWorkflowOptions\n\nexport class ManagementWorkflowsResource {\n protected readonly ops: ManagementWorkflowsOperations = MANAGEMENT_WORKFLOW_OPERATIONS\n\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\n\n /**\n * List workflows in the organization.\n *\n * @param options.pageSize - Maximum items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.\n * @param options.search - Case-insensitive substring filter on the workflow name.\n * @param options.type - Filter by workflow type: `\"task\"` or `\"workflow\"`.\n * @param options.view - Variation view: `\"active\"` (deployed) or `\"draft\"`.\n * @param options.includeVariation - Include variation payload on each list row.\n * @returns A page of workflows.\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(\n pageSize,\n options.pageToken,\n options.search,\n options.type,\n options.view,\n options.includeVariation,\n )\n }\n\n private 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 data = asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.list, {\n query: workflowsListParams(pageSize, pageToken, search, type, view, includeVariation),\n }),\n )\n // List envelope is `workflows` only (Release N+1).\n return buildAipPage(\n data,\n 'workflows',\n parseWorkflow,\n (token) => this.listPage(pageSize, token, search, type, view, includeVariation),\n )\n }\n\n /**\n * Retrieve a workflow with full configuration.\n *\n * @param workflowId - Workflow id.\n * @param options.view - Variation view: `\"active\"` (deployed) or `\"draft\"`.\n * @returns The workflow.\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 - `\"task\"` for single-step orchestration, or `\"workflow\"` for a multi-step graph.\n * @param options.trigger - Optional trigger configuration.\n * @param options.guardrails - Runtime guardrail labels (for example `\"no-pii\"`). Omit to create with no guardrails.\n * @returns The created workflow (draft).\n * @example\n * ```ts\n * const wf = await mgmt.workflows.create({ name: 'Daily report', type: WorkflowType.Task })\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 accessConfig: accessConfigBodyForCreate(options.guardrails),\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.\n *\n * @param workflowId - Workflow id.\n * @param options.guardrails - Guardrail labels to set. Fetches the current workflow first to merge. Pass `[]` to clear all.\n * @param options.updateMask - Comma-separated field names to update or clear.\n * @returns The updated workflow.\n */\n async update(workflowId: number | string, options: UpdateWorkflowOptions = {}): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const accessConfig = await accessConfigBodyForUpdate(options.guardrails, async () =>\n asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.get, {\n pathParams: { id: workflowId },\n }),\n ),\n )\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 accessConfig,\n }\n const body = options.updateMask !== undefined ? fields : omitUndefined(fields)\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 * await mgmt.workflows.update(workflowId, { description: 'Runs every morning' })\n * const published = await mgmt.workflows.deploy(workflowId)\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 * Delete a workflow.\n *\n * @param workflowId - Workflow id.\n * @returns Resolves when the workflow is deleted.\n */\n async delete(workflowId: number | string): Promise<void> {\n validateId(workflowId, 'workflow_id')\n await invokeWithRetry(this.config, this.http, this.ops.delete, {\n pathParams: { id: workflowId },\n })\n }\n\n /**\n * Restore a previously deleted workflow.\n *\n * @param workflowId - Workflow id.\n * @returns The restored workflow.\n */\n async restore(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {\n pathParams: { id: workflowId },\n jsonBody: {},\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 /** Cancel a pending workflow ownership transfer. */\n async cancelOwnershipTransfer(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.cancelOwnershipTransfer,\n { pathParams: { id: workflowId } },\n )\n return parseWorkflow(data)\n }\n\n /** Accept a pending workflow ownership transfer. */\n async acceptOwnershipTransfer(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.acceptOwnershipTransfer,\n { pathParams: { id: workflowId }, jsonBody: {} },\n )\n return parseWorkflow(data)\n }\n}\n","import type { components } from '../_generated/v1.js'\n\nexport type ContextItem = components['schemas']['ContextItemDto']\nexport type ContextItemLookupRow = components['schemas']['LookupContextItemRowDto']\nexport type ContextItemDeletion = components['schemas']['DeleteContextItemResponseDto']\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 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 Error(`Expected contextType ${contextType}, got ${item.contextType}.`)\n }\n if (!item.content || typeof item.content !== 'object' || Array.isArray(item.content)) {\n throw new Error(`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 Error('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","import type { ModusConfig } from '../../_config.js'\nimport type { HttpClient } from '../../_http.js'\nimport { updateMaskQuery } from '../../_query.js'\nimport { aipListParams, buildAipPage, type Page } from '../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validatePageSize } from '../../_validation.js'\nimport type { ContextItem, ContextItemDeletion } from '../../types/context.js'\nimport type { UserFeedback } from './_content-merge.js'\n\nfunction contextListParams(\n pageSize: number,\n pageToken: string | undefined,\n contextType?: string,\n): Record<string, string | number | boolean | readonly string[] | undefined | null> {\n const extra: Record<string, string | readonly string[]> = {}\n if (contextType !== undefined) extra.contextTypes = [contextType]\n return aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | readonly string[] | undefined | null\n >\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 * @returns A page of context items.\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n contextType?: string\n } = {}): Promise<Page<ContextItem>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken, options.contextType)\n }\n\n private async listPage(\n pageSize: number,\n pageToken: string | undefined,\n contextType?: string,\n ): Promise<Page<ContextItem>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextItemsController_list', {\n query: contextListParams(pageSize, pageToken, contextType),\n }),\n )\n return buildAipPage(data, 'contextItems', parseContextItem, (token) =>\n this.listPage(pageSize, token, contextType),\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.\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 =\n options.updateMask !== undefined\n ? {\n content: options.content,\n contextType: options.contextType,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n }\n : omitUndefined({\n content: options.content,\n contextType: options.contextType,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\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.\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","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 { ManagementContextItemsResource } from './items.js'\n\n/**\n * Create and update context items (notes, links, saved queries).\n *\n * Call path: `mgmt.context` after `new ModusManagement(...)`.\n */\nexport class ManagementContextResource {\n readonly items: ManagementContextItemsResource\n readonly customItems: CustomContextItemsResource\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 }\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 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 */\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 */\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 */\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 */\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 */\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","import type { ModusConfig } from '../../_config.js'\nimport type { HttpClient } from '../../_http.js'\nimport { updateMaskQuery } from '../../_query.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 Memory,\n MemorySearchRequest,\n MemorySearchResult,\n MemoryUpdate,\n} from '../types/memories.js'\n\nfunction parseMemory(raw: unknown): Memory {\n return raw as Memory\n}\n\n/** Long-term memory stored per scope. */\nexport class ScopeMemoriesResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n private readonly scopeId: number | string,\n ) {}\n\n /**\n * List memories stored for this scope.\n *\n * @param options.pageSize - Items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`.\n * @param options.userId - Optional end-user id when memories are scoped per user.\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 private 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(data, 'memories', parseMemory, (token) =>\n this.listPage(pageSize, token, userId),\n )\n }\n\n /**\n * Search this scope's memories by natural-language query.\n *\n * @param request - Query text and optional `userId` / `limit`.\n * @returns Matching memories and relevance scores.\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 one memory. Requires manage permission on the scope.\n *\n * @param memoryId - Id from list or search.\n * @param update - Fields to change (`memory` and/or `metadata`).\n * @param options.updateMask - Optional comma-separated field names to update.\n * @returns The updated memory.\n */\n async update(\n memoryId: string,\n update: MemoryUpdate,\n options: { updateMask?: string } = {},\n ): Promise<Memory> {\n validateId(memoryId, 'memory_id')\n validateId(this.scopeId, 'scope_id')\n const data = 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 return parseMemory(data)\n }\n\n /** Delete one memory (idempotent). */\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 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 '../types/evaluations.js'\n\nfunction parseConfig(raw: unknown): EvaluationConfig {\n return raw as EvaluationConfig\n}\n\nfunction parseRun(raw: unknown): EvaluationRun {\n return raw as EvaluationRun\n}\n\n/** Scheduled and manual scope evaluations. */\nexport class ScopeEvaluationsResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n private readonly scopeId: number | string,\n ) {}\n\n /** Get the evaluation configuration for this scope. */\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 parseConfig(data)\n }\n\n /**\n * Update the evaluation configuration for this scope.\n *\n * @param update - Configuration fields to change.\n * @returns The updated evaluation configuration.\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 parseConfig(data)\n }\n\n /**\n * Trigger a manual evaluation run for this scope.\n *\n * @returns The triggered run id and 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 for this scope.\n *\n * @param options.pageSize - Items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`.\n * @returns A page of evaluation runs.\n */\n listRuns(options: { pageSize?: number; pageToken?: string } = {}): Promise<Page<EvaluationRun>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listRunsPage(pageSize, options.pageToken)\n }\n\n private 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(data, 'runs', parseRun, (token) => this.listRunsPage(pageSize, token))\n }\n\n /**\n * Retrieve one evaluation run with full results.\n *\n * @param runId - Evaluation run id.\n * @returns The run and its result details.\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","import type { ModusConfig } from '../../_config.js'\nimport type { HttpClient } from '../../_http.js'\nimport { invokeWithRetry } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type { components } from '../../_generated/v1.js'\nimport type { VariationView } from '../../types/views.js'\n\nexport type Supervision = components['schemas']['SupervisionDto']\nexport type SetSupervisionRequest = components['schemas']['SetSupervisionRequestDto']\n\nexport class ScopeSupervisionResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n private readonly scopeId: number | string,\n ) {}\n\n /**\n * Get this scope's supervision configuration.\n *\n * @param options.view - Optional scope variation to inspect.\n * @returns The supervision configuration.\n */\n async get(options: { view?: VariationView } = {}): Promise<Supervision> {\n validateId(this.scopeId, 'scope_id')\n return await invokeWithRetry(this.config, this.http, 'ScopeSupervisionController_get', {\n pathParams: { id: this.scopeId },\n query: options.view === undefined ? undefined : { view: options.view },\n }) as Supervision\n }\n\n /**\n * Replace this scope's subordinate scopes.\n *\n * @param request - Replacement supervision configuration.\n * @returns The updated supervision configuration.\n */\n async set(request: SetSupervisionRequest): Promise<Supervision> {\n return this.write('ScopeSupervisionController_set', request)\n }\n\n /**\n * Replace subordinate scopes on the active (deployed) scope version.\n *\n * @param request - Replacement supervision configuration.\n * @returns The updated supervision configuration.\n */\n async setActive(request: SetSupervisionRequest): Promise<Supervision> {\n return this.write('ScopeSupervisionController_setActive', request)\n }\n\n private async write(operation: 'ScopeSupervisionController_set' | 'ScopeSupervisionController_setActive',\n request: SetSupervisionRequest): Promise<Supervision> {\n validateId(this.scopeId, 'scope_id')\n return await invokeWithRetry(this.config, this.http, operation, {\n pathParams: { id: this.scopeId },\n jsonBody: request,\n }) as Supervision\n }\n}\n","import type { ModusConfig } from '../../_config.js'\nimport type { OperationId } from '../../_generated/operations.js'\nimport type { HttpClient } from '../../_http.js'\nimport { updateMaskQuery } from '../../_query.js'\nimport { aipListParams, buildAipPage, type Page } from '../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId, validatePageSize } from '../../_validation.js'\nimport { ScopeConversationsResource } from '../../resources/scopes/conversations.js'\nimport type { Scope } from '../../types/scopes.js'\nimport type { VariationView } from '../../types/views.js'\nimport {\n accessConfigBodyForCreate,\n accessConfigBodyForUpdate,\n} from '../_access-config.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 { 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 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\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 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 scopesListParams(\n pageSize: number,\n pageToken: string | undefined,\n search?: string,\n view?: VariationView,\n managerId?: number,\n): Record<string, string | number | boolean | undefined | null> {\n const extra: Record<string, string | number | boolean | undefined | null> = {}\n if (search !== undefined) extra.search = search\n if (view !== undefined) extra.view = view\n if (managerId !== undefined) extra.managerId = managerId\n return aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >\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?: JsonObjectListInput\n contextSelections?: JsonObjectListInput\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?: JsonObjectListInput\n contextSelections?: JsonObjectListInput\n interfaces?: JsonObjectListInput\n guardrails?: string[]\n managerId?: string\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 {\n protected readonly ops: ManagementScopesOperations = MANAGEMENT_SCOPE_OPERATIONS\n\n /** @internal */\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\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 * List scopes in the organization.\n *\n * @param options.pageSize - Maximum items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.\n * @param options.search - Case-insensitive substring filter on the scope name.\n * @param options.view - Variation view: `\"active\"` (deployed) or `\"draft\"`.\n * @param options.managerId - Return only scopes supervised by this manager scope id.\n * @returns A page of scopes.\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(\n pageSize,\n options.pageToken,\n options.search,\n options.view,\n options.managerId,\n )\n }\n\n private async listPage(\n pageSize: number,\n pageToken: string | undefined,\n search?: string,\n view?: VariationView,\n managerId?: number,\n ): Promise<Page<Scope>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.list, {\n query: scopesListParams(pageSize, pageToken, search, view, managerId),\n }),\n )\n // List envelope is `scopes` only (Release N+1).\n return buildAipPage(\n data,\n 'scopes',\n parseScope,\n (token) => this.listPage(pageSize, token, search, view, managerId),\n )\n }\n\n /**\n * Retrieve a scope with full configuration.\n *\n * @param scopeId - Scope id.\n * @param options.view - Variation view: `\"active\"` (deployed) or `\"draft\"`.\n * @returns The scope.\n */\n async get(scopeId: number | string, options: { view?: VariationView } = {}): Promise<Scope> {\n validateId(scopeId, 'scope_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: scopeId },\n query,\n })\n return parseScope(data)\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.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 scope = await mgmt.scopes.create({ name: 'Support assistant', model: 'claude-sonnet-5' })\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 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 *\n * @param scopeId - Scope id.\n * @param options.guardrails - Guardrail labels to set. Fetches the current scope first to merge. Pass `[]` to clear all.\n * @param options.updateMask - Comma-separated field names to update or clear.\n * @returns The updated scope.\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 =\n options.updateMask !== undefined ? fields : omitUndefined(fields)\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 * await mgmt.scopes.update(scopeId, { instructions: ['Be concise.'] })\n * const published = await mgmt.scopes.deploy(scopeId)\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 * Delete a scope.\n *\n * @param scopeId - Scope id.\n * @returns Resolves when the scope is deleted.\n */\n async delete(scopeId: number | string): Promise<void> {\n validateId(scopeId, 'scope_id')\n await invokeWithRetry(this.config, this.http, this.ops.delete, {\n pathParams: { id: scopeId },\n })\n }\n\n /**\n * Restore a previously deleted scope.\n *\n * @param scopeId - Scope id.\n * @returns The restored scope.\n */\n async restore(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {\n pathParams: { id: scopeId },\n jsonBody: {},\n })\n return parseScope(data)\n }\n\n /**\n * Start transferring ownership of a scope to another organization member.\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 /** Cancel a pending scope ownership transfer. */\n async cancelOwnershipTransfer(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.cancelOwnershipTransfer,\n { pathParams: { id: scopeId } },\n )\n return parseScope(data)\n }\n\n /** Accept a pending scope ownership transfer. */\n async acceptOwnershipTransfer(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.acceptOwnershipTransfer,\n { pathParams: { id: scopeId }, jsonBody: {} },\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","import type { ModusConfig } from '../_config.js'\nimport type { HttpClient } from '../_http.js'\nimport { invokeWithRetry } from '../_request.js'\nimport type { UsageReport, UsageRollup, UsageUsersReport } from '../types/usage.js'\n\nexport class ManagementUsageResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\n\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 /**\n * List distinct acting-user emails observed in 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 * @returns User emails seen in usage during 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 listUsers(options: { since: string; until: string }): Promise<UsageUsersReport> {\n const query: Record<string, string> = {\n since: options.since,\n until: options.until,\n }\n const data = await invokeWithRetry(this.config, this.http, 'UsageController_listUsers', {\n query,\n })\n return data as UsageUsersReport\n }\n}\n","import type { ModusConfig } from '../_config.js'\nimport type { HttpClient } from '../_http.js'\nimport { asRecord, invokeWithRetry } from '../_request.js'\nimport { aipListParams, buildAipPage, type Page } from '../_pagination.js'\nimport { validatePageSize } from '../_validation.js'\nimport type { ToolCatalogEntry } from '../types/tools.js'\n\nfunction parseToolCatalogEntry(raw: unknown): ToolCatalogEntry {\n return raw as ToolCatalogEntry\n}\n\nexport class ManagementToolsResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\n\n /**\n * List tool and integration surfaces a scope can select in its toolset.\n *\n * @param options.pageSize - Maximum items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.\n * @returns A page of tool catalog entries.\n */\n list(options: { pageSize?: number; pageToken?: string } = {}): Promise<Page<ToolCatalogEntry>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken)\n }\n\n private async listPage(pageSize: number, pageToken: string | undefined): Promise<Page<ToolCatalogEntry>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ToolsController_list', {\n query: aipListParams(pageSize, pageToken) as Record<string, string | number | boolean | undefined | null>,\n }),\n )\n return buildAipPage(data, 'tools', parseToolCatalogEntry, (token) => this.listPage(pageSize, token))\n }\n}\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 {\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 { ToolsetInput } from './types/toolset.js'\nexport type {\n Memory,\n MemorySearchRequest,\n MemorySearchResult,\n MemoryUpdate,\n} from './types/memories.js'\n"],"mappings":";;;;;;;;;;;;;;AAAO,SAAS,gBACd,YACoC;AACpC,MAAI,eAAe,OAAW,QAAO;AACrC,MAAI,CAAC,WAAW,KAAK,GAAG;AACtB,UAAM,IAAI,MAAM,qEAAqE;AAAA,EACvF;AACA,SAAO,EAAE,WAAW;AACtB;;;ACRA,IAAM,oBAAoB;AAEnB,SAAS,0BAA0B,YAA+C;AACvF,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,kBAAkB,EAAE,CAAC,iBAAiB,GAAG,EAAE,KAAK,MAAM,QAAQ,KAAK,EAAE;AAAA,IACrE;AAAA,IACA,YAAY,CAAC;AAAA,EACf;AACF;AAEO,SAAS,0BACd,UACA,YACyB;AACzB,MAAI,CAAC,YAAY,OAAO,KAAK,QAAQ,EAAE,WAAW,GAAG;AACnD,WAAO,0BAA0B,UAAU;AAAA,EAC7C;AACA,SAAO,EAAE,GAAG,UAAU,WAAW;AACnC;AAEO,SAAS,wBAAwB,KAAuD;AAC7F,QAAM,QAAQ,IAAI,gBAAgB,IAAI;AACtC,MAAI,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC/D,WAAO;AAAA,EACT;AACA,SAAO,CAAC;AACV;AAEO,SAAS,0BACd,YACqC;AACrC,MAAI,eAAe,OAAW,QAAO;AACrC,SAAO,0BAA0B,UAAU;AAC7C;AAEA,eAAsB,0BACpB,YACA,cAC8C;AAC9C,M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,YACmB,MACA,QACjB;AAFiB;AACA;AAAA,EAChB;AAAA;AAAA,EAGH,MAAM,mBAA2C;AAC/C,UAAM,OAAQ,MAAM;AAAA,MAClB,KAAK;AAAA,MAAQ,KAAK;AAAA,MAAM;AAAA,IAC1B;AACA,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,MAAM,iBAAuC;AAC3C,UAAM,OAAQ,MAAM;AAAA,MAClB,KAAK;AAAA,MAAQ,KAAK;AAAA,MAAM;AAAA,IAC1B;AACA,WAAO,KAAK;AAAA,EACd;AACF;;;ACbO,IAAM,kBAAN,cAA8B,gBAAgB;AAAA,EAQnD,YAAY,UAAwB,CAAC,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":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/_query.ts","../../src/management/_access-config.ts","../../src/management/workflows/interfaces.ts","../../src/management/workflows/agents.ts","../../src/types/context.ts","../../src/management/context/_content-merge.ts","../../src/management/context/files.ts","../../src/management/context/items.ts","../../src/management/context/context.ts","../../src/management/scopes/memories.ts","../../src/management/scopes/evaluations.ts","../../src/management/scopes/supervision.ts","../../src/management/scopes/skills.ts","../../src/management/usage.ts","../../src/management/tools.ts","../../src/management/users.ts","../../src/management/index.ts"],"sourcesContent":["export function updateMaskQuery(\n updateMask?: string,\n): Record<string, string> | undefined {\n if (updateMask === undefined) return undefined\n if (!updateMask.trim()) {\n throw new Error('update_mask must be a non-empty comma-separated list of field names')\n }\n return { updateMask }\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","import 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 { 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 {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n private readonly workflowId: number | string,\n ) {}\n\n /** List interfaces attached to this workflow. */\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 }) as { interfaces: AgentInterface[] }\n return data.interfaces\n }\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: updateMask === undefined ? omitUndefined(options) : options,\n }) as AgentInterface\n }\n\n /**\n * Delete an interface from this workflow.\n *\n * @param interfaceId - Interface id.\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 /** Delete every interface from this workflow. */\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","import type { ModusConfig } from '../../_config.js'\nimport type { OperationId } from '../../_generated/operations.js'\nimport type { HttpClient } from '../../_http.js'\nimport { updateMaskQuery } from '../../_query.js'\nimport { aipListParams, buildAipPage, type Page } from '../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId, validatePageSize } from '../../_validation.js'\nimport type { Workflow, WorkflowType } from '../../types/workflows.js'\nimport type { VariationView } from '../../types/views.js'\nimport {\n accessConfigBodyForCreate,\n accessConfigBodyForUpdate,\n} from '../_access-config.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 workflowsListParams(\n pageSize: number,\n pageToken: string | undefined,\n search?: string,\n type?: WorkflowType,\n view?: VariationView,\n includeVariation?: boolean,\n): Record<string, string | number | boolean | undefined | null> {\n const extra: Record<string, string | number | boolean | undefined | null> = {}\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 return aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >\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 guardrails?: string[]\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 guardrails?: string[]\n updateMask?: string\n}\n\n/** @deprecated Use `UpdateWorkflowOptions` instead. */\nexport type UpdateAgentOptions = UpdateWorkflowOptions\n\nexport class ManagementWorkflowsResource {\n protected readonly ops: ManagementWorkflowsOperations = MANAGEMENT_WORKFLOW_OPERATIONS\n\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\n\n /**\n * List workflows in the organization.\n *\n * @param options.pageSize - Maximum items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.\n * @param options.search - Case-insensitive substring filter on the workflow name.\n * @param options.type - Filter by workflow type: `\"task\"` or `\"workflow\"`.\n * @param options.view - Variation view: `\"active\"` (deployed) or `\"draft\"`.\n * @param options.includeVariation - Include variation payload on each list row.\n * @returns A page of workflows.\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(\n pageSize,\n options.pageToken,\n options.search,\n options.type,\n options.view,\n options.includeVariation,\n )\n }\n\n private 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 data = asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.list, {\n query: workflowsListParams(pageSize, pageToken, search, type, view, includeVariation),\n }),\n )\n // List envelope is `workflows` only (Release N+1).\n return buildAipPage(\n data,\n 'workflows',\n parseWorkflow,\n (token) => this.listPage(pageSize, token, search, type, view, includeVariation),\n )\n }\n\n /**\n * Retrieve a workflow with full configuration.\n *\n * @param workflowId - Workflow id.\n * @param options.view - Variation view: `\"active\"` (deployed) or `\"draft\"`.\n * @returns The workflow.\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 - `\"task\"` for single-step orchestration, or `\"workflow\"` for a multi-step graph.\n * @param options.trigger - Optional trigger configuration.\n * @param options.guardrails - Runtime guardrail labels (for example `\"no-pii\"`). Omit to create with no guardrails.\n * @returns The created workflow (draft).\n * @example\n * ```ts\n * const wf = await mgmt.workflows.create({ name: 'Daily report', type: WorkflowType.Task })\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 accessConfig: accessConfigBodyForCreate(options.guardrails),\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.\n *\n * @param workflowId - Workflow id.\n * @param options.guardrails - Guardrail labels to set. Fetches the current workflow first to merge. Pass `[]` to clear all.\n * @param options.updateMask - Comma-separated field names to update or clear.\n * @returns The updated workflow.\n */\n async update(workflowId: number | string, options: UpdateWorkflowOptions = {}): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const accessConfig = await accessConfigBodyForUpdate(options.guardrails, async () =>\n asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.get, {\n pathParams: { id: workflowId },\n }),\n ),\n )\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 accessConfig,\n }\n const body = options.updateMask !== undefined ? fields : omitUndefined(fields)\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 * await mgmt.workflows.update(workflowId, { description: 'Runs every morning' })\n * const published = await mgmt.workflows.deploy(workflowId)\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 * Delete a workflow.\n *\n * @param workflowId - Workflow id.\n * @returns Resolves when the workflow is deleted.\n */\n async delete(workflowId: number | string): Promise<void> {\n validateId(workflowId, 'workflow_id')\n await invokeWithRetry(this.config, this.http, this.ops.delete, {\n pathParams: { id: workflowId },\n })\n }\n\n /**\n * Restore a previously deleted workflow.\n *\n * @param workflowId - Workflow id.\n * @returns The restored workflow.\n */\n async restore(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {\n pathParams: { id: workflowId },\n jsonBody: {},\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 /** Cancel a pending workflow ownership transfer. */\n async cancelOwnershipTransfer(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.cancelOwnershipTransfer,\n { pathParams: { id: workflowId } },\n )\n return parseWorkflow(data)\n }\n\n /** Accept a pending workflow ownership transfer. */\n async acceptOwnershipTransfer(workflowId: number | string): Promise<Workflow> {\n validateId(workflowId, 'workflow_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.acceptOwnershipTransfer,\n { pathParams: { id: workflowId }, jsonBody: {} },\n )\n return parseWorkflow(data)\n }\n}\n","import type { components } from '../_generated/v1.js'\n\nexport type ContextItem = components['schemas']['ContextItemDto']\nexport type ContextItemLookupRow = components['schemas']['LookupContextItemRowDto']\nexport type ContextItemDeletion = components['schemas']['DeleteContextItemResponseDto']\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 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 Error(`Expected contextType ${contextType}, got ${item.contextType}.`)\n }\n if (!item.content || typeof item.content !== 'object' || Array.isArray(item.content)) {\n throw new Error(`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 Error('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","import { readdir, readFile, stat } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport type { ModusConfig } from '../../_config.js'\nimport { ModusError } from '../../_exceptions.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 BulkUploadFromUrlsResult,\n BulkUploadUrlsResult,\n FileUpload,\n UploadDirFailure,\n UploadDirResult,\n UploadFromUrlInput,\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_LIST_PAGE_SIZE = 50\nconst DEFAULT_PUT_TIMEOUT_MS = 60_000\nconst DEFAULT_POLL_INTERVAL_MS = 500\nconst DEFAULT_UPLOAD_TIMEOUT_MS = 120_000\nconst DEFAULT_CONCURRENCY = 10\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\nfunction validateWaitUntil(waitUntil: string): asserts waitUntil is WaitUntil {\n if (!WAIT_UNTIL_VALUES.has(waitUntil as WaitUntil)) {\n throw new Error(`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 Error(`${name} must not be empty`)\n if (count > MAX_BULK_UPLOAD_FILES) {\n throw new Error(`${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/** 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): 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 results[index] = await worker(items[index] as T)\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\nasync function putBytes(\n fetchImpl: typeof fetch,\n url: string,\n data: Uint8Array,\n contentType: string,\n timeoutMs: number,\n): Promise<void> {\n const response = await fetchImpl(url, {\n method: 'PUT',\n body: data,\n headers: { 'Content-Type': contentType },\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) => (u.fileName !== undefined ? { url: u.url, fileName: u.fileName } : { url: u.url })),\n }\n}\n\ntype SlotAssignment = { path: string; slot: UploadUrlSlot }\n\nfunction assignSlots(\n batch: readonly string[],\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] as string, 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 path of remaining.slice(uploaded.length)) {\n failed.push({ 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({ path: remaining[i] as string, 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 */\nexport class ManagementContextFilesResource {\n /** @internal */\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\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, then poll `get(uploadId)` — there is no separate finalize call.\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 * @returns File upload resource with status `processing` — parsing continues async.\n */\n async uploadFromUrl(url: string, options: { fileName?: string } = {}): Promise<FileUpload> {\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_uploadFromUrl', {\n jsonBody: options.fileName !== undefined ? { url, fileName: options.fileName } : { url },\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 * Fetch one file upload by its id.\n *\n * @param uploadId - Upload id returned by `createUploadUrl` / `uploadFromUrl`.\n * @returns The file upload resource, including its processing `status`.\n */\n async get(uploadId: string): Promise<FileUpload> {\n validateId(uploadId, 'uploadId')\n return asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextFilesController_get', {\n pathParams: { uploadId },\n }),\n ) as unknown as FileUpload\n }\n\n /**\n * List durable file uploads.\n *\n * @param options.pageSize - Items per page (default 50).\n * @param options.pageToken - Opaque token from a previous page's `nextPageToken`.\n * @returns Page of file uploads. Uploads that only have a pending row (not yet\n * landed) aren't included here — use `get(uploadId)` for those.\n */\n list(options: { pageSize?: number; pageToken?: string } = {}): Promise<Page<FileUpload>> {\n const pageSize = options.pageSize ?? DEFAULT_LIST_PAGE_SIZE\n validatePageSize(pageSize, 200)\n return this.listPage(pageSize, options.pageToken)\n }\n\n private async listPage(pageSize: number, pageToken: string | undefined): 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 | readonly string[] | undefined | null\n >,\n }),\n )\n return buildAipPage(data, 'files', (raw) => raw as FileUpload, (token) => this.listPage(pageSize, token))\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()` until the\n * 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 * @returns The file upload resource once it reaches `waitUntil` (or `\"failed\"`).\n * @throws {ModusError} If the PUT fails, or polling times out.\n */\n async upload(\n path: string,\n options: { waitUntil?: WaitUntil; pollIntervalMs?: number; timeoutMs?: number } = {},\n ): Promise<FileUpload> {\n const waitUntil = options.waitUntil ?? 'processing'\n validateWaitUntil(waitUntil)\n const fileStat = await stat(path)\n if (!fileStat.isFile()) throw new Error(`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.uploadUrl, data, slot.contentType, DEFAULT_PUT_TIMEOUT_MS)\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 * @returns `UploadDirResult` with every successful `FileUpload` and every\n * per-file failure (slot creation or PUT/poll), each tagged with its local path.\n */\n async uploadDir(\n path: string,\n options: { recursive?: boolean; concurrency?: number; waitUntil?: WaitUntil } = {},\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 Error(`concurrency must be >= 1, got ${concurrency}`)\n const dirStat = await stat(path)\n if (!dirStat.isDirectory()) throw new Error(`Not a directory: ${path}`)\n\n const uploaded: FileUpload[] = []\n const failed: UploadDirFailure[] = []\n const files = await walkFiles(path, options.recursive ?? true)\n for (const batch of chunked(files, MAX_BULK_UPLOAD_FILES)) {\n const slots = await this.createSlots(batch, failed)\n const results = await this.uploadBatch(slots, waitUntil, concurrency)\n for (const result of results) {\n if ('error' in result) failed.push(result)\n else uploaded.push(result)\n }\n }\n return { uploaded, failed }\n }\n\n private async createSlots(batch: readonly string[], failed: UploadDirFailure[]): Promise<SlotAssignment[]> {\n const readable: string[] = []\n const inputs: UploadUrlInput[] = []\n for (const path of batch) {\n try {\n const fileStat = await stat(path)\n const fileName = path.split(/[/\\\\]/).pop() as string\n inputs.push({ fileName, contentType: DEFER_CONTENT_TYPE_TO_SERVER, fileSize: fileStat.size })\n readable.push(path)\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n failed.push({ 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 ): Promise<(FileUpload | UploadDirFailure)[]> {\n if (slots.length === 0) return []\n return mapWithConcurrency(slots, concurrency, async ({ path, slot }) => {\n try {\n const data = await readFile(path)\n await putBytes(this.config.fetch, slot.uploadUrl, data, slot.contentType, DEFAULT_PUT_TIMEOUT_MS)\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 }\n }\n })\n }\n}\n","import type { ModusConfig } from '../../_config.js'\nimport type { HttpClient } from '../../_http.js'\nimport { updateMaskQuery } from '../../_query.js'\nimport { aipListParams, buildAipPage, type Page } from '../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validatePageSize } from '../../_validation.js'\nimport type { ContextItem, ContextItemDeletion } from '../../types/context.js'\nimport type { UserFeedback } from './_content-merge.js'\n\nfunction contextListParams(\n pageSize: number,\n pageToken: string | undefined,\n contextType?: string,\n): Record<string, string | number | boolean | readonly string[] | undefined | null> {\n const extra: Record<string, string | readonly string[]> = {}\n if (contextType !== undefined) extra.contextTypes = [contextType]\n return aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | readonly string[] | undefined | null\n >\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 * @returns A page of context items.\n */\n list(options: {\n pageSize?: number\n pageToken?: string\n contextType?: string\n } = {}): Promise<Page<ContextItem>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken, options.contextType)\n }\n\n private async listPage(\n pageSize: number,\n pageToken: string | undefined,\n contextType?: string,\n ): Promise<Page<ContextItem>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ContextItemsController_list', {\n query: contextListParams(pageSize, pageToken, contextType),\n }),\n )\n return buildAipPage(data, 'contextItems', parseContextItem, (token) =>\n this.listPage(pageSize, token, contextType),\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.\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 =\n options.updateMask !== undefined\n ? {\n content: options.content,\n contextType: options.contextType,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n }\n : omitUndefined({\n content: options.content,\n contextType: options.contextType,\n description: options.description,\n userFeedback: options.userFeedback,\n topics: options.topics,\n })\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.\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","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 { 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\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 }\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 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 */\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 */\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 */\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 */\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 */\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","import type { ModusConfig } from '../../_config.js'\nimport type { HttpClient } from '../../_http.js'\nimport { updateMaskQuery } from '../../_query.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 Memory,\n MemorySearchRequest,\n MemorySearchResult,\n MemoryUpdate,\n} from '../types/memories.js'\n\nfunction parseMemory(raw: unknown): Memory {\n return raw as Memory\n}\n\n/** Long-term memory stored per scope. */\nexport class ScopeMemoriesResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n private readonly scopeId: number | string,\n ) {}\n\n /**\n * List memories stored for this scope.\n *\n * @param options.pageSize - Items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`.\n * @param options.userId - Optional end-user id when memories are scoped per user.\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 private 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(data, 'memories', parseMemory, (token) =>\n this.listPage(pageSize, token, userId),\n )\n }\n\n /**\n * Search this scope's memories by natural-language query.\n *\n * @param request - Query text and optional `userId` / `limit`.\n * @returns Matching memories and relevance scores.\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 one memory. Requires manage permission on the scope.\n *\n * @param memoryId - Id from list or search.\n * @param update - Fields to change (`memory` and/or `metadata`).\n * @param options.updateMask - Optional comma-separated field names to update.\n * @returns The updated memory.\n */\n async update(\n memoryId: string,\n update: MemoryUpdate,\n options: { updateMask?: string } = {},\n ): Promise<Memory> {\n validateId(memoryId, 'memory_id')\n validateId(this.scopeId, 'scope_id')\n const data = 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 return parseMemory(data)\n }\n\n /** Delete one memory (idempotent). */\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 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 '../types/evaluations.js'\n\nfunction parseConfig(raw: unknown): EvaluationConfig {\n return raw as EvaluationConfig\n}\n\nfunction parseRun(raw: unknown): EvaluationRun {\n return raw as EvaluationRun\n}\n\n/** Scheduled and manual scope evaluations. */\nexport class ScopeEvaluationsResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n private readonly scopeId: number | string,\n ) {}\n\n /** Get the evaluation configuration for this scope. */\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 parseConfig(data)\n }\n\n /**\n * Update the evaluation configuration for this scope.\n *\n * @param update - Configuration fields to change.\n * @returns The updated evaluation configuration.\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 parseConfig(data)\n }\n\n /**\n * Trigger a manual evaluation run for this scope.\n *\n * @returns The triggered run id and 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 for this scope.\n *\n * @param options.pageSize - Items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`.\n * @returns A page of evaluation runs.\n */\n listRuns(options: { pageSize?: number; pageToken?: string } = {}): Promise<Page<EvaluationRun>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listRunsPage(pageSize, options.pageToken)\n }\n\n private 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(data, 'runs', parseRun, (token) => this.listRunsPage(pageSize, token))\n }\n\n /**\n * Retrieve one evaluation run with full results.\n *\n * @param runId - Evaluation run id.\n * @returns The run and its result details.\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","import type { ModusConfig } from '../../_config.js'\nimport type { HttpClient } from '../../_http.js'\nimport { invokeWithRetry } from '../../_request.js'\nimport { validateId } from '../../_validation.js'\nimport type { components } from '../../_generated/v1.js'\nimport type { VariationView } from '../../types/views.js'\n\nexport type Supervision = components['schemas']['SupervisionDto']\nexport type SetSupervisionRequest = components['schemas']['SetSupervisionRequestDto']\n\nexport class ScopeSupervisionResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n private readonly scopeId: number | string,\n ) {}\n\n /**\n * Get this scope's supervision configuration.\n *\n * @param options.view - Optional scope variation to inspect.\n * @returns The supervision configuration.\n */\n async get(options: { view?: VariationView } = {}): Promise<Supervision> {\n validateId(this.scopeId, 'scope_id')\n return await invokeWithRetry(this.config, this.http, 'ScopeSupervisionController_get', {\n pathParams: { id: this.scopeId },\n query: options.view === undefined ? undefined : { view: options.view },\n }) as Supervision\n }\n\n /**\n * Replace this scope's subordinate scopes.\n *\n * @param request - Replacement supervision configuration.\n * @returns The updated supervision configuration.\n */\n async set(request: SetSupervisionRequest): Promise<Supervision> {\n return this.write('ScopeSupervisionController_set', request)\n }\n\n /**\n * Replace subordinate scopes on the active (deployed) scope version.\n *\n * @param request - Replacement supervision configuration.\n * @returns The updated supervision configuration.\n */\n async setActive(request: SetSupervisionRequest): Promise<Supervision> {\n return this.write('ScopeSupervisionController_setActive', request)\n }\n\n private async write(operation: 'ScopeSupervisionController_set' | 'ScopeSupervisionController_setActive',\n request: SetSupervisionRequest): Promise<Supervision> {\n validateId(this.scopeId, 'scope_id')\n return await invokeWithRetry(this.config, this.http, operation, {\n pathParams: { id: this.scopeId },\n jsonBody: request,\n }) as Supervision\n }\n}\n","import type { ModusConfig } from '../../_config.js'\nimport type { OperationId } from '../../_generated/operations.js'\nimport type { HttpClient } from '../../_http.js'\nimport { updateMaskQuery } from '../../_query.js'\nimport { aipListParams, buildAipPage, type Page } from '../../_pagination.js'\nimport { asRecord, invokeWithRetry, omitUndefined } from '../../_request.js'\nimport { validateId, validatePageSize } from '../../_validation.js'\nimport { ScopeConversationsResource } from '../../resources/scopes/conversations.js'\nimport type { Scope } from '../../types/scopes.js'\nimport type { VariationView } from '../../types/views.js'\nimport {\n accessConfigBodyForCreate,\n accessConfigBodyForUpdate,\n} from '../_access-config.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 { 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 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\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 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 scopesListParams(\n pageSize: number,\n pageToken: string | undefined,\n search?: string,\n view?: VariationView,\n managerId?: number,\n): Record<string, string | number | boolean | undefined | null> {\n const extra: Record<string, string | number | boolean | undefined | null> = {}\n if (search !== undefined) extra.search = search\n if (view !== undefined) extra.view = view\n if (managerId !== undefined) extra.managerId = managerId\n return aipListParams(pageSize, pageToken, extra) as Record<\n string,\n string | number | boolean | undefined | null\n >\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?: JsonObjectListInput\n contextSelections?: JsonObjectListInput\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?: JsonObjectListInput\n contextSelections?: JsonObjectListInput\n interfaces?: JsonObjectListInput\n guardrails?: string[]\n managerId?: string\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 {\n protected readonly ops: ManagementScopesOperations = MANAGEMENT_SCOPE_OPERATIONS\n\n /** @internal */\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\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 * List scopes in the organization.\n *\n * @param options.pageSize - Maximum items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.\n * @param options.search - Case-insensitive substring filter on the scope name.\n * @param options.view - Variation view: `\"active\"` (deployed) or `\"draft\"`.\n * @param options.managerId - Return only scopes supervised by this manager scope id.\n * @returns A page of scopes.\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(\n pageSize,\n options.pageToken,\n options.search,\n options.view,\n options.managerId,\n )\n }\n\n private async listPage(\n pageSize: number,\n pageToken: string | undefined,\n search?: string,\n view?: VariationView,\n managerId?: number,\n ): Promise<Page<Scope>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, this.ops.list, {\n query: scopesListParams(pageSize, pageToken, search, view, managerId),\n }),\n )\n // List envelope is `scopes` only (Release N+1).\n return buildAipPage(\n data,\n 'scopes',\n parseScope,\n (token) => this.listPage(pageSize, token, search, view, managerId),\n )\n }\n\n /**\n * Retrieve a scope with full configuration.\n *\n * @param scopeId - Scope id.\n * @param options.view - Variation view: `\"active\"` (deployed) or `\"draft\"`.\n * @returns The scope.\n */\n async get(scopeId: number | string, options: { view?: VariationView } = {}): Promise<Scope> {\n validateId(scopeId, 'scope_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: scopeId },\n query,\n })\n return parseScope(data)\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.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 scope = await mgmt.scopes.create({ name: 'Support assistant', model: 'claude-sonnet-5' })\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 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 *\n * @param scopeId - Scope id.\n * @param options.guardrails - Guardrail labels to set. Fetches the current scope first to merge. Pass `[]` to clear all.\n * @param options.updateMask - Comma-separated field names to update or clear.\n * @returns The updated scope.\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 =\n options.updateMask !== undefined ? fields : omitUndefined(fields)\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 * await mgmt.scopes.update(scopeId, { instructions: ['Be concise.'] })\n * const published = await mgmt.scopes.deploy(scopeId)\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 * Delete a scope.\n *\n * @param scopeId - Scope id.\n * @returns Resolves when the scope is deleted.\n */\n async delete(scopeId: number | string): Promise<void> {\n validateId(scopeId, 'scope_id')\n await invokeWithRetry(this.config, this.http, this.ops.delete, {\n pathParams: { id: scopeId },\n })\n }\n\n /**\n * Restore a previously deleted scope.\n *\n * @param scopeId - Scope id.\n * @returns The restored scope.\n */\n async restore(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {\n pathParams: { id: scopeId },\n jsonBody: {},\n })\n return parseScope(data)\n }\n\n /**\n * Start transferring ownership of a scope to another organization member.\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 /** Cancel a pending scope ownership transfer. */\n async cancelOwnershipTransfer(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.cancelOwnershipTransfer,\n { pathParams: { id: scopeId } },\n )\n return parseScope(data)\n }\n\n /** Accept a pending scope ownership transfer. */\n async acceptOwnershipTransfer(scopeId: number | string): Promise<Scope> {\n validateId(scopeId, 'scope_id')\n const data = await invokeWithRetry(\n this.config,\n this.http,\n this.ops.acceptOwnershipTransfer,\n { pathParams: { id: scopeId }, jsonBody: {} },\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","import type { ModusConfig } from '../_config.js'\nimport type { HttpClient } from '../_http.js'\nimport { invokeWithRetry } from '../_request.js'\nimport type { UsageReport, UsageRollup, UsageUsersReport } from '../types/usage.js'\n\nexport class ManagementUsageResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\n\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 /**\n * List distinct acting-user emails observed in 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 * @returns User emails seen in usage during 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 listUsers(options: { since: string; until: string }): Promise<UsageUsersReport> {\n const query: Record<string, string> = {\n since: options.since,\n until: options.until,\n }\n const data = await invokeWithRetry(this.config, this.http, 'UsageController_listUsers', {\n query,\n })\n return data as UsageUsersReport\n }\n}\n","import type { ModusConfig } from '../_config.js'\nimport type { HttpClient } from '../_http.js'\nimport { asRecord, invokeWithRetry } from '../_request.js'\nimport { aipListParams, buildAipPage, type Page } from '../_pagination.js'\nimport { validatePageSize } from '../_validation.js'\nimport type { ToolCatalogEntry } from '../types/tools.js'\n\nfunction parseToolCatalogEntry(raw: unknown): ToolCatalogEntry {\n return raw as ToolCatalogEntry\n}\n\nexport class ManagementToolsResource {\n constructor(\n private readonly http: HttpClient,\n private readonly config: ModusConfig,\n ) {}\n\n /**\n * List tool and integration surfaces a scope can select in its toolset.\n *\n * @param options.pageSize - Maximum items per page (default 25).\n * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.\n * @returns A page of tool catalog entries.\n */\n list(options: { pageSize?: number; pageToken?: string } = {}): Promise<Page<ToolCatalogEntry>> {\n const pageSize = options.pageSize ?? 25\n validatePageSize(pageSize)\n return this.listPage(pageSize, options.pageToken)\n }\n\n private async listPage(pageSize: number, pageToken: string | undefined): Promise<Page<ToolCatalogEntry>> {\n const data = asRecord(\n await invokeWithRetry(this.config, this.http, 'ToolsController_list', {\n query: aipListParams(pageSize, pageToken) as Record<string, string | number | boolean | undefined | null>,\n }),\n )\n return buildAipPage(data, 'tools', parseToolCatalogEntry, (token) => this.listPage(pageSize, token))\n }\n}\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 {\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 BulkUploadFromUrlsResult,\n BulkUploadUrlsResult,\n FailedUploadFromUrl,\n FailedUploadUrl,\n FileUpload,\n FileUploadStatus,\n UploadDirFailure,\n UploadDirResult,\n UploadFromUrlInput,\n UploadUrlInput,\n UploadUrlSlot,\n WaitUntil,\n} from '../types/context-files.js'\nexport type { ToolsetInput } from './types/toolset.js'\nexport type {\n Memory,\n MemorySearchRequest,\n MemorySearchResult,\n MemoryUpdate,\n} from './types/memories.js'\n"],"mappings":";;;;;;;;;;;;;;;AAAO,SAAS,gBACd,YACoC;AACpC,MAAI,eAAe,OAAW,QAAO;AACrC,MAAI,CAAC,WAAW,KAAK,GAAG;AACtB,UAAM,IAAI,MAAM,qEAAqE;AAAA,EACvF;AACA,SAAO,EAAE,WAAW;AACtB;;;ACRA,IAAM,oBAAoB;AAEnB,SAAS,0BAA0B,YAA+C;AACvF,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,kBAAkB,EAAE,CAAC,iBAAiB,GAAG,EAAE,KAAK,MAAM,QAAQ,KAAK,EAAE;AAAA,IACrE;AAAA,IACA,YAAY,CAAC;AAAA,EACf;AACF;AAEO,SAAS,0BACd,UACA,YACyB;AACzB,MAAI,CAAC,YAAY,OAAO,KAAK,QAAQ,EAAE,WAAW,GAAG;AACnD,WAAO,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