@maudecode/talaria-web-contracts 1.19.0 → 1.21.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/dist/checkpoint.d.ts +78 -0
- package/dist/checkpoint.js +16 -0
- package/dist/checkpoint.js.map +1 -0
- package/dist/context-detail.d.ts +75 -0
- package/dist/context-detail.js +18 -0
- package/dist/context-detail.js.map +1 -0
- package/dist/gateway-session.d.ts +412 -9
- package/dist/gateway-session.js +85 -3
- package/dist/gateway-session.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-cost-policy.d.ts +110 -0
- package/dist/mcp-cost-policy.js +24 -0
- package/dist/mcp-cost-policy.js.map +1 -0
- package/dist/outbound-drafts.d.ts +114 -0
- package/dist/outbound-drafts.js +20 -0
- package/dist/outbound-drafts.js.map +1 -0
- package/dist/prompt-queue.d.ts +96 -0
- package/dist/prompt-queue.js +19 -0
- package/dist/prompt-queue.js.map +1 -0
- package/dist/router.d.ts +3677 -156
- package/dist/routes/automation.d.ts +323 -2
- package/dist/routes/automation.js +17 -3
- package/dist/routes/automation.js.map +1 -1
- package/dist/routes/chat.d.ts +776 -26
- package/dist/routes/chat.js +4 -3
- package/dist/routes/chat.js.map +1 -1
- package/dist/routes/core.d.ts +6 -6
- package/dist/routes/git.d.ts +59 -0
- package/dist/routes/git.js +9 -3
- package/dist/routes/git.js.map +1 -1
- package/dist/routes/raw.js +9 -5
- package/dist/routes/raw.js.map +1 -1
- package/dist/routes/sessions.d.ts +2215 -87
- package/dist/routes/sessions.js +11 -0
- package/dist/routes/sessions.js.map +1 -1
- package/dist/routes/settings.d.ts +29 -13
- package/dist/routes/settings.js +3 -2
- package/dist/routes/settings.js.map +1 -1
- package/dist/routes/tools.d.ts +825 -37
- package/dist/routes/tools.js +33 -5
- package/dist/routes/tools.js.map +1 -1
- package/dist/routes/workspaces.d.ts +49 -4
- package/dist/routes/workspaces.js +5 -4
- package/dist/routes/workspaces.js.map +1 -1
- package/dist/sidecar/methods.d.ts +1122 -25
- package/dist/sidecar/methods.js +2 -2
- package/dist/sidecar/methods.js.map +1 -1
- package/dist/sidecar/namespaces.d.ts +1292 -39
- package/dist/sidecar/namespaces.js +120 -14
- package/dist/sidecar/namespaces.js.map +1 -1
- package/dist/sidecar/rpc.d.ts +1 -0
- package/dist/sidecar/rpc.js +2 -0
- package/dist/sidecar/rpc.js.map +1 -1
- package/dist/sidecar/runtime.d.ts +56 -0
- package/dist/sidecar/runtime.js +21 -2
- package/dist/sidecar/runtime.js.map +1 -1
- package/dist/sidecar/version.d.ts +1 -1
- package/dist/sidecar/version.js +1 -1
- package/dist/sse.d.ts +199 -10
- package/dist/sse.js +15 -4
- package/dist/sse.js.map +1 -1
- package/dist/views.d.ts +1597 -86
- package/dist/views.js +106 -21
- package/dist/views.js.map +1 -1
- package/fixtures/sidecar/aux.json +8 -0
- package/fixtures/sidecar/chat.json +14 -0
- package/fixtures/sidecar/checkpoints.json +7 -2
- package/fixtures/sidecar/context-detail.json +77 -0
- package/fixtures/sidecar/cron.json +3 -1
- package/fixtures/sidecar/dashboard_plugins.json +59 -0
- package/fixtures/sidecar/gateway.json +208 -0
- package/fixtures/sidecar/kanban.json +197 -0
- package/fixtures/sidecar/managed-buffers.json +16 -0
- package/fixtures/sidecar/mcp.json +12 -0
- package/fixtures/sidecar/outbound-drafts.json +1 -0
- package/fixtures/sidecar/plugin-catalog.json +4 -0
- package/fixtures/sidecar/plugins.json +56 -1
- package/fixtures/sidecar/process.json +32 -0
- package/fixtures/sidecar/rpc.json +4 -0
- package/fixtures/sidecar/runtime.json +3 -3
- package/fixtures/sidecar/state_db.json +10 -0
- package/package.json +1 -1
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { OutboundDraftRefSchema, OutboundDraftFieldsSchema, OutboundDraftResultSchema } from '../outbound-drafts.js';
|
|
2
|
+
import { McpCostPolicyDataSchema } from '../mcp-cost-policy.js';
|
|
3
|
+
import { ContextDetailSchema } from '../context-detail.js';
|
|
1
4
|
import { z } from 'zod';
|
|
2
5
|
import { ProviderPhaseSchema } from '../run-status.js';
|
|
3
6
|
import { SpeedTierSchema } from '../speed.js';
|
|
4
|
-
import { GatewaySessionParamsSchema, GatewaySessionResultSchema } from '../gateway-session.js';
|
|
7
|
+
import { GatewayClarifyBatchSchema, GatewayCreateParamsSchema, GatewaySessionParamsSchema, GatewaySessionResultSchema } from '../gateway-session.js';
|
|
5
8
|
/** Warnings and wording come from the Agent's selection guard registry, including future guard kinds. */
|
|
6
9
|
export const ModelSelectionWarningSchema = z.object({ kind: z.string(), title: z.string(), model: z.string(), provider: z.string(), message: z.string() });
|
|
7
10
|
/** Shared param shapes. */
|
|
@@ -71,37 +74,93 @@ export const PluginSettingFieldSchema = z.object({
|
|
|
71
74
|
key: z.string(), type: z.enum(['string', 'number', 'boolean', 'enum', 'json', 'secret']), label: z.string(), description: z.string(), required: z.boolean(),
|
|
72
75
|
choices: z.array(z.string()).optional(), default: Json.optional(), value: Json.optional(), env: z.string().optional(), has_value: z.boolean().optional(),
|
|
73
76
|
});
|
|
77
|
+
/** Persistence succeeded; this separately describes application to live plugin MCP connections. */
|
|
78
|
+
export const PluginRuntimeApplicationSchema = z.enum(['applied', 'restart_required', 'unknown']);
|
|
79
|
+
/** TAL-1276: one OAuth client a plugin manifest declares, its grant's state as `hermes auth status` maps it, and the hosts the code is approved at and exchanged at. */
|
|
80
|
+
export const PluginOAuthStateSchema = z.enum(['signed_in', 'sign_in_needed', 'revoked', 'logged_out']);
|
|
81
|
+
export const PluginOAuthClientSchema = z.object({ id: z.string(), state: PluginOAuthStateSchema, authorize_host: z.string(), token_host: z.string() });
|
|
82
|
+
export const PluginUpdateResultSchema = z.discriminatedUnion('status', [
|
|
83
|
+
z.object({ key: z.string(), status: z.literal('updated') }),
|
|
84
|
+
z.object({ key: z.string(), status: z.literal('needs_consent'), verdict: z.literal('caution'), findings: z.string(), consent_token: z.string().min(1) }),
|
|
85
|
+
z.object({ key: z.string(), status: z.literal('blocked'), verdict: z.string(), findings: z.string() }),
|
|
86
|
+
]);
|
|
87
|
+
export const PluginCatalogQuerySchema = z.object({ query: z.string().trim().max(200).default(''), offset: z.coerce.number().int().min(0).max(10000).default(0), limit: z.coerce.number().int().min(1).max(50).default(20) });
|
|
88
|
+
export const PluginInstallInputSchema = z.object({ name: z.string().regex(/^[a-z0-9_-]{1,64}$/), consent_token: z.string().min(1).max(128).optional() });
|
|
89
|
+
export const PluginCatalogSchema = z.object({ supported: z.boolean(), read_only: z.boolean().optional(), entries: z.array(z.object({
|
|
90
|
+
name: z.string(), title: z.string(), description: z.string(), repo: z.string(), sha: z.string(), tier: z.string(), category: z.string(),
|
|
91
|
+
requirements: z.array(z.string()), installed_key: z.string().nullable(), installed_sha: z.string().nullable(), can_install: z.boolean(), refusal: z.string().nullable(),
|
|
92
|
+
})), total: z.number().int().nonnegative(), next_offset: z.number().int().nullable() });
|
|
93
|
+
export const PluginInstallResultSchema = z.discriminatedUnion('status', [
|
|
94
|
+
z.object({ name: z.string(), key: z.string(), status: z.literal('installed'), enabled: z.literal(false) }),
|
|
95
|
+
z.object({ name: z.string(), status: z.literal('needs_consent'), findings: z.string(), consent_token: z.string() }),
|
|
96
|
+
z.object({ name: z.string(), status: z.literal('blocked'), findings: z.string() }),
|
|
97
|
+
]);
|
|
74
98
|
export const PluginProviderSchema = z.object({ name: z.string(), display_name: z.string(), auth_type: z.string(), setup: z.enum(['ready', 'missing_cli', 'needs_setup', 'not_loaded', 'unavailable']) });
|
|
99
|
+
/** Profile-owned Agent dashboards use Web protocol panels; native Desktop bundles need migration. */
|
|
100
|
+
export const AgentDashboardPluginSchema = z.object({
|
|
101
|
+
name: z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/), label: z.string().max(80), version: z.string().max(40), description: z.string().max(300),
|
|
102
|
+
enabled: z.boolean(), panel: z.string().nullable(), has_api: z.boolean(),
|
|
103
|
+
});
|
|
104
|
+
export const AgentDashboardResponseSchema = z.object({ status: z.number().int().min(200).max(599), body: z.string(), content_type: z.string() });
|
|
105
|
+
const DashboardNameParams = ProfileHomeParams.extend({ name: z.string() });
|
|
75
106
|
/** A skill bundle: `/<name>` loads its `skill_count` skills in one message (TAL-265). */
|
|
76
107
|
export const CommandBundleSchema = z.object({ name: z.string(), description: z.string(), skill_count: z.number().int(), source: z.literal('bundle') });
|
|
77
108
|
/** `message` is the user message that loads the bundle's skills; members not installed or disabled are in `missing_skills` or left out. */
|
|
78
109
|
export const CommandBundleInvocationSchema = z.object({ name: z.string(), source: z.literal('bundle'), message: z.string(), loaded_skills: z.array(z.string()), missing_skills: z.array(z.string()) });
|
|
110
|
+
export const MAX_MANAGED_BUFFER_BYTES = 256 * 1024;
|
|
111
|
+
const ManagedBufferName = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/);
|
|
112
|
+
const ManagedBufferSize = z.number().int().min(0).max(MAX_MANAGED_BUFFER_BYTES);
|
|
79
113
|
export const COMMANDS_METHODS = {
|
|
114
|
+
'drafts.review': { params: OutboundDraftRefSchema.extend({ profile_home: z.string().min(1), session_id: z.string().min(1), action: z.enum(['read', 'edit', 'approve']), version: z.number().int().positive().optional(), revision: z.string().optional(), fields: OutboundDraftFieldsSchema.optional() }), result: OutboundDraftResultSchema },
|
|
80
115
|
'commands.registry': { params: ProfileHomeParams, result: z.object({ commands: z.array(CommandSchema) }) },
|
|
81
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* With `session_id`, a plugin command runs under that chat's session binding and `workspace` (TAL-904) and receives the session
|
|
118
|
+
* as its handler declares it; every recognised command fires the Agent's `pre_command` hook with that session (TAL-1267).
|
|
119
|
+
*/
|
|
82
120
|
'commands.exec': { params: ProfileHomeParams.extend({ command: z.string().min(1), session_id: z.string().min(1).optional(), workspace: z.string().optional() }), result: z.object({ output: z.string(), source: z.enum(['agent', 'plugin']) }) },
|
|
83
121
|
/**
|
|
84
122
|
* `/<prompt built-in> [args]` as the turn text (`message`) the Agent's builder writes for the session's profile, workspace and toolsets.
|
|
85
123
|
* `name` is the built-in's canonical name, null when the command is not one; `message` is null when this Agent has no builder for it.
|
|
86
|
-
* A failing builder errors `prompt_expand_failed`.
|
|
124
|
+
* A failing builder errors `prompt_expand_failed`. Every built-in fires the Agent's `pre_command` hook with `session_id` (TAL-1279).
|
|
87
125
|
*/
|
|
88
|
-
'commands.expand_prompt': { params: ProfileHomeParams.extend({ command: z.string().min(1), workspace: z.string(), enabled_toolsets: z.array(z.string()).nullable() }), result: z.object({ name: z.string().nullable(), message: z.string().nullable() }) },
|
|
126
|
+
'commands.expand_prompt': { params: ProfileHomeParams.extend({ command: z.string().min(1), session_id: z.string().min(1).optional(), workspace: z.string(), enabled_toolsets: z.array(z.string()).nullable() }), result: z.object({ name: z.string().nullable(), message: z.string().nullable() }) },
|
|
89
127
|
'commands.bundles': { params: ProfileHomeParams, result: z.object({ bundles: z.array(CommandBundleSchema) }) },
|
|
90
128
|
'commands.bundle_resolve': { params: ProfileHomeParams.extend({ command: z.string().min(1) }), result: CommandBundleInvocationSchema },
|
|
91
129
|
'commands.moa_preset': { params: ProfileHomeParams.extend({ preset: z.string().nullable().optional() }), result: z.object({ moa: Loose }) },
|
|
130
|
+
/** Fixed devkit buffer adapter. No arbitrary HTTP paths, promotion or cleanup. Native saves are unconditional. */
|
|
131
|
+
'plugins.buffers': {
|
|
132
|
+
params: ProfileHomeParams.extend({ action: z.enum(['list', 'read', 'save']), session_id: z.string().min(1).max(200), name: ManagedBufferName.optional(), content: z.string().max(MAX_MANAGED_BUFFER_BYTES).optional() }),
|
|
133
|
+
result: z.object({ supported: z.boolean(), buffers: z.array(z.object({ name: ManagedBufferName, size: ManagedBufferSize, read_only: z.boolean() })).max(200), content: z.string().max(MAX_MANAGED_BUFFER_BYTES).optional(), size: ManagedBufferSize.optional(), read_only: z.boolean().optional(), write_semantics: z.literal('unconditional') }),
|
|
134
|
+
},
|
|
135
|
+
'plugins.dashboard_list': { params: ProfileHomeParams, result: z.object({ supported: z.boolean(), plugins: z.array(AgentDashboardPluginSchema) }) },
|
|
136
|
+
'plugins.dashboard_toggle': { params: DashboardNameParams.extend({ enabled: z.boolean() }), result: z.object({ ok: z.literal(true) }) },
|
|
137
|
+
'plugins.dashboard_asset': { params: DashboardNameParams.extend({ path: z.string() }), result: AgentDashboardResponseSchema },
|
|
138
|
+
/** Buffered HTTP only. Cancellation abandons the result; the Agent has no handler-cancel operation. */
|
|
139
|
+
'plugins.dashboard_request': { params: DashboardNameParams.extend({ path: z.string(), method: z.string(), query: z.string(), headers: z.record(z.string(), z.string()), body: z.string(), authenticated: z.boolean(), websocket: z.boolean() }), result: AgentDashboardResponseSchema },
|
|
92
140
|
'plugins.providers': { params: ProfileHomeParams, result: z.object({ providers: z.array(PluginProviderSchema) }) },
|
|
93
|
-
'plugins.list': { params: ProfileHomeParams.extend({ selected_providers: z.record(z.string(), z.string()).optional() }), result: z.object({ plugins: z.array(z.object({ name: z.string(), key: z.string(), version: z.string(), description: z.string(), enabled: z.boolean(), kind: z.string(), activation: z.string(), hooks: z.array(z.string()), is_active_provider: z.boolean().optional() })), supported_hooks: z.array(z.string()) }) },
|
|
141
|
+
'plugins.list': { params: ProfileHomeParams.extend({ selected_providers: z.record(z.string(), z.string()).optional() }), result: z.object({ plugins: z.array(z.object({ name: z.string(), key: z.string(), version: z.string(), description: z.string(), enabled: z.boolean(), kind: z.string(), activation: z.string(), hooks: z.array(z.string()), is_active_provider: z.boolean().optional(), update_available: z.boolean().optional(), latest_revision: z.string().optional() })), supported_hooks: z.array(z.string()) }) },
|
|
142
|
+
'plugins.catalog': { params: ProfileHomeParams.extend(PluginCatalogQuerySchema.shape), result: PluginCatalogSchema },
|
|
143
|
+
'plugins.install': { params: ProfileHomeParams.extend(PluginInstallInputSchema.shape), result: PluginInstallResultSchema },
|
|
144
|
+
'plugins.update': { params: ProfileHomeParams.extend({ key: z.string().min(1), accept_caution: z.boolean().optional(), consent_token: z.string().min(1).max(128).optional() }), result: PluginUpdateResultSchema },
|
|
94
145
|
/** TAL-820: each profile's `plugins.isolation` and installed third-party plugin count, read without loading a plugin. */
|
|
95
146
|
'plugins.isolation': { params: BaseHomeParams, result: z.object({ profiles: z.array(z.object({ name: z.string(), isolation: z.enum(['in_process', 'host']), third_party_plugins: z.number().int() })) }) },
|
|
96
147
|
/** TAL-806: plugins whose manifest declares settings; `supported` is false on an Agent without `hermes_cli.plugins_settings`. */
|
|
97
148
|
'plugins.settings': { params: ProfileHomeParams, result: z.object({ supported: z.boolean(), plugins: z.array(z.object({ key: z.string(), fields: z.array(PluginSettingFieldSchema) })) }) },
|
|
149
|
+
/**
|
|
150
|
+
* TAL-1276: plugins whose manifest declares OAuth clients (Agent v0.22.3+), each client's sign-in state as
|
|
151
|
+
* `hermes auth status <plugin>:<id>` reports it, and the hosts the CLI names before signing in: the code is approved
|
|
152
|
+
* at `authorize_host` and exchanged at `token_host`. `supported` is false on an Agent without the plugin OAuth helpers.
|
|
153
|
+
*/
|
|
154
|
+
'plugins.oauth_status': { params: ProfileHomeParams, result: z.object({ supported: z.boolean(), plugins: z.array(z.object({ key: z.string(), clients: z.array(PluginOAuthClientSchema) })) }) },
|
|
155
|
+
/** TAL-1276: `hermes auth logout <plugin>:<id>`; `removed` is false when no grant was stored. Errors `oauth_unsupported` on older Agents. */
|
|
156
|
+
'plugins.oauth_logout': { params: ProfileHomeParams.extend({ key: z.string().min(1), id: z.string().min(1) }), result: z.object({ key: z.string(), id: z.string(), removed: z.boolean() }) },
|
|
98
157
|
/**
|
|
99
158
|
* TAL-806: write non-secret `values` through the Agent's locked plugin-state writer and return the refreshed fields.
|
|
100
159
|
* An undeclared key, a secret or a type mismatch is invalid params; a managed install or key errors `plugin_settings_managed`.
|
|
101
160
|
* `secret_envs` (secret key → `.env` name the caller wrote) is checked against the current manifest before anything is
|
|
102
161
|
* written; a key that is no longer a secret stored under that name errors `plugin_settings_changed`.
|
|
103
162
|
*/
|
|
104
|
-
'plugins.settings_save': { params: ProfileHomeParams.extend({ key: z.string().min(1), values: z.record(z.string(), Json), secret_envs: z.record(z.string(), z.string()).optional() }), result: z.object({ key: z.string(), written: z.array(z.string()), fields: z.array(PluginSettingFieldSchema) }) },
|
|
163
|
+
'plugins.settings_save': { params: ProfileHomeParams.extend({ key: z.string().min(1), values: z.record(z.string(), Json), secret_envs: z.record(z.string(), z.string()).optional() }), result: z.object({ key: z.string(), written: z.array(z.string()), fields: z.array(PluginSettingFieldSchema), runtime_application: PluginRuntimeApplicationSchema.optional() }) },
|
|
105
164
|
};
|
|
106
165
|
// ── kanban ─────────────────────────────────────────────────────────────
|
|
107
166
|
const Board = ProfileHomeParams.extend({ board: z.string().nullable().optional() });
|
|
@@ -124,7 +183,14 @@ export const KanbanBoardSchema = z.union([
|
|
|
124
183
|
export const KanbanAssigneeSchema = z.union([z.string(), z.object({ name: z.string(), on_disk: z.boolean().optional(), counts: z.record(z.string(), z.number().int()).optional() }).catchall(Json)]);
|
|
125
184
|
export const KanbanEventSchema = z.object({ id: z.number().int(), task_id: z.string().nullable(), run_id: z.union([z.number().int(), z.string()]).nullable(), kind: z.string(), payload: Json, created_at: z.number().nullable() });
|
|
126
185
|
export const KanbanBoardMetaSchema = z.object({ slug: z.string(), name: z.string().nullable().optional(), archived: z.boolean().optional() }).catchall(Json);
|
|
186
|
+
export const KanbanInspectionEdgeSchema = z.object({ source: z.string(), target: z.string() });
|
|
187
|
+
export const KanbanInspectionNodeSchema = z.object({ key: z.string(), board: z.string(), board_name: z.string(), task: KanbanTaskSchema.extend(KanbanRunStartShape) });
|
|
188
|
+
export const KanbanInspectionSnapshotSchema = z.object({
|
|
189
|
+
nodes: z.array(KanbanInspectionNodeSchema).max(500),
|
|
190
|
+
edges: z.array(KanbanInspectionEdgeSchema).max(2000), generated_at: z.number(), truncated: z.boolean(), read_only: z.boolean(),
|
|
191
|
+
});
|
|
127
192
|
export const KANBAN_METHODS = {
|
|
193
|
+
'kanban.inspection': { params: Board.extend({ include_archived: z.boolean().optional() }), result: KanbanInspectionSnapshotSchema },
|
|
128
194
|
'kanban.board': { params: Board.extend({ tenant: z.string().nullable().optional(), assignee: z.string().nullable().optional(), include_archived: z.boolean().optional(), only_mine: z.boolean().optional(), since: z.number().int().nullable().optional(), profile: z.string().nullable().optional() }), result: KanbanBoardSchema },
|
|
129
195
|
'kanban.boards': { params: ProfileHomeParams.extend({ include_archived: z.boolean().optional() }), result: z.object({ boards: z.array(KanbanBoardMetaSchema.extend({ is_current: z.boolean(), counts: z.record(z.string(), z.number().int()), total: z.number().int() })), current: z.string(), read_only: z.boolean() }) },
|
|
130
196
|
'kanban.create_board': { params: ProfileHomeParams.extend({ board_spec: Loose }), result: z.object({ board: KanbanBoardMetaSchema, current: z.string(), read_only: z.boolean() }) },
|
|
@@ -166,6 +232,12 @@ export const STATE_DB_METHODS = {
|
|
|
166
232
|
'state_db.delete_cli_session': { params: Session.extend({ include_compression_lineage: z.boolean().optional() }), result: Ok.extend({ refused: SessionDeleteRefusedSchema.optional(), deleted_ids: z.array(z.string().min(1)).optional() }) },
|
|
167
233
|
/** TAL-258: append one row through the Agent's `SessionDB.append_message` (bumps `message_count`); `ok` is false without a state.db. */
|
|
168
234
|
'state_db.append_message': { params: Session.extend({ role: z.string().min(1), content: z.string(), tool_name: z.string().nullable().optional(), timestamp: z.number().nullable().optional() }), result: Ok },
|
|
235
|
+
/**
|
|
236
|
+
* TAL-1274: the Agent's low-disk session auto-prune question for the profile (Agent v0.22.3 `hermes_cli.prune_advisor`), as the
|
|
237
|
+
* Agent's own `lines` naming `/autoprune on|off|later`; null while the Agent would not ask (disk not low, `sessions.auto_prune`
|
|
238
|
+
* set, or snoozed) or has no advisor. May measure state.db, which takes seconds on a large store.
|
|
239
|
+
*/
|
|
240
|
+
'state_db.prune_advice': { params: ProfileHomeParams, result: z.object({ advice: z.object({ lines: z.array(z.string()).min(1) }).nullable() }) },
|
|
169
241
|
};
|
|
170
242
|
// ── profiles ───────────────────────────────────────────────────────────
|
|
171
243
|
/** TAL-213: the profile's canonical Bot Chat (its session titled exactly "Bot Chat") and that chat's live compression tip. */
|
|
@@ -209,6 +281,7 @@ export const SKILLS_METHODS = {
|
|
|
209
281
|
};
|
|
210
282
|
// ── mcp ────────────────────────────────────────────────────────────────
|
|
211
283
|
export const MCP_METHODS = {
|
|
284
|
+
'mcp.cost_policies': { params: ProfileHomeParams.extend({ servers: Loose }), result: z.object({ supported: z.boolean(), policies: z.array(McpCostPolicyDataSchema) }) },
|
|
212
285
|
'mcp.status': { params: ProfileHomeParams, result: z.object({ servers: z.array(z.object({ name: z.string() }).catchall(Json)) }) },
|
|
213
286
|
'mcp.registry_tools': { params: ProfileHomeParams, result: z.object({ tools: z.array(z.object({ name: z.string(), server: z.string(), schema: Loose })) }) },
|
|
214
287
|
'mcp.reload': { params: ProfileHomeParams, result: z.object({ output: z.string() }) },
|
|
@@ -312,7 +385,7 @@ export const CRON_METHODS = {
|
|
|
312
385
|
'cron.history': { params: CronJob.extend({ offset: z.number().int().optional(), limit: z.number().int().optional() }), result: z.object({ job_id: z.string(), runs: z.array(z.object({ filename: z.string(), size: z.number().int(), modified: z.number(), usage: CronUsageSchema })), total: z.number().int(), offset: z.number().int() }) },
|
|
313
386
|
'cron.run_detail': { params: CronJob.extend({ filename: z.string().min(1) }), result: z.object({ job_id: z.string(), filename: z.string(), content: z.string(), snippet: z.string(), usage: CronUsageSchema }) },
|
|
314
387
|
'cron.output': { params: CronJob.extend({ limit: z.number().int().optional() }), result: z.object({ job_id: z.string(), outputs: z.array(z.object({ filename: z.string(), content: z.string() })) }) },
|
|
315
|
-
'cron.delivery_options': { params:
|
|
388
|
+
'cron.delivery_options': { params: ProfileHomeParams, result: z.object({ platforms: z.array(z.object({ value: z.string(), label: z.string() })) }) },
|
|
316
389
|
};
|
|
317
390
|
// ── providers / models ─────────────────────────────────────────────────
|
|
318
391
|
/**
|
|
@@ -339,14 +412,21 @@ export const PROVIDERS_METHODS = {
|
|
|
339
412
|
* `oauth.start` answers the code to show; a sidecar thread polls the provider and writes the credential through the
|
|
340
413
|
* Agent's own auth store. A flow belongs to the profile home that started it: poll and cancel from another home do not
|
|
341
414
|
* find it. `error` is the Agent's reason for a flow that ended without a credential.
|
|
415
|
+
*
|
|
416
|
+
* TAL-1276: provider `plugin:<key>:<id>` is the browser sign-in of a plugin-declared OAuth client. Its start has no
|
|
417
|
+
* `user_code`; `verification_url` is the authorize link, `redirect_uri` the loopback address the browser is sent back
|
|
418
|
+
* to, and `authorize_host`/`token_host` the hosts the code goes to. It finishes when that redirect reaches the sidecar's
|
|
419
|
+
* listener or through `oauth.submit_redirect` with the address the browser showed (`oauth_redirect_invalid` for any
|
|
420
|
+
* other address, `oauth_flow_ended` once the flow ended).
|
|
342
421
|
*/
|
|
343
422
|
export const OAuthFlowStatusSchema = z.enum(['pending', 'approved', 'denied', 'expired', 'cancelled', 'error']);
|
|
344
423
|
const OAuthFlow = z.object({ flow_id: z.string(), provider: z.string(), status: OAuthFlowStatusSchema, error: z.string().nullable() });
|
|
345
424
|
const OAuthFlowParams = ProfileHomeParams.extend({ flow_id: z.string().min(1) });
|
|
346
425
|
export const OAUTH_METHODS = {
|
|
347
|
-
'oauth.start': { params: ProfileHomeParams.extend({ provider: z.string().min(1) }), result: z.object({ flow_id: z.string(), provider: z.string(), status: z.literal('pending'), user_code: z.string(), verification_url: z.string(), expires_in: z.number().int(), interval: z.number().int() }) },
|
|
426
|
+
'oauth.start': { params: ProfileHomeParams.extend({ provider: z.string().min(1) }), result: z.object({ flow_id: z.string(), provider: z.string(), status: z.literal('pending'), user_code: z.string().optional(), verification_url: z.string(), expires_in: z.number().int(), interval: z.number().int(), redirect_uri: z.string().optional(), authorize_host: z.string().optional(), token_host: z.string().optional() }) },
|
|
348
427
|
'oauth.poll': { params: OAuthFlowParams, result: OAuthFlow },
|
|
349
428
|
'oauth.cancel': { params: OAuthFlowParams, result: OAuthFlow },
|
|
429
|
+
'oauth.submit_redirect': { params: OAuthFlowParams.extend({ url: z.string().min(1) }), result: OAuthFlow },
|
|
350
430
|
};
|
|
351
431
|
// ── aux / text / process / usage / gateway ─────────────────────────────
|
|
352
432
|
export const AuxUsageSchema = z.object({ prompt_tokens: z.number().int().optional(), completion_tokens: z.number().int().optional(), total_tokens: z.number().int().optional() });
|
|
@@ -420,6 +500,7 @@ export const PROCESS_METHODS = {
|
|
|
420
500
|
/** Hands back a claim the busy target never admitted, without spending one of the Agent's delivery attempts. */
|
|
421
501
|
'process.defer_delivery': { params: ProfileHomeParams.extend({ event: Loose, claim_id: z.string() }), result: Ok },
|
|
422
502
|
'process.format_notification': { params: z.object({ event: Loose }), result: z.object({ text: z.string() }) },
|
|
503
|
+
'process.stop': { params: ProfileHomeParams.extend({ session_id: z.string().min(1), process_id: z.string().min(1) }), result: z.object({ outcome: z.enum(['stopped', 'not_running', 'not_found']) }) },
|
|
423
504
|
'process.list': { params: ProfileHomeParams, result: z.object({ sessions: z.array(Loose) }) },
|
|
424
505
|
/** TAL-372: the Agent's view of these WebUI sessions' background work: ledger delegations (with live status) and notified processes. */
|
|
425
506
|
'process.background_list': {
|
|
@@ -490,6 +571,12 @@ export const CONFIG_METHODS = {
|
|
|
490
571
|
};
|
|
491
572
|
export const WORKTREE_METHODS = {
|
|
492
573
|
'worktree.create': { params: ProfileHomeParams.extend({ repo_root: z.string().min(1) }), result: z.object({ path: z.string(), branch: z.string(), repo_root: z.string(), base: z.string().nullable() }) },
|
|
574
|
+
/**
|
|
575
|
+
* TAL-1254: relock Talaria's worktrees for this sidecar (`hermes pid=<pid>`) so the Agent's worktree sweep reads them as
|
|
576
|
+
* live. `foreign_lock`: a lock that is not a `hermes pid=` one holds the tree and stays. A tree this sidecar does not
|
|
577
|
+
* hold yet (a running process's `hermes pid=` lock, or a git failure) is absent from `results`; the caller retries it.
|
|
578
|
+
*/
|
|
579
|
+
'worktree.retain': { params: z.object({ paths: z.array(z.string().min(1)) }), result: z.object({ results: z.record(z.string(), z.enum(['retained', 'missing', 'foreign_lock'])) }) },
|
|
493
580
|
};
|
|
494
581
|
/** TAL-913: a workspace's checkpoints, read and restored through the Agent's `CheckpointManager`; `store` is its shared git store. */
|
|
495
582
|
const CheckpointTarget = ProfileHomeParams.extend({ workspace: z.string().min(1) });
|
|
@@ -498,7 +585,14 @@ export const CHECKPOINTS_METHODS = {
|
|
|
498
585
|
'checkpoints.list': { params: CheckpointTarget, result: z.object({ checkpoints: z.array(AgentCheckpointSchema), store: z.string() }) },
|
|
499
586
|
/** `diff` is `git diff <checkpoint> --cached` over the workspace: `a/` is the checkpoint, `b/` the files now. */
|
|
500
587
|
'checkpoints.diff': { params: CheckpointTarget.extend({ checkpoint: z.string().min(1) }), result: z.object({ stat: z.string(), diff: z.string() }) },
|
|
501
|
-
|
|
588
|
+
/**
|
|
589
|
+
* Safe unless `all` (TAL-1260): only files still as the Agent last wrote them are reverted, and `kept_user_edits` names the
|
|
590
|
+
* hand-edited ones left in place. `restored_files` is what a safe restore acted on; null when the whole tree was checked out.
|
|
591
|
+
*/
|
|
592
|
+
'checkpoints.restore': {
|
|
593
|
+
params: CheckpointTarget.extend({ checkpoint: z.string().min(1), all: z.boolean().optional() }),
|
|
594
|
+
result: z.object({ restored_to: z.string(), reason: z.string(), restored_files: z.array(z.string()).nullable(), kept_user_edits: z.array(z.string()), skipped_oversize: z.array(z.string()), failed_deletes: z.array(z.string()) }),
|
|
595
|
+
},
|
|
502
596
|
};
|
|
503
597
|
// ── chat / approval / clarify ──────────────────────────────────────────
|
|
504
598
|
export const ChatUsageSchema = z.object({ prompt_tokens: z.number().int(), completion_tokens: z.number().int(), cache_read_tokens: z.number().int(), cache_write_tokens: z.number().int(), estimated_cost_usd: z.number().nullable() });
|
|
@@ -540,6 +634,7 @@ export const ChatStreamSchema = z.discriminatedUnion('event', [
|
|
|
540
634
|
/** TAL-397: the Agent's session counters, before the content frame that follows a change. */
|
|
541
635
|
z.object({ event: z.literal('usage'), data: ChatUsageSchema }),
|
|
542
636
|
z.object({ event: z.literal('tool'), data: ToolFrame }),
|
|
637
|
+
z.object({ event: z.literal('tool_progress'), data: z.object({ tool_call_id: z.string(), message: z.string().nullable().optional(), progress: z.number().nullable().optional(), total: z.number().nullable().optional(), percent: z.number().nullable().optional() }) }),
|
|
543
638
|
z.object({ event: z.literal('tool_complete'), data: ToolFrame }),
|
|
544
639
|
z.object({ event: z.literal('approval'), data: Loose }),
|
|
545
640
|
z.object({ event: z.literal('clarify'), data: Loose }),
|
|
@@ -628,9 +723,12 @@ export const CHAT_METHODS = {
|
|
|
628
723
|
commit_token: z.string().nullable(),
|
|
629
724
|
}),
|
|
630
725
|
},
|
|
726
|
+
/** TAL-1333: safe metadata from the existing matching resident Agent, never a new Agent. */
|
|
727
|
+
'chat.context_detail': { params: ProfileHomeParams.extend({ session_id: z.string().min(1), model: z.string().nullable(), model_provider: z.string().nullable(), workspace: z.string().nullable() }), result: ContextDetailSchema },
|
|
631
728
|
/** TAL-255: second phase of `chat.compress`; `finalized: false` when the token is unknown or already expired. */
|
|
632
729
|
'chat.compress_finalize': { params: z.object({ commit_token: z.string().min(1), committed: z.boolean() }), result: z.object({ finalized: z.boolean() }) },
|
|
633
|
-
|
|
730
|
+
/** Archive only emits on_session_delete for the committed local transition; it never closes the Agent session. */
|
|
731
|
+
'chat.finalize_session': { params: ProfileHomeParams.extend({ session_id: z.string().min(1), reason: z.enum(['clear', 'delete', 'archive']), lineage: z.array(z.string().min(1)).max(10_000).optional() }), result: z.object({ messages: z.array(z.string()) }) },
|
|
634
732
|
'chat.evict_agent': { params: z.object({ session_id: z.string().min(1), clear_session: z.boolean().optional() }), result: z.object({ evicted: z.boolean() }) },
|
|
635
733
|
'chat.commit_memory': { params: ProfileHomeParams.extend({ session_id: z.string().min(1) }), result: z.object({ committed: z.boolean() }) },
|
|
636
734
|
/**
|
|
@@ -653,18 +751,26 @@ export const CHAT_METHODS = {
|
|
|
653
751
|
'approval.set_yolo': { params: z.object({ session_id: z.string().min(1), enabled: z.boolean() }), result: z.object({ yolo_enabled: z.boolean(), released: z.number().int() }) },
|
|
654
752
|
'clarify.respond': { params: z.object({ stream_id: z.string().optional(), session_id: z.string().optional(), clarify_id: z.string().optional(), response: z.string() }), result: z.object({ ok: z.boolean(), clarify_id: z.string().optional() }) },
|
|
655
753
|
};
|
|
656
|
-
const GatewayActionParams = ProfileHomeParams.extend({ cli_profile: z.string().nullable().optional(), quick_timeout_seconds: z.number().optional(), background_wait_seconds: z.number().optional() });
|
|
754
|
+
const GatewayActionParams = ProfileHomeParams.extend({ interrupt: z.boolean().optional(), cli_profile: z.string().nullable().optional(), quick_timeout_seconds: z.number().optional(), background_wait_seconds: z.number().optional() });
|
|
657
755
|
/**
|
|
658
756
|
* A lifecycle run of `hermes --profile <name> gateway <action>` for the profile at `profile_home` (TAL-894). `busy` means another
|
|
659
|
-
* action holds the lock; `
|
|
757
|
+
* action holds the lock; `busy_live_work` is an Agent live-work refusal. `interrupt` explicitly consents to interruption.
|
|
758
|
+
* `timed_out` marks a child killed after `background_wait_seconds` (a restart defaults to the Agent CLI's own
|
|
660
759
|
* restart budget plus 30 s) or cancelled. `detail` is CLI output, never shown to a browser; `reason` is the Agent's first error line of a
|
|
661
760
|
* failed run (TAL-884), the one line the server shows.
|
|
662
761
|
*/
|
|
663
|
-
const GatewayActionResult = z.object({ status: z.enum(['completed', 'failed', 'busy']), message: z.string(), detail: z.string().optional(), returncode: z.number().int().optional(), reason: z.string().optional(), timed_out: z.boolean().optional() });
|
|
762
|
+
const GatewayActionResult = z.object({ status: z.enum(['completed', 'failed', 'busy', 'busy_live_work']), message: z.string(), detail: z.string().optional(), returncode: z.number().int().optional(), reason: z.string().optional(), timed_out: z.boolean().optional() });
|
|
664
763
|
const GatewayActionStream = z.discriminatedUnion('event', [z.object({ event: z.literal('progress'), data: z.object({ phase: z.enum(['started', 'draining']) }) })]);
|
|
665
764
|
export const GATEWAY_ACTIONS = ['start', 'stop', 'restart'];
|
|
666
765
|
export const GATEWAY_METHODS = {
|
|
667
|
-
'gateway.session': { params: GatewaySessionParamsSchema, result: GatewaySessionResultSchema, stream: z.
|
|
766
|
+
'gateway.session': { params: GatewaySessionParamsSchema, result: GatewaySessionResultSchema, stream: z.discriminatedUnion('event', [
|
|
767
|
+
z.object({ event: z.literal('snapshot'), data: GatewaySessionResultSchema.extend({ replaying: z.boolean().optional(), reaction_only: z.boolean().optional() }) }),
|
|
768
|
+
z.object({ event: z.literal('event'), data: Loose }),
|
|
769
|
+
z.object({ event: z.literal('replay_complete'), data: z.object({}) }),
|
|
770
|
+
z.object({ event: z.literal('clarify_batch'), data: GatewayClarifyBatchSchema }),
|
|
771
|
+
z.object({ event: z.literal('restarting'), data: z.object({ restarting: z.literal(true) }) }),
|
|
772
|
+
]) },
|
|
773
|
+
'gateway.create': { params: GatewayCreateParamsSchema, result: GatewaySessionResultSchema },
|
|
668
774
|
'gateway.control': { params: GatewayActionParams.extend({ action: z.enum(GATEWAY_ACTIONS) }), result: GatewayActionResult, stream: GatewayActionStream },
|
|
669
775
|
'gateway.restart': { params: GatewayActionParams, result: GatewayActionResult, stream: GatewayActionStream },
|
|
670
776
|
/** TAL-805: the gateway mode of the profile `name` at `profile_home`; the root profile (`is_default`) is the host itself. */
|