@cubos/agent-sdk 0.0.1136563

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.
@@ -0,0 +1,142 @@
1
+ import type { Transport } from "../http.js";
2
+ import type { Schemas } from "../schemas.js";
3
+ /**
4
+ * A knowledge base is uploaded documents plus a cited wiki curated from them.
5
+ * It attaches to a conversation or to a user (the OR of both links) — unlike
6
+ * MCPs and skills, there is no agent-level link.
7
+ */
8
+ export declare function knowledgeBasesApi(t: Transport, tenantSlug: string): {
9
+ list: (signal?: AbortSignal) => Promise<{
10
+ created_at: string;
11
+ display_name: string;
12
+ id: string;
13
+ pending_count: number;
14
+ slug: string;
15
+ updated_at: string;
16
+ }[]>;
17
+ get: (slug: string, signal?: AbortSignal) => Promise<{
18
+ accepts_conversation_sources: boolean;
19
+ created_at: string;
20
+ curate_requested: boolean;
21
+ display_name: string;
22
+ id: string;
23
+ last_run: null | import("../generated/schema.js").components["schemas"]["CurationRun"];
24
+ nap_agent_slug: string | null;
25
+ nap_last_run_at: string | null;
26
+ oldest_pending_at: string | null;
27
+ pending_count: number;
28
+ routing_prompt: string;
29
+ slug: string;
30
+ updated_at: string;
31
+ }>;
32
+ create: (input: Schemas["CreateKnowledgeBaseInput"]) => Promise<{
33
+ accepts_conversation_sources: boolean;
34
+ created_at: string;
35
+ curate_requested: boolean;
36
+ display_name: string;
37
+ id: string;
38
+ last_run: null | import("../generated/schema.js").components["schemas"]["CurationRun"];
39
+ nap_agent_slug: string | null;
40
+ nap_last_run_at: string | null;
41
+ oldest_pending_at: string | null;
42
+ pending_count: number;
43
+ routing_prompt: string;
44
+ slug: string;
45
+ updated_at: string;
46
+ }>;
47
+ update: (currentSlug: string, input: Schemas["UpdateKnowledgeBaseInput"]) => Promise<{
48
+ accepts_conversation_sources: boolean;
49
+ created_at: string;
50
+ curate_requested: boolean;
51
+ display_name: string;
52
+ id: string;
53
+ last_run: null | import("../generated/schema.js").components["schemas"]["CurationRun"];
54
+ nap_agent_slug: string | null;
55
+ nap_last_run_at: string | null;
56
+ oldest_pending_at: string | null;
57
+ pending_count: number;
58
+ routing_prompt: string;
59
+ slug: string;
60
+ updated_at: string;
61
+ }>;
62
+ delete: (slug: string) => Promise<void>;
63
+ /** Wakes the "nap" agent that turns sources into wiki pages. */
64
+ requestCuration: (slug: string) => Promise<void>;
65
+ listSources: (slug: string, signal?: AbortSignal) => Promise<{
66
+ byte_size: number;
67
+ id: string;
68
+ integrated_at: string | null;
69
+ knowledge_base_id: string;
70
+ mime: string;
71
+ nap_attempts: number;
72
+ origin: string;
73
+ recorded_at: string;
74
+ retracted_at: string | null;
75
+ status: string;
76
+ title: string | null;
77
+ }[]>;
78
+ createTextSource: (slug: string, input: Schemas["CreateTextSourceInput"]) => Promise<{
79
+ byte_size: number;
80
+ id: string;
81
+ integrated_at: string | null;
82
+ knowledge_base_id: string;
83
+ mime: string;
84
+ nap_attempts: number;
85
+ origin: string;
86
+ recorded_at: string;
87
+ retracted_at: string | null;
88
+ status: string;
89
+ title: string | null;
90
+ }>;
91
+ /** Multipart upload of a file's original bytes — the only copy kept. */
92
+ uploadSource: (slug: string, file: File | Blob, title?: string) => Promise<{
93
+ byte_size: number;
94
+ id: string;
95
+ integrated_at: string | null;
96
+ knowledge_base_id: string;
97
+ mime: string;
98
+ nap_attempts: number;
99
+ origin: string;
100
+ recorded_at: string;
101
+ retracted_at: string | null;
102
+ status: string;
103
+ title: string | null;
104
+ }>;
105
+ retractSource: (slug: string, sourceId: string) => Promise<void>;
106
+ /** The raw `Response`, so callers decide how to save the bytes — the
107
+ * browser's download dance needs the DOM and doesn't belong here. */
108
+ downloadSource: (slug: string, sourceId: string) => Promise<Response>;
109
+ listPages: (slug: string, signal?: AbortSignal) => Promise<{
110
+ revision: number;
111
+ slug: string;
112
+ title: string;
113
+ updated_at: string;
114
+ updated_by: string;
115
+ }[]>;
116
+ getPage: (slug: string, pageSlug: string, signal?: AbortSignal) => Promise<{
117
+ body_md: string;
118
+ citations: import("../generated/schema.js").components["schemas"]["PageCitation"][];
119
+ content_md: string;
120
+ created_at: string;
121
+ links: string[];
122
+ locked_by_run: boolean;
123
+ revision: number;
124
+ slug: string;
125
+ title: string;
126
+ updated_at: string;
127
+ updated_by: string;
128
+ }>;
129
+ updatePage: (slug: string, pageSlug: string, input: Schemas["UpdatePageInput"]) => Promise<{
130
+ body_md: string;
131
+ citations: import("../generated/schema.js").components["schemas"]["PageCitation"][];
132
+ content_md: string;
133
+ created_at: string;
134
+ links: string[];
135
+ locked_by_run: boolean;
136
+ revision: number;
137
+ slug: string;
138
+ title: string;
139
+ updated_at: string;
140
+ updated_by: string;
141
+ }>;
142
+ };
@@ -0,0 +1,134 @@
1
+ import type { Transport } from "../http.js";
2
+ import type { Schemas } from "../schemas.js";
3
+ /**
4
+ * MCP servers: the executable-tool half of the tool surface. Skills (markdown
5
+ * for prompt-shaping) are the other half and live in their own module — the two
6
+ * are complementary, not alternatives, and pairing both for one capability is
7
+ * normal.
8
+ */
9
+ export declare function mcpsApi(t: Transport, tenantSlug: string): {
10
+ list: (signal?: AbortSignal) => Promise<{
11
+ created_at: string;
12
+ display_name: string;
13
+ id: string;
14
+ last_error: string | null;
15
+ last_refreshed_at: string | null;
16
+ slug: string;
17
+ tool_count: number;
18
+ transport: import("../generated/schema.js").components["schemas"]["McpTransport"];
19
+ updated_at: string;
20
+ url: string;
21
+ }[]>;
22
+ get: (slug: string, signal?: AbortSignal) => Promise<{
23
+ created_at: string;
24
+ display_name: string;
25
+ dynamic_tools: boolean;
26
+ has_headers: boolean;
27
+ header_names: string[] | null;
28
+ id: string;
29
+ last_error: string | null;
30
+ last_refreshed_at: string | null;
31
+ skills: import("../generated/schema.js").components["schemas"]["McpSkillSummary"][];
32
+ slug: string;
33
+ tools: import("../generated/schema.js").components["schemas"]["McpTool"][];
34
+ transport: import("../generated/schema.js").components["schemas"]["McpTransport"];
35
+ updated_at: string;
36
+ url: string;
37
+ }>;
38
+ create: (input: Schemas["CreateMcpInput"]) => Promise<{
39
+ created_at: string;
40
+ display_name: string;
41
+ dynamic_tools: boolean;
42
+ has_headers: boolean;
43
+ header_names: string[] | null;
44
+ id: string;
45
+ last_error: string | null;
46
+ last_refreshed_at: string | null;
47
+ skills: import("../generated/schema.js").components["schemas"]["McpSkillSummary"][];
48
+ slug: string;
49
+ tools: import("../generated/schema.js").components["schemas"]["McpTool"][];
50
+ transport: import("../generated/schema.js").components["schemas"]["McpTransport"];
51
+ updated_at: string;
52
+ url: string;
53
+ }>;
54
+ update: (currentSlug: string, input: Schemas["UpdateMcpInput"]) => Promise<{
55
+ created_at: string;
56
+ display_name: string;
57
+ dynamic_tools: boolean;
58
+ has_headers: boolean;
59
+ header_names: string[] | null;
60
+ id: string;
61
+ last_error: string | null;
62
+ last_refreshed_at: string | null;
63
+ skills: import("../generated/schema.js").components["schemas"]["McpSkillSummary"][];
64
+ slug: string;
65
+ tools: import("../generated/schema.js").components["schemas"]["McpTool"][];
66
+ transport: import("../generated/schema.js").components["schemas"]["McpTransport"];
67
+ updated_at: string;
68
+ url: string;
69
+ }>;
70
+ delete: (slug: string) => Promise<void>;
71
+ /** Re-handshakes the server and re-reads its tool list. */
72
+ refresh: (slug: string) => Promise<{
73
+ created_at: string;
74
+ display_name: string;
75
+ dynamic_tools: boolean;
76
+ has_headers: boolean;
77
+ header_names: string[] | null;
78
+ id: string;
79
+ last_error: string | null;
80
+ last_refreshed_at: string | null;
81
+ skills: import("../generated/schema.js").components["schemas"]["McpSkillSummary"][];
82
+ slug: string;
83
+ tools: import("../generated/schema.js").components["schemas"]["McpTool"][];
84
+ transport: import("../generated/schema.js").components["schemas"]["McpTransport"];
85
+ updated_at: string;
86
+ url: string;
87
+ }>;
88
+ updateTool: (slug: string, toolName: string, enabled: boolean) => Promise<{
89
+ description: string;
90
+ destructive_hint: boolean | null;
91
+ discovered_at: string;
92
+ enabled: boolean;
93
+ id: string;
94
+ idempotent_hint: boolean | null;
95
+ input_schema: Record<string, unknown>;
96
+ name: string;
97
+ open_world_hint: boolean | null;
98
+ output_schema: Record<string, unknown> | null;
99
+ provider_incompatibilities?: Record<string, unknown>;
100
+ read_only_hint: boolean | null;
101
+ title: string | null;
102
+ }>;
103
+ getSkill: (slug: string, skillSlug: string, signal?: AbortSignal) => Promise<{
104
+ created_at: string;
105
+ description: string;
106
+ display_name: string;
107
+ id: string;
108
+ skill_md: string;
109
+ slug: string;
110
+ unlocks_tool_ids: string[];
111
+ updated_at: string;
112
+ }>;
113
+ createSkill: (slug: string, input: Schemas["CreateMcpSkillInput"]) => Promise<{
114
+ created_at: string;
115
+ description: string;
116
+ display_name: string;
117
+ id: string;
118
+ skill_md: string;
119
+ slug: string;
120
+ unlocks_tool_ids: string[];
121
+ updated_at: string;
122
+ }>;
123
+ updateSkill: (slug: string, currentSkillSlug: string, input: Schemas["UpdateMcpSkillInput"]) => Promise<{
124
+ created_at: string;
125
+ description: string;
126
+ display_name: string;
127
+ id: string;
128
+ skill_md: string;
129
+ slug: string;
130
+ unlocks_tool_ids: string[];
131
+ updated_at: string;
132
+ }>;
133
+ deleteSkill: (slug: string, skillSlug: string) => Promise<void>;
134
+ };
@@ -0,0 +1,9 @@
1
+ /** Percent-encodes one path segment. Slugs are `[a-z0-9-]` and ids are UUIDs,
2
+ * but tenant slugs and model ids come from user input and reach these URLs. */
3
+ export declare const enc: typeof encodeURIComponent;
4
+ export declare const tenantPath: (tenantSlug: string) => string;
5
+ /** Drops a slug rename that isn't one, so the server's uniqueness pre-check
6
+ * doesn't reject an entity for colliding with itself. */
7
+ export declare function withoutNoopRename<T extends {
8
+ slug?: string | null;
9
+ }>(input: T, currentSlug: string): T;
@@ -0,0 +1,43 @@
1
+ import type { Transport } from "../http.js";
2
+ import type { Schemas } from "../schemas.js";
3
+ /** Skills are markdown plus supporting files, for prompt-shaping and knowledge.
4
+ * Edits replace in place — there are no version snapshots, and live
5
+ * conversations always see the latest. */
6
+ export declare function skillsApi(t: Transport, tenantSlug: string): {
7
+ list: (signal?: AbortSignal) => Promise<{
8
+ created_at: string;
9
+ description: string;
10
+ display_name: string;
11
+ id: string;
12
+ slug: string;
13
+ updated_at: string;
14
+ }[]>;
15
+ get: (slug: string, signal?: AbortSignal) => Promise<{
16
+ created_at: string;
17
+ description: string;
18
+ display_name: string;
19
+ id: string;
20
+ skill_md: string;
21
+ slug: string;
22
+ updated_at: string;
23
+ }>;
24
+ create: (input: Schemas["CreateSkillInput"]) => Promise<{
25
+ created_at: string;
26
+ description: string;
27
+ display_name: string;
28
+ id: string;
29
+ skill_md: string;
30
+ slug: string;
31
+ updated_at: string;
32
+ }>;
33
+ update: (currentSlug: string, input: Schemas["UpdateSkillInput"]) => Promise<{
34
+ created_at: string;
35
+ description: string;
36
+ display_name: string;
37
+ id: string;
38
+ skill_md: string;
39
+ slug: string;
40
+ updated_at: string;
41
+ }>;
42
+ delete: (slug: string) => Promise<void>;
43
+ };
@@ -0,0 +1,185 @@
1
+ import type { Transport } from "../http.js";
2
+ import type { Schemas } from "../schemas.js";
3
+ /** Task templates are the user-installable triggers that spawn background runs.
4
+ * `agent_slug` on a template is only the executor — calling one as a tool still
5
+ * needs an `agent_triggers` grant. */
6
+ export declare function taskTemplatesApi(t: Transport, tenantSlug: string): {
7
+ list: (signal?: AbortSignal) => Promise<{
8
+ agent_slug: string;
9
+ created_at: string;
10
+ description: string;
11
+ display_name: string;
12
+ id: string;
13
+ schedule_shape: import("../generated/schema.js").components["schemas"]["ScheduleShape"];
14
+ slug: string;
15
+ trigger_source: import("../generated/schema.js").components["schemas"]["TriggerSource"];
16
+ updated_at: string;
17
+ }[]>;
18
+ get: (slug: string, signal?: AbortSignal) => Promise<{
19
+ agent_slug: string;
20
+ allow_self_cancel: boolean;
21
+ api_enabled: boolean;
22
+ created_at: string;
23
+ description: string;
24
+ display_name: string;
25
+ id: string;
26
+ max_active_runs_per_user: number | null;
27
+ parameters: import("../generated/schema.js").components["schemas"]["TaskTemplateParam"][];
28
+ prompt_template: string;
29
+ schedule_shape: import("../generated/schema.js").components["schemas"]["ScheduleShape"];
30
+ secret_hint: string | null;
31
+ secret_rotated_at: string | null;
32
+ slug: string;
33
+ tool_choose_cron: boolean;
34
+ tool_choose_time: boolean;
35
+ tool_fixed_cron: string | null;
36
+ tool_fixed_delay_seconds: number | null;
37
+ tool_max_delay_seconds: number | null;
38
+ tool_max_runs: number | null;
39
+ tool_min_delay_seconds: number | null;
40
+ tool_min_gap_seconds: number | null;
41
+ trigger_source: import("../generated/schema.js").components["schemas"]["TriggerSource"];
42
+ updated_at: string;
43
+ }>;
44
+ create: (input: Schemas["CreateTaskTemplateInput"]) => Promise<{
45
+ agent_slug: string;
46
+ allow_self_cancel: boolean;
47
+ api_enabled: boolean;
48
+ created_at: string;
49
+ description: string;
50
+ display_name: string;
51
+ id: string;
52
+ max_active_runs_per_user: number | null;
53
+ parameters: import("../generated/schema.js").components["schemas"]["TaskTemplateParam"][];
54
+ prompt_template: string;
55
+ schedule_shape: import("../generated/schema.js").components["schemas"]["ScheduleShape"];
56
+ secret_hint: string | null;
57
+ secret_rotated_at: string | null;
58
+ slug: string;
59
+ tool_choose_cron: boolean;
60
+ tool_choose_time: boolean;
61
+ tool_fixed_cron: string | null;
62
+ tool_fixed_delay_seconds: number | null;
63
+ tool_max_delay_seconds: number | null;
64
+ tool_max_runs: number | null;
65
+ tool_min_delay_seconds: number | null;
66
+ tool_min_gap_seconds: number | null;
67
+ trigger_source: import("../generated/schema.js").components["schemas"]["TriggerSource"];
68
+ updated_at: string;
69
+ }>;
70
+ update: (currentSlug: string, input: Schemas["UpdateTaskTemplateInput"]) => Promise<{
71
+ agent_slug: string;
72
+ allow_self_cancel: boolean;
73
+ api_enabled: boolean;
74
+ created_at: string;
75
+ description: string;
76
+ display_name: string;
77
+ id: string;
78
+ max_active_runs_per_user: number | null;
79
+ parameters: import("../generated/schema.js").components["schemas"]["TaskTemplateParam"][];
80
+ prompt_template: string;
81
+ schedule_shape: import("../generated/schema.js").components["schemas"]["ScheduleShape"];
82
+ secret_hint: string | null;
83
+ secret_rotated_at: string | null;
84
+ slug: string;
85
+ tool_choose_cron: boolean;
86
+ tool_choose_time: boolean;
87
+ tool_fixed_cron: string | null;
88
+ tool_fixed_delay_seconds: number | null;
89
+ tool_max_delay_seconds: number | null;
90
+ tool_max_runs: number | null;
91
+ tool_min_delay_seconds: number | null;
92
+ tool_min_gap_seconds: number | null;
93
+ trigger_source: import("../generated/schema.js").components["schemas"]["TriggerSource"];
94
+ updated_at: string;
95
+ }>;
96
+ delete: (slug: string) => Promise<void>;
97
+ /** Mints the shared secret that lets an outside caller schedule this
98
+ * template without an api_key. Shown once. */
99
+ createSecret: (slug: string) => Promise<{
100
+ secret: string;
101
+ secret_hint: string;
102
+ secret_rotated_at: string;
103
+ }>;
104
+ revokeSecret: (slug: string) => Promise<void>;
105
+ /** The raw `Response`: this route answers with a plain-text reason for a
106
+ * refusal (missing param, bad cron, cadence too fast, per-user cap) that is
107
+ * worth surfacing verbatim rather than mapping to a generic message. */
108
+ trigger: (slug: string, input: Schemas["ScheduleTaskTemplateInput"]) => Promise<Response>;
109
+ };
110
+ export declare function scheduledRunsApi(t: Transport, tenantSlug: string): {
111
+ list: (query?: {
112
+ task_template?: string;
113
+ user_id?: string;
114
+ enabled?: boolean;
115
+ }, signal?: AbortSignal) => Promise<{
116
+ agent: null | import("../generated/schema.js").components["schemas"]["AgentRef"];
117
+ allow_self_cancel: boolean;
118
+ created_at: string;
119
+ created_via: string;
120
+ cron_expr: string | null;
121
+ enabled: boolean;
122
+ id: string;
123
+ last_fired_at: string | null;
124
+ max_runs: number | null;
125
+ next_fire_at: string | null;
126
+ run_count: number;
127
+ task_template: null | import("../generated/schema.js").components["schemas"]["TaskTemplateRef"];
128
+ timezone: string;
129
+ until: string | null;
130
+ updated_at: string;
131
+ user: import("../generated/schema.js").components["schemas"]["UserRef"];
132
+ }[]>;
133
+ get: (id: string, signal?: AbortSignal) => Promise<{
134
+ agent: null | import("../generated/schema.js").components["schemas"]["AgentRef"];
135
+ allow_self_cancel: boolean;
136
+ bound_params: Record<string, unknown>;
137
+ created_at: string;
138
+ created_via: string;
139
+ cron_expr: string | null;
140
+ enabled: boolean;
141
+ id: string;
142
+ last_fired_at: string | null;
143
+ max_runs: number | null;
144
+ next_fire_at: string | null;
145
+ notify_target: Record<string, unknown> | null;
146
+ prompt_template: string | null;
147
+ rendered_prompt: string | null;
148
+ run_count: number;
149
+ task_template: null | import("../generated/schema.js").components["schemas"]["TaskTemplateRef"];
150
+ tasks: import("../generated/schema.js").components["schemas"]["RunTask"][];
151
+ timezone: string;
152
+ until: string | null;
153
+ updated_at: string;
154
+ user: import("../generated/schema.js").components["schemas"]["UserRef"];
155
+ }>;
156
+ update: (id: string, input: Schemas["UpdateScheduledRunInput"]) => Promise<{
157
+ agent: null | import("../generated/schema.js").components["schemas"]["AgentRef"];
158
+ allow_self_cancel: boolean;
159
+ bound_params: Record<string, unknown>;
160
+ created_at: string;
161
+ created_via: string;
162
+ cron_expr: string | null;
163
+ enabled: boolean;
164
+ id: string;
165
+ last_fired_at: string | null;
166
+ max_runs: number | null;
167
+ next_fire_at: string | null;
168
+ notify_target: Record<string, unknown> | null;
169
+ prompt_template: string | null;
170
+ rendered_prompt: string | null;
171
+ run_count: number;
172
+ task_template: null | import("../generated/schema.js").components["schemas"]["TaskTemplateRef"];
173
+ tasks: import("../generated/schema.js").components["schemas"]["RunTask"][];
174
+ timezone: string;
175
+ until: string | null;
176
+ updated_at: string;
177
+ user: import("../generated/schema.js").components["schemas"]["UserRef"];
178
+ }>;
179
+ cancel: (id: string) => Promise<void>;
180
+ };
181
+ export declare function backgroundTasksApi(t: Transport, tenantSlug: string): {
182
+ spawn: (input: Schemas["SpawnBackgroundTaskInput"]) => Promise<{
183
+ conversation_id: string;
184
+ }>;
185
+ };