@capybara-hq/kernel 0.1.0-rc.21 → 0.1.0-rc.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/admin.controller.d.ts +3 -3
- package/dist/admin/admin.controller.js +6 -2
- package/dist/admin/admin.schemas.d.ts +13 -0
- package/dist/agents/admin-agents.d.ts +16 -3
- package/dist/agents/admin-agents.js +65 -7
- package/dist/agents/agents.schemas.d.ts +24 -6
- package/dist/agents/agents.service.d.ts +4 -3
- package/dist/agents/agents.service.js +39 -26
- package/dist/agents/definition.d.ts +44 -6
- package/dist/agents/definition.js +86 -18
- package/dist/agents/from-template.d.ts +6 -3
- package/dist/agents/from-template.js +57 -44
- package/dist/agents/org-templates.js +97 -41
- package/dist/agents/templates.d.ts +6 -0
- package/dist/agents/templates.js +15 -1
- package/dist/background/launch.d.ts +43 -5
- package/dist/background/launch.js +88 -8
- package/dist/background/session.d.ts +14 -2
- package/dist/background/session.js +26 -4
- package/dist/background/status.d.ts +1 -1
- package/dist/background/status.js +3 -3
- package/dist/background/stop.d.ts +0 -2
- package/dist/background/stop.js +1 -21
- package/dist/catalog/admin-catalog.controller.d.ts +2 -4
- package/dist/catalog/admin-catalog.controller.js +2 -6
- package/dist/catalog/catalog-content.d.ts +5 -0
- package/dist/catalog/catalog-content.js +1 -0
- package/dist/catalog/catalog.module.js +3 -0
- package/dist/catalog/claude/report.d.ts +9 -2
- package/dist/catalog/claude/report.js +1 -0
- package/dist/catalog/claude/translate.js +1 -1
- package/dist/catalog/component-promotion.js +1 -2
- package/dist/catalog/component-state.d.ts +13 -1
- package/dist/catalog/component-state.js +14 -5
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/marketplaces.service.js +2 -1
- package/dist/catalog/org-catalog.controller.d.ts +13 -3
- package/dist/catalog/org-catalog.controller.js +26 -4
- package/dist/catalog/org-catalog.schemas.d.ts +13 -0
- package/dist/catalog/org-catalog.schemas.js +34 -0
- package/dist/catalog/org-plugin-uploads.controller.js +0 -1
- package/dist/catalog/org-plugin-uploads.d.ts +0 -1
- package/dist/catalog/org-plugin-uploads.js +0 -3
- package/dist/catalog/org-plugin-uploads.schemas.d.ts +0 -1
- package/dist/catalog/org-plugin-uploads.schemas.js +0 -2
- package/dist/catalog/platform-components.d.ts +0 -1
- package/dist/catalog/platform-components.js +3 -8
- package/dist/catalog/plugin-import.d.ts +0 -8
- package/dist/catalog/plugin-import.js +4 -35
- package/dist/catalog/plugin-install.d.ts +2 -2
- package/dist/catalog/plugin-install.js +2 -2
- package/dist/catalog/plugin-package.d.ts +7 -0
- package/dist/catalog/plugin-package.js +27 -1
- package/dist/catalog/plugin-upgrade.d.ts +5 -6
- package/dist/catalog/plugin-upgrade.js +5 -23
- package/dist/catalog/requests.service.d.ts +66 -10
- package/dist/catalog/requests.service.js +196 -15
- package/dist/channels/actions.d.ts +2 -0
- package/dist/channels/actions.js +19 -4
- package/dist/channels/cards.d.ts +16 -2
- package/dist/channels/cards.js +40 -7
- package/dist/channels/channels.module.js +3 -0
- package/dist/channels/outbound.d.ts +22 -1
- package/dist/channels/outbound.js +116 -7
- package/dist/channels/phrases.d.ts +25 -0
- package/dist/channels/phrases.js +19 -0
- package/dist/channels/threads.d.ts +12 -0
- package/dist/channels/threads.js +34 -0
- package/dist/config/schema.d.ts +23 -1
- package/dist/config/schema.js +107 -5
- package/dist/conversations/conversations.service.d.ts +42 -9
- package/dist/conversations/conversations.service.js +57 -25
- package/dist/conversations/events.d.ts +106 -11
- package/dist/conversations/events.js +121 -18
- package/dist/conversations/message-context.d.ts +6 -3
- package/dist/conversations/message-context.js +14 -10
- package/dist/conversations/queue.d.ts +15 -2
- package/dist/conversations/queue.js +22 -3
- package/dist/conversations/queue.service.d.ts +12 -6
- package/dist/conversations/queue.service.js +36 -13
- package/dist/db/kernel-schema.d.ts +105 -3
- package/dist/devices/conversation-devices.d.ts +8 -1
- package/dist/devices/conversation-devices.js +8 -0
- package/dist/devices/devices.controller.d.ts +21 -4
- package/dist/devices/devices.controller.js +46 -8
- package/dist/devices/devices.schemas.d.ts +9 -1
- package/dist/devices/devices.schemas.js +11 -3
- package/dist/devices/devices.service.d.ts +176 -4
- package/dist/devices/devices.service.js +347 -6
- package/dist/devices/dto.d.ts +56 -3
- package/dist/devices/dto.js +51 -1
- package/dist/devices/public-suffix.d.ts +6 -0
- package/dist/devices/public-suffix.js +79 -0
- package/dist/errors.d.ts +50 -5
- package/dist/errors.js +50 -5
- package/dist/evals/reconstruct.d.ts +18 -13
- package/dist/evals/reconstruct.js +50 -36
- package/dist/evals/recorded-tools.d.ts +7 -7
- package/dist/evals/recorded-tools.js +4 -3
- package/dist/evals/trajectory.d.ts +6 -1
- package/dist/evals/trajectory.js +7 -0
- package/dist/extensions/package.js +2 -2
- package/dist/http/api.module.js +5 -0
- package/dist/identity/settings.d.ts +53 -3
- package/dist/identity/settings.js +92 -9
- package/dist/inbox/inbox.module.js +2 -1
- package/dist/inbox/inbox.service.d.ts +19 -4
- package/dist/inbox/inbox.service.js +14 -3
- package/dist/infra/config/kernel-config.service.d.ts +7 -0
- package/dist/infra/config/kernel-config.service.js +31 -0
- package/dist/infra/events/kernel-events.d.ts +2 -1
- package/dist/local-devices/device-policy.service.d.ts +65 -0
- package/dist/local-devices/device-policy.service.js +217 -0
- package/dist/local-devices/local-device-gateway.d.ts +4 -2
- package/dist/local-devices/local-device-gateway.js +39 -11
- package/dist/local-devices/local-device-provider.d.ts +40 -3
- package/dist/local-devices/local-device-provider.js +109 -7
- package/dist/local-devices/local-devices.module.d.ts +2 -1
- package/dist/local-devices/local-devices.module.js +19 -3
- package/dist/local-devices/machines.d.ts +30 -3
- package/dist/local-devices/machines.js +79 -3
- package/dist/local-devices/network-grants.d.ts +104 -0
- package/dist/local-devices/network-grants.js +288 -0
- package/dist/local-devices/policy-summary.d.ts +20 -0
- package/dist/local-devices/policy-summary.js +63 -0
- package/dist/orgs/orgs.module.js +4 -10
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +4 -0
- package/dist/orgs/settings.controller.js +4 -3
- package/dist/orgs/settings.service.d.ts +172 -14
- package/dist/orgs/settings.service.js +229 -27
- package/dist/platform/exclusions.js +11 -1
- package/dist/platform/operation.js +4 -0
- package/dist/platform/ops/admin-items.ops.js +1 -1
- package/dist/platform/ops/admin.ops.js +32 -7
- package/dist/platform/ops/agent-skills.ops.js +2 -2
- package/dist/platform/ops/agent-templates.ops.js +2 -2
- package/dist/platform/ops/agents.ops.js +11 -15
- package/dist/platform/ops/devices.ops.js +3 -1
- package/dist/platform/ops/inbox.ops.js +19 -0
- package/dist/platform/ops/org-settings.ops.js +15 -6
- package/dist/platform/ops/orgs.ops.js +1 -0
- package/dist/platform/ops/platform.ops.d.ts +9 -1
- package/dist/platform/ops/platform.ops.js +34 -12
- package/dist/platform/ops/requests.ops.js +3 -2
- package/dist/platform/ops/schedules.ops.d.ts +21 -0
- package/dist/platform/ops/schedules.ops.js +470 -0
- package/dist/platform/ops/skills.ops.js +3 -3
- package/dist/platform/platform-ops.module.d.ts +2 -1
- package/dist/platform/platform-ops.module.js +5 -0
- package/dist/platform/route-schemas.js +3 -0
- package/dist/roles/worker.module.js +3 -0
- package/dist/runtime/context/build.js +13 -4
- package/dist/runtime/context/compaction.js +6 -3
- package/dist/runtime/context/device-paths.d.ts +43 -21
- package/dist/runtime/context/device-paths.js +104 -21
- package/dist/runtime/context/run-context.d.ts +9 -0
- package/dist/runtime/context/run-context.js +8 -0
- package/dist/runtime/context/skills.d.ts +14 -1
- package/dist/runtime/context/skills.js +36 -5
- package/dist/runtime/maintenance.d.ts +4 -2
- package/dist/runtime/maintenance.js +16 -5
- package/dist/runtime/run-finish.d.ts +6 -1
- package/dist/runtime/run-finish.js +16 -2
- package/dist/runtime/run-queue.js +21 -2
- package/dist/runtime/run-worker.js +14 -33
- package/dist/runtime/runtime.module.js +3 -0
- package/dist/runtime/subagents/definition.d.ts +32 -14
- package/dist/runtime/subagents/definition.js +106 -109
- package/dist/runtime/subagents/dispatch.js +4 -3
- package/dist/runtime/subagents/preamble.d.ts +2 -1
- package/dist/runtime/subagents/preamble.js +2 -1
- package/dist/runtime/waits.js +14 -4
- package/dist/sandbox/platform-tiers.d.ts +86 -0
- package/dist/sandbox/platform-tiers.js +97 -0
- package/dist/sandbox/sandbox.service.d.ts +121 -11
- package/dist/sandbox/sandbox.service.js +351 -30
- package/dist/sandbox/tiers.d.ts +98 -0
- package/dist/sandbox/tiers.js +104 -0
- package/dist/schedules/effective-settings.d.ts +16 -0
- package/dist/schedules/effective-settings.js +17 -0
- package/dist/schedules/errors.d.ts +8 -0
- package/dist/schedules/errors.js +8 -0
- package/dist/schedules/fire.d.ts +118 -0
- package/dist/schedules/fire.js +625 -0
- package/dist/schedules/grant-rules.d.ts +94 -0
- package/dist/schedules/grant-rules.js +126 -0
- package/dist/schedules/job-ids.d.ts +32 -0
- package/dist/schedules/job-ids.js +27 -0
- package/dist/schedules/pause.d.ts +9 -0
- package/dist/schedules/pause.js +33 -0
- package/dist/schedules/run-tracker.d.ts +81 -0
- package/dist/schedules/run-tracker.js +333 -0
- package/dist/schedules/scan.job.d.ts +64 -0
- package/dist/schedules/scan.job.js +303 -0
- package/dist/schedules/schedule-math.d.ts +31 -0
- package/dist/schedules/schedule-math.js +223 -0
- package/dist/schedules/scheduled-tasks.service.d.ts +351 -0
- package/dist/schedules/scheduled-tasks.service.js +1193 -0
- package/dist/schedules/schedules.controller.d.ts +68 -0
- package/dist/schedules/schedules.controller.js +242 -0
- package/dist/schedules/schedules.module.d.ts +16 -0
- package/dist/schedules/schedules.module.js +65 -0
- package/dist/schedules/schedules.schemas.d.ts +316 -0
- package/dist/schedules/schedules.schemas.js +186 -0
- package/dist/schedules/store.d.ts +81 -0
- package/dist/schedules/store.js +390 -0
- package/dist/schedules/store.module.d.ts +6 -0
- package/dist/schedules/store.module.js +21 -0
- package/dist/schedules/types.d.ts +108 -0
- package/dist/schedules/types.js +1 -0
- package/dist/schedules/unattended.d.ts +117 -0
- package/dist/schedules/unattended.js +228 -0
- package/dist/setup/oauth-token-probe.js +8 -4
- package/dist/skills/agent-skills.service.d.ts +4 -8
- package/dist/skills/agent-skills.service.js +18 -53
- package/dist/skills/catalog.d.ts +65 -62
- package/dist/skills/catalog.js +109 -206
- package/dist/skills/conversation-catalog.d.ts +3 -3
- package/dist/skills/conversation-catalog.js +5 -12
- package/dist/skills/invoke.d.ts +2 -2
- package/dist/skills/skills.controller.d.ts +3 -1
- package/dist/skills/skills.service.d.ts +38 -37
- package/dist/skills/skills.service.js +168 -107
- package/dist/skills/usable.d.ts +57 -8
- package/dist/skills/usable.js +172 -38
- package/dist/tools/approvals.controller.d.ts +4 -2
- package/dist/tools/approvals.controller.js +17 -2
- package/dist/tools/approvals.schemas.d.ts +1 -0
- package/dist/tools/approvals.schemas.js +3 -1
- package/dist/tools/approvals.service.d.ts +182 -7
- package/dist/tools/approvals.service.js +597 -13
- package/dist/tools/builtin-names.d.ts +25 -4
- package/dist/tools/builtin-names.js +45 -4
- package/dist/tools/builtins/builtin-tools.d.ts +8 -0
- package/dist/tools/builtins/builtin-tools.js +23 -2
- package/dist/tools/builtins/sandbox/bash.js +16 -7
- package/dist/tools/builtins/sandbox/common.d.ts +1 -1
- package/dist/tools/builtins/sandbox/common.js +33 -10
- package/dist/tools/builtins/sandbox/edit.js +7 -3
- package/dist/tools/builtins/sandbox/file-state.d.ts +31 -1
- package/dist/tools/builtins/sandbox/file-state.js +33 -3
- package/dist/tools/builtins/sandbox/write.js +8 -4
- package/dist/tools/builtins/schedules.d.ts +107 -0
- package/dist/tools/builtins/schedules.js +789 -0
- package/dist/tools/elicitation.d.ts +2 -0
- package/dist/tools/elicitation.js +1 -1
- package/dist/tools/fixed-ask.d.ts +7 -0
- package/dist/tools/fixed-ask.js +9 -0
- package/dist/tools/network-asks.d.ts +109 -0
- package/dist/tools/network-asks.js +221 -0
- package/dist/tools/pipeline.d.ts +53 -6
- package/dist/tools/pipeline.js +202 -13
- package/dist/tools/policy.d.ts +21 -8
- package/dist/tools/policy.js +63 -9
- package/dist/tools/registry.d.ts +10 -1
- package/dist/tools/tools.module.js +12 -0
- package/package.json +2 -2
- package/src/migrations/0113_scheduled_tasks.sql +108 -0
- package/src/migrations/0114_network_asks.sql +23 -0
- package/src/migrations/0115_network_requests.sql +28 -0
- package/src/migrations/0116_skills_default_on.sql +37 -0
- package/src/migrations/0117_sandbox_tiers.sql +11 -0
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { ScheduledTasksService, } from "../../schedules/scheduled-tasks.service.js";
|
|
13
|
+
import { createInputOf, grantsOf, ScheduleChatTargetsQuery, ScheduleCreateBody, ScheduleGrantableQuery, ScheduleGrantParams, ScheduleGrantsBody, ScheduleListQuery, ScheduleParams, ScheduleRunBody, ScheduleRunsQuery, ScheduleUpdateBody, updateInputOf, } from "../../schedules/schedules.schemas.js";
|
|
14
|
+
import { defineOperation } from "../operation.js";
|
|
15
|
+
import { PlatformOperations } from "../registry.js";
|
|
16
|
+
import { named, orElse } from "./summary.js";
|
|
17
|
+
const ListQuery = ScheduleListQuery;
|
|
18
|
+
const CreateBody = ScheduleCreateBody;
|
|
19
|
+
const UpdateBody = ScheduleUpdateBody;
|
|
20
|
+
const RunBody = ScheduleRunBody;
|
|
21
|
+
const RunsQuery = ScheduleRunsQuery;
|
|
22
|
+
const GrantsBody = ScheduleGrantsBody;
|
|
23
|
+
const Id = ScheduleParams.shape.id;
|
|
24
|
+
const ToolKey = ScheduleGrantParams.shape.toolKey;
|
|
25
|
+
const TaskId = z.object({ scheduleId: Id }).strict();
|
|
26
|
+
const EXAMPLE_ID = "7b2d4f60-3a1e-4c85-9e07-5d8f1a2b3c4d";
|
|
27
|
+
/** A task as `schedules.list` shows it: the schedule, the state and the next run. */
|
|
28
|
+
function row(t) {
|
|
29
|
+
return {
|
|
30
|
+
...(t.lastRun !== undefined && { lastRun: t.lastRun }),
|
|
31
|
+
id: t.id,
|
|
32
|
+
name: t.name,
|
|
33
|
+
agentId: t.agentId,
|
|
34
|
+
status: t.status,
|
|
35
|
+
pauseReason: t.pauseReason,
|
|
36
|
+
trigger: t.trigger,
|
|
37
|
+
mode: t.mode,
|
|
38
|
+
nextRunAt: t.nextRunAt,
|
|
39
|
+
creator: t.accountId,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const runRow = (r) => ({
|
|
43
|
+
id: r.id,
|
|
44
|
+
scheduledFor: r.scheduledFor,
|
|
45
|
+
firedAt: r.firedAt,
|
|
46
|
+
trial: r.trial,
|
|
47
|
+
status: r.status,
|
|
48
|
+
skipReason: r.skipReason,
|
|
49
|
+
error: r.error,
|
|
50
|
+
conversationId: r.conversationId,
|
|
51
|
+
missingGrants: r.missingGrants,
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Scheduled-task operations of the `Platform` tool (scheduled tasks spec §10): the same service
|
|
55
|
+
* as the HTTP routes. Writes are `personal`. Creating or changing a task and its approved tools
|
|
56
|
+
* are never remembered (`rememberable: false`): an approval, remembered or granted to a task,
|
|
57
|
+
* must never let an unattended run create or widen a task. Delete, run and resume are never
|
|
58
|
+
* remembered either. List, pause and delete are `org.read` like their routes: a creator demoted
|
|
59
|
+
* to guest can still see and stop their own tasks (the service decides by ownership).
|
|
60
|
+
*/
|
|
61
|
+
let SchedulesOperations = class SchedulesOperations {
|
|
62
|
+
registry;
|
|
63
|
+
tasks;
|
|
64
|
+
constructor(registry, tasks) {
|
|
65
|
+
this.registry = registry;
|
|
66
|
+
this.tasks = tasks;
|
|
67
|
+
}
|
|
68
|
+
/** The caller as the service expects (it reads the live role itself). */
|
|
69
|
+
actor(ctx) {
|
|
70
|
+
return { accountId: ctx.actorAccountId };
|
|
71
|
+
}
|
|
72
|
+
/** The task's name for a card; its id when it cannot be read. */
|
|
73
|
+
label(ctx, id) {
|
|
74
|
+
return orElse(async () => named((await this.tasks.get(ctx.orgId, this.actor(ctx), id)).name), id);
|
|
75
|
+
}
|
|
76
|
+
onModuleInit() {
|
|
77
|
+
this.registry.register([
|
|
78
|
+
defineOperation({
|
|
79
|
+
id: "schedules.list",
|
|
80
|
+
description: "List your scheduled tasks: one compact row each (name, agent, status and why it is paused, schedule with its time zone, where runs post, next run, last settled run). all=true lists every task of the org and needs the org admin role; conversationId keeps the tasks that post into that conversation.",
|
|
81
|
+
input: ListQuery,
|
|
82
|
+
example: {},
|
|
83
|
+
// a creator demoted to guest still lists their own tasks (to pause or delete them)
|
|
84
|
+
authz: { orgAction: "org.read" },
|
|
85
|
+
mirrors: ["GET /api/v1/orgs/:orgId/schedules"],
|
|
86
|
+
confirm: "read",
|
|
87
|
+
errors: [
|
|
88
|
+
{
|
|
89
|
+
code: "forbidden",
|
|
90
|
+
next: "Listing every task needs the org admin role: call without all, or ask an org admin.",
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
run: async (input, ctx) => {
|
|
94
|
+
const items = await this.tasks.list(ctx.orgId, this.actor(ctx), {
|
|
95
|
+
all: input.all === "true",
|
|
96
|
+
...(input.conversationId !== undefined && { conversationId: input.conversationId }),
|
|
97
|
+
});
|
|
98
|
+
return { items: items.map(row) };
|
|
99
|
+
},
|
|
100
|
+
}),
|
|
101
|
+
defineOperation({
|
|
102
|
+
id: "schedules.chat-targets",
|
|
103
|
+
description: "The IM chats you can point a chat-mode scheduled task at: your direct chats with each active channel connection's bot (one you have messaged before), and the groups you have talked in when the channel has threads. Each gives { connectionId, chatId, chatType } for schedules.create, and the connection's agentId, which the task must use.",
|
|
104
|
+
input: ScheduleChatTargetsQuery,
|
|
105
|
+
example: {},
|
|
106
|
+
authz: { orgAction: "schedules.use" },
|
|
107
|
+
mirrors: ["GET /api/v1/orgs/:orgId/schedules/chat-targets"],
|
|
108
|
+
confirm: "read",
|
|
109
|
+
errors: [],
|
|
110
|
+
run: async (_input, ctx) => ({
|
|
111
|
+
items: await this.tasks.chatTargets(ctx.orgId, ctx.actorAccountId),
|
|
112
|
+
}),
|
|
113
|
+
}),
|
|
114
|
+
defineOperation({
|
|
115
|
+
id: "schedules.grantable-tools",
|
|
116
|
+
description: "An agent's tools as a scheduled task can approve them in advance: each { key, title, source, connectorId, grantable, reason }; reason says why not (forbidden by the org, not_grantable by design, needs_role, fixed_ask, not_available). Takes the agent id from the agents list.",
|
|
117
|
+
input: ScheduleGrantableQuery,
|
|
118
|
+
example: { agentId: "4e8a0c1d-6b2f-4a37-8d19-3c5e7f9a1b20" },
|
|
119
|
+
authz: { orgAction: "schedules.use" },
|
|
120
|
+
mirrors: ["GET /api/v1/orgs/:orgId/schedules/grantable-tools"],
|
|
121
|
+
confirm: "read",
|
|
122
|
+
errors: [
|
|
123
|
+
{
|
|
124
|
+
code: "agent.not_found",
|
|
125
|
+
next: "Check the agent id: it must be an agent you can use in this org.",
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
run: async (input, ctx) => ({
|
|
129
|
+
items: await this.tasks.grantableTools(ctx.orgId, ctx.actorAccountId, input.agentId),
|
|
130
|
+
}),
|
|
131
|
+
}),
|
|
132
|
+
defineOperation({
|
|
133
|
+
id: "schedules.get",
|
|
134
|
+
description: "Read one scheduled task in full: prompt, schedule, target, model, effort, device, status, next run, expiry. Takes the id from schedules.list.",
|
|
135
|
+
input: TaskId,
|
|
136
|
+
example: { scheduleId: EXAMPLE_ID },
|
|
137
|
+
authz: { orgAction: "schedules.use" },
|
|
138
|
+
mirrors: ["GET /api/v1/orgs/:orgId/schedules/:id"],
|
|
139
|
+
renames: { scheduleId: "id" },
|
|
140
|
+
confirm: "read",
|
|
141
|
+
errors: [
|
|
142
|
+
{
|
|
143
|
+
code: "schedule.not_found",
|
|
144
|
+
next: "Check the id with schedules.list: you only see your own tasks (org admins see all with all=true).",
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
run: async (input, ctx) => ({
|
|
148
|
+
task: await this.tasks.get(ctx.orgId, this.actor(ctx), input.scheduleId),
|
|
149
|
+
}),
|
|
150
|
+
}),
|
|
151
|
+
defineOperation({
|
|
152
|
+
id: "schedules.create",
|
|
153
|
+
description: "Create a scheduled task: an agent runs the prompt on a 5-field cron (or once at a local date-time) as you, unattended. The task's time zone is yours; timeZone is only the fallback when you have none set. mode: new (a conversation per run), conversation (post into one conversation) or chat (an IM chat). model ({ provider, model } like an agent definition's), effort and deviceId are for mode new only; a conversation or chat task runs with that conversation's model. Without expiresAt a cron task ends after the org's default expiry, when the org sets one. grants pre-approve tools the unattended run may use. The person confirms every creation; it is never remembered.",
|
|
154
|
+
input: CreateBody,
|
|
155
|
+
example: {
|
|
156
|
+
agentId: "4e8a0c1d-6b2f-4a37-8d19-3c5e7f9a1b20",
|
|
157
|
+
name: "Daily digest",
|
|
158
|
+
prompt: "Summarize yesterday's activity.",
|
|
159
|
+
trigger: { kind: "cron", expr: "0 9 * * *" },
|
|
160
|
+
mode: "new",
|
|
161
|
+
},
|
|
162
|
+
authz: { orgAction: "schedules.use" },
|
|
163
|
+
mirrors: ["POST /api/v1/orgs/:orgId/schedules"],
|
|
164
|
+
confirm: "personal",
|
|
165
|
+
// an unattended run must never create or widen a task through a remembered approval
|
|
166
|
+
rememberable: false,
|
|
167
|
+
errors: [
|
|
168
|
+
{
|
|
169
|
+
code: "schedule.disabled",
|
|
170
|
+
next: {
|
|
171
|
+
orgAdmin: "Turn scheduled tasks on in the org settings.",
|
|
172
|
+
member: "Scheduled tasks are off here; ask an org admin.",
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
code: "schedule.limit_reached",
|
|
177
|
+
next: "Delete a task you no longer need with schedules.delete, or pause and edit an existing one.",
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
code: "schedule.target_invalid",
|
|
181
|
+
next: "Fix the target named in the message (conversation, chat or device) and call again.",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
code: "schedule.grant_not_allowed",
|
|
185
|
+
next: "Drop that grant: the task will ask for it as a person when it runs attended, or ask an org admin.",
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
summary: (i) => ({
|
|
189
|
+
zh: `创建定时任务「${named(i.name)}」(${i.trigger.kind === "cron" ? `cron ${named(i.trigger.expr)}` : `一次性 ${named(i.trigger.at)}`}),之后无人值守地以你的身份运行`,
|
|
190
|
+
en: `Create scheduled task "${named(i.name)}" (${i.trigger.kind === "cron" ? `cron ${named(i.trigger.expr)}` : `once at ${named(i.trigger.at)}`}), then run unattended as you`,
|
|
191
|
+
}),
|
|
192
|
+
run: async (input, ctx) => {
|
|
193
|
+
const { input: create, browserTimeZone } = createInputOf(input);
|
|
194
|
+
return {
|
|
195
|
+
task: await this.tasks.create(ctx.orgId, ctx.actorAccountId, create, browserTimeZone),
|
|
196
|
+
};
|
|
197
|
+
},
|
|
198
|
+
}),
|
|
199
|
+
defineOperation({
|
|
200
|
+
id: "schedules.update",
|
|
201
|
+
description: "Change one of your own scheduled tasks (name, prompt, schedule, time zone, target, model, effort, device, expiry; null clears an optional field, and a null expiry on a cron task takes the org's default expiry when set). model, effort and deviceId are for mode new only; switching to another mode clears them. Only the creator can; an org admin can pause it instead. The person confirms every change; it is never remembered. Takes the id from schedules.list.",
|
|
202
|
+
input: UpdateBody.extend({ scheduleId: Id }).strict(),
|
|
203
|
+
example: { scheduleId: EXAMPLE_ID, prompt: "Summarize the last two days." },
|
|
204
|
+
authz: { orgAction: "schedules.use" },
|
|
205
|
+
mirrors: ["PATCH /api/v1/orgs/:orgId/schedules/:id"],
|
|
206
|
+
renames: { scheduleId: "id" },
|
|
207
|
+
confirm: "personal",
|
|
208
|
+
rememberable: false,
|
|
209
|
+
errors: [
|
|
210
|
+
{
|
|
211
|
+
code: "schedule.not_found",
|
|
212
|
+
next: "Check the id with schedules.list: you only see your own tasks (org admins see all with all=true).",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
code: "schedule.forbidden",
|
|
216
|
+
next: "Only the creator can change a task: ask them, or an org admin can pause it.",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
code: "schedule.target_invalid",
|
|
220
|
+
next: "Fix the target named in the message and call again.",
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
summary: async (i, ctx) => {
|
|
224
|
+
const n = await this.label(ctx, i.scheduleId);
|
|
225
|
+
return {
|
|
226
|
+
zh: `修改定时任务「${n}」`,
|
|
227
|
+
en: `Change scheduled task "${n}"`,
|
|
228
|
+
};
|
|
229
|
+
},
|
|
230
|
+
run: async (input, ctx) => {
|
|
231
|
+
const { scheduleId, ...patch } = input;
|
|
232
|
+
return {
|
|
233
|
+
task: await this.tasks.update(ctx.orgId, ctx.actorAccountId, scheduleId, updateInputOf(patch)),
|
|
234
|
+
};
|
|
235
|
+
},
|
|
236
|
+
}),
|
|
237
|
+
defineOperation({
|
|
238
|
+
id: "schedules.delete",
|
|
239
|
+
description: "Delete a scheduled task (yours; an org admin can delete any). The person confirms every delete; it is never remembered. Takes the id from schedules.list.",
|
|
240
|
+
input: TaskId,
|
|
241
|
+
example: { scheduleId: EXAMPLE_ID },
|
|
242
|
+
authz: { orgAction: "org.read" },
|
|
243
|
+
mirrors: ["DELETE /api/v1/orgs/:orgId/schedules/:id"],
|
|
244
|
+
renames: { scheduleId: "id" },
|
|
245
|
+
confirm: "personal",
|
|
246
|
+
rememberable: false,
|
|
247
|
+
errors: [
|
|
248
|
+
{
|
|
249
|
+
code: "schedule.not_found",
|
|
250
|
+
next: "Check the id with schedules.list: you only see your own tasks (org admins see all with all=true).",
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
summary: async (i, ctx) => {
|
|
254
|
+
const n = await this.label(ctx, i.scheduleId);
|
|
255
|
+
return { zh: `删除定时任务「${n}」`, en: `Delete scheduled task "${n}"` };
|
|
256
|
+
},
|
|
257
|
+
run: async (input, ctx) => {
|
|
258
|
+
await this.tasks.remove(ctx.orgId, this.actor(ctx), input.scheduleId);
|
|
259
|
+
return { id: input.scheduleId, deleted: true };
|
|
260
|
+
},
|
|
261
|
+
}),
|
|
262
|
+
defineOperation({
|
|
263
|
+
id: "schedules.pause",
|
|
264
|
+
description: "Pause a scheduled task so it stops firing (yours; an org admin can pause any, and the creator is told). Resume it with schedules.resume. Takes the id from schedules.list.",
|
|
265
|
+
input: TaskId,
|
|
266
|
+
example: { scheduleId: EXAMPLE_ID },
|
|
267
|
+
authz: { orgAction: "org.read" },
|
|
268
|
+
mirrors: ["POST /api/v1/orgs/:orgId/schedules/:id/pause"],
|
|
269
|
+
renames: { scheduleId: "id" },
|
|
270
|
+
confirm: "personal",
|
|
271
|
+
errors: [
|
|
272
|
+
{
|
|
273
|
+
code: "schedule.not_found",
|
|
274
|
+
next: "Check the id with schedules.list: you only see your own tasks (org admins see all with all=true).",
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
summary: async (i, ctx) => {
|
|
278
|
+
const n = await this.label(ctx, i.scheduleId);
|
|
279
|
+
return { zh: `暂停定时任务「${n}」`, en: `Pause scheduled task "${n}"` };
|
|
280
|
+
},
|
|
281
|
+
run: async (input, ctx) => ({
|
|
282
|
+
task: row(await this.tasks.pause(ctx.orgId, this.actor(ctx), input.scheduleId)),
|
|
283
|
+
}),
|
|
284
|
+
}),
|
|
285
|
+
defineOperation({
|
|
286
|
+
id: "schedules.resume",
|
|
287
|
+
description: "Resume a paused scheduled task: the next run is computed from now (missed ticks are not caught up). An ended task cannot be resumed. The person confirms every resume; it is never remembered. Takes the id from schedules.list.",
|
|
288
|
+
input: TaskId,
|
|
289
|
+
example: { scheduleId: EXAMPLE_ID },
|
|
290
|
+
authz: { orgAction: "schedules.use" },
|
|
291
|
+
mirrors: ["POST /api/v1/orgs/:orgId/schedules/:id/resume"],
|
|
292
|
+
renames: { scheduleId: "id" },
|
|
293
|
+
confirm: "personal",
|
|
294
|
+
// a remembered resume would let an unattended run restart a task a person stopped
|
|
295
|
+
rememberable: false,
|
|
296
|
+
errors: [
|
|
297
|
+
{
|
|
298
|
+
code: "schedule.not_found",
|
|
299
|
+
next: "Check the id with schedules.list: you only see your own tasks (org admins see all with all=true).",
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
code: "schedule.once_in_past",
|
|
303
|
+
next: "Its time has passed: set a new time with schedules.update, then resume.",
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
code: "schedule.disabled",
|
|
307
|
+
next: {
|
|
308
|
+
orgAdmin: "Turn scheduled tasks on in the org settings.",
|
|
309
|
+
member: "Scheduled tasks are off here; ask an org admin.",
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
summary: async (i, ctx) => {
|
|
314
|
+
const n = await this.label(ctx, i.scheduleId);
|
|
315
|
+
return { zh: `恢复定时任务「${n}」`, en: `Resume scheduled task "${n}"` };
|
|
316
|
+
},
|
|
317
|
+
run: async (input, ctx) => ({
|
|
318
|
+
task: row(await this.tasks.resume(ctx.orgId, this.actor(ctx), input.scheduleId)),
|
|
319
|
+
}),
|
|
320
|
+
}),
|
|
321
|
+
defineOperation({
|
|
322
|
+
id: "schedules.run",
|
|
323
|
+
description: "Run one of your own scheduled tasks now, outside its schedule (the schedule does not move). trial=true is an attended trial: you approve its tool calls and they become the task's approved tools. Counts toward the hourly run limit. The person confirms every run; it is never remembered. Takes the id from schedules.list.",
|
|
324
|
+
input: RunBody.extend({ scheduleId: Id }).strict(),
|
|
325
|
+
example: { scheduleId: EXAMPLE_ID, trial: true },
|
|
326
|
+
authz: { orgAction: "schedules.use" },
|
|
327
|
+
mirrors: ["POST /api/v1/orgs/:orgId/schedules/:id/run"],
|
|
328
|
+
renames: { scheduleId: "id" },
|
|
329
|
+
confirm: "personal",
|
|
330
|
+
// a remembered run would let an unattended run trigger other tasks
|
|
331
|
+
rememberable: false,
|
|
332
|
+
errors: [
|
|
333
|
+
{
|
|
334
|
+
code: "schedule.not_found",
|
|
335
|
+
next: "Check the id with schedules.list: you only see your own tasks (org admins see all with all=true).",
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
code: "schedule.forbidden",
|
|
339
|
+
next: "Only the creator can change a task: ask them, or an org admin can pause it.",
|
|
340
|
+
},
|
|
341
|
+
{ code: "conflict", next: "The task has ended or is being run: wait, or edit it first." },
|
|
342
|
+
],
|
|
343
|
+
summary: async (i, ctx) => {
|
|
344
|
+
const n = await this.label(ctx, i.scheduleId);
|
|
345
|
+
return {
|
|
346
|
+
zh: `立即运行定时任务「${n}」${i.trial === true ? "(试运行)" : ""}`,
|
|
347
|
+
en: `Run scheduled task "${n}" now${i.trial === true ? " as a trial" : ""}`,
|
|
348
|
+
};
|
|
349
|
+
},
|
|
350
|
+
run: async (input, ctx) => ({
|
|
351
|
+
run: runRow(await this.tasks.runNow(ctx.orgId, ctx.actorAccountId, input.scheduleId, {
|
|
352
|
+
trial: input.trial === true,
|
|
353
|
+
})),
|
|
354
|
+
}),
|
|
355
|
+
}),
|
|
356
|
+
defineOperation({
|
|
357
|
+
id: "schedules.runs",
|
|
358
|
+
description: "A task's run history, latest first (default 50, at most 200): each tick with its status, skip reason, error, conversation and the tools refused for lack of an approval. Takes the id from schedules.list.",
|
|
359
|
+
input: RunsQuery.extend({ scheduleId: Id }).strict(),
|
|
360
|
+
example: { scheduleId: EXAMPLE_ID },
|
|
361
|
+
authz: { orgAction: "schedules.use" },
|
|
362
|
+
mirrors: ["GET /api/v1/orgs/:orgId/schedules/:id/runs"],
|
|
363
|
+
renames: { scheduleId: "id" },
|
|
364
|
+
confirm: "read",
|
|
365
|
+
errors: [
|
|
366
|
+
{
|
|
367
|
+
code: "schedule.not_found",
|
|
368
|
+
next: "Check the id with schedules.list: you only see your own tasks (org admins see all with all=true).",
|
|
369
|
+
},
|
|
370
|
+
],
|
|
371
|
+
run: async (input, ctx) => ({
|
|
372
|
+
items: (await this.tasks.runs(ctx.orgId, this.actor(ctx), input.scheduleId, input.limit)).map(runRow),
|
|
373
|
+
}),
|
|
374
|
+
}),
|
|
375
|
+
defineOperation({
|
|
376
|
+
id: "schedules.grants-list",
|
|
377
|
+
description: "The tools approved in advance for a scheduled task (what an unattended run may call without asking), each as { toolKey, connectorId, stale }; a stale approval no longer applies because the tool changed. Takes the id from schedules.list.",
|
|
378
|
+
input: TaskId,
|
|
379
|
+
example: { scheduleId: EXAMPLE_ID },
|
|
380
|
+
authz: { orgAction: "schedules.use" },
|
|
381
|
+
mirrors: ["GET /api/v1/orgs/:orgId/schedules/:id/grants"],
|
|
382
|
+
renames: { scheduleId: "id" },
|
|
383
|
+
confirm: "read",
|
|
384
|
+
errors: [
|
|
385
|
+
{
|
|
386
|
+
code: "schedule.not_found",
|
|
387
|
+
next: "Check the id with schedules.list: you only see your own tasks (org admins see all with all=true).",
|
|
388
|
+
},
|
|
389
|
+
],
|
|
390
|
+
run: async (input, ctx) => ({
|
|
391
|
+
items: (await this.tasks.grants(ctx.orgId, this.actor(ctx), input.scheduleId)).map((g) => ({ toolKey: g.toolKey, connectorId: g.connectorId, stale: g.stale })),
|
|
392
|
+
}),
|
|
393
|
+
}),
|
|
394
|
+
defineOperation({
|
|
395
|
+
id: "schedules.grants-add",
|
|
396
|
+
description: "Approve tools in advance for one of your own scheduled tasks: an unattended run may then call them without asking. Only tools you could approve with always-allow yourself; never a Platform operation (each is decided per call) and nothing the org forbids. Returns the task's approved tools as { toolKey, connectorId }. The person confirms every change; it is never remembered. Takes the id from schedules.list.",
|
|
397
|
+
input: GrantsBody.extend({ scheduleId: Id }).strict(),
|
|
398
|
+
example: { scheduleId: EXAMPLE_ID, grants: [{ toolKey: "WebFetch" }] },
|
|
399
|
+
authz: { orgAction: "schedules.use" },
|
|
400
|
+
mirrors: ["POST /api/v1/orgs/:orgId/schedules/:id/grants"],
|
|
401
|
+
renames: { scheduleId: "id" },
|
|
402
|
+
confirm: "personal",
|
|
403
|
+
rememberable: false,
|
|
404
|
+
errors: [
|
|
405
|
+
{
|
|
406
|
+
code: "schedule.not_found",
|
|
407
|
+
next: "Check the id with schedules.list: you only see your own tasks (org admins see all with all=true).",
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
code: "schedule.forbidden",
|
|
411
|
+
next: "Only the creator can change a task: ask them, or an org admin can pause it.",
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
code: "schedule.grant_not_allowed",
|
|
415
|
+
next: "Drop that tool: it cannot be approved in advance for a task.",
|
|
416
|
+
},
|
|
417
|
+
],
|
|
418
|
+
summary: async (i, ctx) => {
|
|
419
|
+
const n = await this.label(ctx, i.scheduleId);
|
|
420
|
+
const keys = i.grants.map((g) => named(g.toolKey)).join(", ");
|
|
421
|
+
return {
|
|
422
|
+
zh: `为定时任务「${n}」预先批准工具:${keys}`,
|
|
423
|
+
en: `Approve tools in advance for scheduled task "${n}": ${keys}`,
|
|
424
|
+
};
|
|
425
|
+
},
|
|
426
|
+
run: async (input, ctx) => ({
|
|
427
|
+
items: (await this.tasks.addGrants(ctx.orgId, ctx.actorAccountId, input.scheduleId, grantsOf(input.grants))).map((g) => ({ toolKey: g.toolKey, connectorId: g.connectorId })),
|
|
428
|
+
}),
|
|
429
|
+
}),
|
|
430
|
+
defineOperation({
|
|
431
|
+
id: "schedules.grants-remove",
|
|
432
|
+
description: "Remove a tool's advance approval from one of your own scheduled tasks (nothing happens if it had none): the unattended run is then refused that tool. Takes the id from schedules.list.",
|
|
433
|
+
input: z.object({ scheduleId: Id, toolKey: ToolKey }).strict(),
|
|
434
|
+
example: { scheduleId: EXAMPLE_ID, toolKey: "WebFetch" },
|
|
435
|
+
authz: { orgAction: "schedules.use" },
|
|
436
|
+
mirrors: ["DELETE /api/v1/orgs/:orgId/schedules/:id/grants/:toolKey"],
|
|
437
|
+
renames: { scheduleId: "id" },
|
|
438
|
+
confirm: "personal",
|
|
439
|
+
rememberable: false,
|
|
440
|
+
errors: [
|
|
441
|
+
{
|
|
442
|
+
code: "schedule.not_found",
|
|
443
|
+
next: "Check the id with schedules.list: you only see your own tasks (org admins see all with all=true).",
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
code: "schedule.forbidden",
|
|
447
|
+
next: "Only the creator can change a task: ask them, or an org admin can pause it.",
|
|
448
|
+
},
|
|
449
|
+
],
|
|
450
|
+
summary: async (i, ctx) => {
|
|
451
|
+
const n = await this.label(ctx, i.scheduleId);
|
|
452
|
+
return {
|
|
453
|
+
zh: `撤销定时任务「${n}」对工具 ${named(i.toolKey)} 的预先批准`,
|
|
454
|
+
en: `Remove the advance approval of ${named(i.toolKey)} from scheduled task "${n}"`,
|
|
455
|
+
};
|
|
456
|
+
},
|
|
457
|
+
run: async (input, ctx) => {
|
|
458
|
+
await this.tasks.removeGrant(ctx.orgId, ctx.actorAccountId, input.scheduleId, input.toolKey);
|
|
459
|
+
return { id: input.scheduleId, toolKey: input.toolKey, removed: true };
|
|
460
|
+
},
|
|
461
|
+
}),
|
|
462
|
+
]);
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
SchedulesOperations = __decorate([
|
|
466
|
+
Injectable(),
|
|
467
|
+
__param(0, Inject(PlatformOperations)),
|
|
468
|
+
__param(1, Inject(ScheduledTasksService))
|
|
469
|
+
], SchedulesOperations);
|
|
470
|
+
export { SchedulesOperations };
|
|
@@ -34,13 +34,13 @@ let SkillsOperations = class SkillsOperations {
|
|
|
34
34
|
}
|
|
35
35
|
/** The skill's name for a card summary; its id when it cannot be read. */
|
|
36
36
|
skillName(orgId, skillId) {
|
|
37
|
-
return orElse(async () => named((await this.skills.
|
|
37
|
+
return orElse(async () => named((await this.skills.detail(orgId, skillId)).name), skillId);
|
|
38
38
|
}
|
|
39
39
|
onModuleInit() {
|
|
40
40
|
this.registry.register([
|
|
41
41
|
defineOperation({
|
|
42
42
|
id: "skills.list",
|
|
43
|
-
description: "List the skills the org can use, org skills and platform skills switched on in it. Each entry has an id, name, description, current version and where it came from.",
|
|
43
|
+
description: "List the skills the org can use, org skills and platform skills switched on in it. Each entry has an id, name, description, current version and where it came from (its plugin); builtin: true marks a skill of a builtin plugin, which every agent has and none can turn off. Every agent has every skill listed here unless its disabledSkills turns it off.",
|
|
44
44
|
input: NoInput,
|
|
45
45
|
example: {},
|
|
46
46
|
authz: { orgAction: "skills.read" },
|
|
@@ -50,7 +50,7 @@ let SkillsOperations = class SkillsOperations {
|
|
|
50
50
|
}),
|
|
51
51
|
defineOperation({
|
|
52
52
|
id: "skills.get",
|
|
53
|
-
description: "Read one skill: its description, versions, file list
|
|
53
|
+
description: "Read one skill: its description, versions, file list, the current SKILL.md body and agentsOff (how many of the org's agents turn it off). Takes the skill id from skills.list.",
|
|
54
54
|
input: SkillId,
|
|
55
55
|
example: { skillId: "0b9f2c4e-1d3a-4c55-9e0a-7a2f6d1c8b11" },
|
|
56
56
|
authz: { orgAction: "skills.read" },
|
|
@@ -25,6 +25,7 @@ import { PlatformOperationsProvider } from "./ops/platform.ops.js";
|
|
|
25
25
|
import { PluginsOperations } from "./ops/plugins.ops.js";
|
|
26
26
|
import { PreviewersOperations } from "./ops/previewers.ops.js";
|
|
27
27
|
import { RequestsOperations } from "./ops/requests.ops.js";
|
|
28
|
+
import { SchedulesOperations } from "./ops/schedules.ops.js";
|
|
28
29
|
import { SetupOperations } from "./ops/setup.ops.js";
|
|
29
30
|
import { SkillsOperations } from "./ops/skills.ops.js";
|
|
30
31
|
import { ThemesOperations } from "./ops/themes.ops.js";
|
|
@@ -33,7 +34,7 @@ import { UiOperations } from "./ops/ui.ops.js";
|
|
|
33
34
|
* One provider per domain, each taking `PlatformOperations` as its first constructor argument:
|
|
34
35
|
* the parity test in `tools/checks` builds the operations from it without a Nest app.
|
|
35
36
|
*/
|
|
36
|
-
export declare const PLATFORM_OPERATION_PROVIDERS: readonly [typeof PlatformOperationsProvider, typeof SkillsOperations, typeof AgentsOperations, typeof AgentTemplatesOperations, typeof PluginsOperations, typeof MarketplacesOperations, typeof RequestsOperations, typeof ConnectorsOperations, typeof ExtensionsOperations, typeof ConversationsOperations, typeof ComponentsOperations, typeof AccountsOperations, typeof OrgsOperations, typeof AdminOperations, typeof CatalogAdminOperations, typeof OrgPluginsOperations, typeof ExtensionsAdminOperations, typeof ModelsOperations, typeof InboxOperations, typeof ApprovalsOperations, typeof ChannelsOperations, typeof OrgSettingsOperations, typeof EvalsOperations, typeof BackgroundOperations, typeof PreviewersOperations, typeof DevicesOperations, typeof AgentSkillsOperations, typeof ThemesOperations, typeof SetupOperations, typeof UiOperations, typeof AdminItemsOperations];
|
|
37
|
+
export declare const PLATFORM_OPERATION_PROVIDERS: readonly [typeof PlatformOperationsProvider, typeof SkillsOperations, typeof AgentsOperations, typeof AgentTemplatesOperations, typeof PluginsOperations, typeof MarketplacesOperations, typeof RequestsOperations, typeof ConnectorsOperations, typeof ExtensionsOperations, typeof ConversationsOperations, typeof ComponentsOperations, typeof AccountsOperations, typeof OrgsOperations, typeof AdminOperations, typeof CatalogAdminOperations, typeof OrgPluginsOperations, typeof ExtensionsAdminOperations, typeof ModelsOperations, typeof InboxOperations, typeof ApprovalsOperations, typeof ChannelsOperations, typeof OrgSettingsOperations, typeof EvalsOperations, typeof BackgroundOperations, typeof PreviewersOperations, typeof DevicesOperations, typeof AgentSkillsOperations, typeof ThemesOperations, typeof SetupOperations, typeof UiOperations, typeof AdminItemsOperations, typeof SchedulesOperations];
|
|
37
38
|
/**
|
|
38
39
|
* The `Platform` tool's operations (ruling P2): one provider per domain, each registering its
|
|
39
40
|
* operations into `PlatformOperations` from `onModuleInit`. It imports the domain modules, which
|
|
@@ -21,6 +21,7 @@ import { InboxModule } from "../inbox/inbox.module.js";
|
|
|
21
21
|
import { ModelsModule } from "../models/models.module.js";
|
|
22
22
|
import { OrgsModule } from "../orgs/orgs.module.js";
|
|
23
23
|
import { ProvidersModule } from "../runtime/providers.js";
|
|
24
|
+
import { SchedulesModule } from "../schedules/schedules.module.js";
|
|
24
25
|
import { SetupModule } from "../setup/setup.module.js";
|
|
25
26
|
import { SkillsModule } from "../skills/skills.module.js";
|
|
26
27
|
import { ThemesModule } from "../themes/themes.module.js";
|
|
@@ -52,6 +53,7 @@ import { PlatformOperationsProvider } from "./ops/platform.ops.js";
|
|
|
52
53
|
import { PluginsOperations } from "./ops/plugins.ops.js";
|
|
53
54
|
import { PreviewersOperations } from "./ops/previewers.ops.js";
|
|
54
55
|
import { RequestsOperations } from "./ops/requests.ops.js";
|
|
56
|
+
import { SchedulesOperations } from "./ops/schedules.ops.js";
|
|
55
57
|
import { SetupOperations } from "./ops/setup.ops.js";
|
|
56
58
|
import { SkillsOperations } from "./ops/skills.ops.js";
|
|
57
59
|
import { ThemesOperations } from "./ops/themes.ops.js";
|
|
@@ -103,6 +105,8 @@ export const PLATFORM_OPERATION_PROVIDERS = [
|
|
|
103
105
|
UiOperations,
|
|
104
106
|
// every org's agents and connectors, the conversation org's through the tool (spec §4.5)
|
|
105
107
|
AdminItemsOperations,
|
|
108
|
+
// scheduled tasks (scheduled tasks spec §10)
|
|
109
|
+
SchedulesOperations,
|
|
106
110
|
];
|
|
107
111
|
/**
|
|
108
112
|
* The `Platform` tool's operations (ruling P2): one provider per domain, each registering its
|
|
@@ -135,6 +139,7 @@ PlatformOpsModule = __decorate([
|
|
|
135
139
|
FilesModule,
|
|
136
140
|
ThemesModule,
|
|
137
141
|
SetupModule,
|
|
142
|
+
SchedulesModule,
|
|
138
143
|
],
|
|
139
144
|
providers: [...PLATFORM_OPERATION_PROVIDERS],
|
|
140
145
|
})
|
|
@@ -23,6 +23,7 @@ import { ME_ROUTES } from "../identity/me.schemas.js";
|
|
|
23
23
|
import { INBOX_ROUTES } from "../inbox/inbox.schemas.js";
|
|
24
24
|
import { ORG_MODEL_ROUTES } from "../models/org-models.schemas.js";
|
|
25
25
|
import { ORG_ROUTES, ORG_SETTINGS_ROUTES } from "../orgs/orgs.schemas.js";
|
|
26
|
+
import { SCHEDULE_ROUTES } from "../schedules/schedules.schemas.js";
|
|
26
27
|
import { SETUP_CHECK_ROUTES } from "../setup/setup-checks.schemas.js";
|
|
27
28
|
import { SETUP_GUIDE_ROUTES } from "../setup/setup-guides.schemas.js";
|
|
28
29
|
import { SKILL_ROUTES } from "../skills/skills.schemas.js";
|
|
@@ -79,6 +80,8 @@ export const ROUTE_SCHEMAS = [
|
|
|
79
80
|
...UI_ROUTES,
|
|
80
81
|
// every org's agents and connectors (admin agents and connectors spec §4)
|
|
81
82
|
...ADMIN_ITEM_ROUTES,
|
|
83
|
+
// scheduled tasks (scheduled tasks spec §10)
|
|
84
|
+
...SCHEDULE_ROUTES,
|
|
82
85
|
// the admin overview and the platform-level audit log (admin overview spec §5.2)
|
|
83
86
|
...OVERVIEW_ROUTES,
|
|
84
87
|
...AUDIT_ROUTES,
|
|
@@ -37,6 +37,7 @@ import { UsageReportModule, UsageSweepJob } from "../runtime/usage-report.js";
|
|
|
37
37
|
import { WaitSweepJob } from "../runtime/waits.js";
|
|
38
38
|
import { SandboxSweepJobs } from "../sandbox/jobs.js";
|
|
39
39
|
import { SandboxModule } from "../sandbox/sandbox.module.js";
|
|
40
|
+
import { ScheduledTaskFireModule } from "../schedules/fire.js";
|
|
40
41
|
import { StoragePurgeJob } from "../storage/purge.js";
|
|
41
42
|
import { StorageModule } from "../storage/storage.module.js";
|
|
42
43
|
import { ToolJobs } from "../tools/jobs.js";
|
|
@@ -79,6 +80,8 @@ let WorkerModule = WorkerModule_1 = class WorkerModule {
|
|
|
79
80
|
OrgLockModule,
|
|
80
81
|
ExtensionsModule,
|
|
81
82
|
ChannelsModule,
|
|
83
|
+
// the scheduled task scanner (`@LockedCron`) and the fire job's body
|
|
84
|
+
ScheduledTaskFireModule,
|
|
82
85
|
],
|
|
83
86
|
providers: [
|
|
84
87
|
WaitSweepJob,
|
|
@@ -6,7 +6,7 @@ import { catalogText, isAlwaysLoaded } from "../../tools/builtins/tool-search.js
|
|
|
6
6
|
import { renderSubagentDelivery } from "../subagents/render.js";
|
|
7
7
|
import { devicePathsAt, devicePathsText } from "./device-paths.js";
|
|
8
8
|
import { LEGACY_CATALOG_HEADER, LEGACY_SKILL_TEXTS, usesLegacyToolNames } from "./legacy-text.js";
|
|
9
|
-
import { currentRunContext, runContextEvents, runContextFullText, runContextText, senderLines, } from "./run-context.js";
|
|
9
|
+
import { currentRunContext, runContextEvents, runContextFullText, runContextText, scheduleHeader, senderLines, } from "./run-context.js";
|
|
10
10
|
import { invokedSkillNames, invokedSkillsText, SKILL_TEXTS, skillsCatalogEvents, snapshotChangeText, snapshotCurrentText, snapshotSystemText, systemSkillsCatalog, } from "./skills.js";
|
|
11
11
|
import { toolsChangedText } from "./tool-changes.js";
|
|
12
12
|
/**
|
|
@@ -473,14 +473,19 @@ export function buildModelRequest(input) {
|
|
|
473
473
|
const senders = senderLines(events, after);
|
|
474
474
|
/**
|
|
475
475
|
* A user message's blocks: its sender line first when the sender changed (a separate block, so
|
|
476
|
-
* `content[0]` stays the typed text), then
|
|
476
|
+
* `content[0]` stays the typed text), then a scheduled task's header (scheduled tasks spec §12,
|
|
477
|
+
* from the marker in the log), then its own blocks, then its fork report when it has one.
|
|
477
478
|
*/
|
|
478
479
|
const userBlocks = (u) => {
|
|
479
480
|
const report = forkReports.get(u.seq);
|
|
480
481
|
const line = senders.get(u.seq);
|
|
482
|
+
const schedule = u.payload.schedule;
|
|
481
483
|
const blocks = blocksOf(u.payload.content);
|
|
482
484
|
return [
|
|
483
485
|
...(line === undefined ? [] : [{ type: "text", text: line }]),
|
|
486
|
+
...(schedule === undefined
|
|
487
|
+
? []
|
|
488
|
+
: [{ type: "text", text: scheduleHeader(schedule) }]),
|
|
484
489
|
...blocks,
|
|
485
490
|
...(report === undefined ? [] : [{ type: "text", text: report }]),
|
|
486
491
|
];
|
|
@@ -554,7 +559,7 @@ export function buildModelRequest(input) {
|
|
|
554
559
|
// summary again (the model keeps using the real paths)
|
|
555
560
|
const paths = devicePathsAt(events, after);
|
|
556
561
|
if (paths) {
|
|
557
|
-
messages.push({ role: "system", content: devicePathsText(paths.payload
|
|
562
|
+
messages.push({ role: "system", content: devicePathsText(paths.payload) });
|
|
558
563
|
}
|
|
559
564
|
// 被摘要覆盖的变更提醒不再发送:摘要时生效的目录与 system 里的不同 → 紧随摘要补上完整的当前目录
|
|
560
565
|
const covered = skillSnaps.filter((e) => e.seq <= after).at(-1);
|
|
@@ -632,12 +637,16 @@ export function buildModelRequest(input) {
|
|
|
632
637
|
// the instance's directories (environments spec §13.1): logged during a step's tool call,
|
|
633
638
|
// so rendered after that step's tool results
|
|
634
639
|
case "device_paths":
|
|
635
|
-
messages.push({ role: "system", content: devicePathsText(e.payload
|
|
640
|
+
messages.push({ role: "system", content: devicePathsText(e.payload) });
|
|
636
641
|
break;
|
|
637
642
|
// hook_denied is not model-visible: the model sees only the denied tool call's tool_result
|
|
638
643
|
// (and nothing for a denied model request), so request building skips it
|
|
639
644
|
case "hook_denied":
|
|
640
645
|
break;
|
|
646
|
+
// network_blocked is display-only (network ask-to-allow spec §6.6): the model sees the
|
|
647
|
+
// refusal in the command's tool_result (the device's trailer and the kernel's note)
|
|
648
|
+
case "network_blocked":
|
|
649
|
+
break;
|
|
641
650
|
// model_switched is not model-visible either: its effect (model and params) is recorded in
|
|
642
651
|
// each request's model_call (UI refresh B)
|
|
643
652
|
case "model_switched":
|