131 lines
4.3 KiB
Markdown
131 lines
4.3 KiB
Markdown
# subagentschedule
|
|
|
|
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
|
|
|
## `subagentschedule.create`
|
|
|
|
*Source: `src/store/subagentschedule/create.js`*
|
|
|
|
Creates a new subagent schedule for the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `input` | `object` | Schedule input. |
|
|
| `input.prompt` | `string` | The task prompt for the subagent. |
|
|
| `input.cron` | `string` | Standard 5-field cron timetable string. |
|
|
| `[input.desc]` | `string` | Optional schedule description. |
|
|
| `[input.skills]` | `string|Array<string>` | Optional skill names or JSON string. |
|
|
| `[input.lastagentnote]` | `string` | Optional initial agent note. |
|
|
| `[input.max_itr=15]` | `number` | Optional max iterations per run. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, company_id: number, desc: string|null, prompt: string, skills: string|null, lastagentnote: string|null, max_itr: number, cron: string, created_at: string, lastrun_at: string|null}>`
|
|
|
|
**Throws**
|
|
|
|
`Error` — If prompt is missing, cron is invalid, or max_itr is invalid.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const schedule = await store.subagentschedule.create(googleAuthId, {
|
|
desc: 'Nightly inventory audit',
|
|
prompt: 'Check stock discrepancies across all warehouses and summarize.',
|
|
cron: '0 2 * * *',
|
|
skills: ['stock', 'reporting'],
|
|
max_itr: 20,
|
|
});
|
|
```
|
|
|
|
## `subagentschedule.delete`
|
|
|
|
*Source: `src/store/subagentschedule/delete.js`*
|
|
|
|
Deletes a subagent schedule by id for the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `id` | `number` | The schedule ID to delete. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<void>`
|
|
|
|
**Throws**
|
|
|
|
`Error` — If schedule not found.
|
|
|
|
## `subagentschedule.getById`
|
|
|
|
*Source: `src/store/subagentschedule/getById.js`*
|
|
|
|
Retrieves a single subagent schedule by id for the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `id` | `number` | The schedule ID. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, company_id: number, desc: string|null, prompt: string, skills: string|null, lastagentnote: string|null, max_itr: number, cron: string, created_at: string, lastrun_at: string|null}|null>`
|
|
|
|
## `subagentschedule.list`
|
|
|
|
*Source: `src/store/subagentschedule/list.js`*
|
|
|
|
Lists all subagent schedules for the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<Array<{id: number, company_id: number, desc: string|null, prompt: string, skills: string|null, lastagentnote: string|null, max_itr: number, cron: string, created_at: string, lastrun_at: string|null}>>`
|
|
|
|
## `subagentschedule.update`
|
|
|
|
*Source: `src/store/subagentschedule/update.js`*
|
|
|
|
Updates an existing subagent schedule for the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `id` | `number` | The schedule ID to update. |
|
|
| `input` | `object` | Update payload. |
|
|
| `[input.prompt]` | `string` | Optional updated task prompt. |
|
|
| `[input.cron]` | `string` | Optional updated cron expression. |
|
|
| `[input.desc]` | `string|null` | Optional updated description. |
|
|
| `[input.skills]` | `string|Array<string>|null` | Optional updated skills. |
|
|
| `[input.lastagentnote]` | `string|null` | Optional updated agent note. |
|
|
| `[input.max_itr]` | `number` | Optional updated max iterations. |
|
|
| `[input.lastrun_at]` | `string|null` | Optional updated last run timestamp. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, company_id: number, desc: string|null, prompt: string, skills: string|null, lastagentnote: string|null, max_itr: number, cron: string, created_at: string, lastrun_at: string|null}>`
|
|
|
|
**Throws**
|
|
|
|
`Error` — If schedule not found, prompt is empty, cron is invalid, or max_itr is invalid.
|