@hosty-sdk/app 0.53.0 → 0.55.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.
@@ -0,0 +1,16 @@
1
+ import { type AgentSessionWorkflowTool } from "./agent.js";
2
+ export declare const workflowTools: (selected?: readonly AgentSessionWorkflowTool[]) => {
3
+ name: "task_executor_options" | "task_options" | "task_list" | "task_get" | "task_create" | "task_edit" | "task_action" | "task_result" | "task_fail" | "task_request_input" | "task_adopt" | "task_prepare_executor" | "task_delegate" | "task_wait" | "task_plan" | "task_bind_workspace" | "task_execution_get" | "subagent_profiles" | "subagent_spawn" | "subagent_status" | "subagent_wait" | "profile_list" | "profile_options" | "profile_create" | "profile_edit" | "skill_list" | "skill_discover" | "skill_install";
4
+ description: string;
5
+ inputSchema: {
6
+ type: string;
7
+ properties: Record<string, unknown>;
8
+ required: string[];
9
+ additionalProperties: boolean;
10
+ };
11
+ annotations: {
12
+ readOnlyHint: boolean;
13
+ destructiveHint: boolean;
14
+ openWorldHint: boolean;
15
+ };
16
+ }[];
@@ -0,0 +1,103 @@
1
+ import { AGENT_PROFILE_MANAGEMENT_WORKFLOW_TOOLS, AGENT_SESSION_WORKFLOW_TOOLS, AGENT_SUBAGENT_WORKFLOW_TOOLS } from "./agent.js";
2
+ const object = (properties, required = []) => ({ type: "object", properties, required, additionalProperties: false });
3
+ const id = { type: "string", format: "uuid" }, revision = { type: "integer", minimum: 1 }, counter = { type: "integer", minimum: 0 };
4
+ const text = (maxLength) => ({ type: "string", maxLength });
5
+ const provider = object({ appId: text(200), installationId: text(200), key: text(100), implementationId: { oneOf: [text(128), { type: "null" }] } }, ["appId", "installationId", "key"]);
6
+ const ref = object({ ...provider.properties, id }, ["appId", "installationId", "key", "id"]);
7
+ const refs = { type: "array", items: ref, maxItems: 100 };
8
+ const selection = object({ kind: { enum: ["option", "configuration"] }, id: text(200), revision }, ["kind", "id", "revision"]);
9
+ const resource = object({ kind: { enum: ["app", "workspace", "external"] }, owner: text(200), id: text(2000), label: text(200),
10
+ version: { oneOf: [object({ mode: { const: "live" } }, ["mode"]), object({ mode: { const: "pinned" }, revision: text(200) }, ["mode", "revision"])] } }, ["kind", "owner", "id", "version"]);
11
+ const resources = { type: "array", items: resource, maxItems: 32 };
12
+ const review = object({ mode: { enum: ["none", "owner", "delegator"] } }, ["mode"]);
13
+ const assignee = { oneOf: [{ type: "null" }, object({ kind: { const: "human" }, userId: text(200), name: text(200) }, ["kind", "userId"]),
14
+ object({ kind: { const: "app" }, executor: provider, selection, name: text(200) }, ["kind", "executor"])] };
15
+ const input = object({ title: text(200), markdown: text(32000), assignee, review, resources, parentTaskRef: { oneOf: [ref, { type: "null" }] }, dependsOn: refs }, ["title", "markdown", "assignee", "resources"]);
16
+ const outcome = object({ taskRef: ref, inputRevision: revision, executionId: { oneOf: [id, { type: "null" }] }, resultRevision: revision }, ["taskRef", "inputRevision", "executionId", "resultRevision"]);
17
+ const result = object({ markdown: text(32000), resources }, ["markdown", "resources"]);
18
+ const requestId = { ...id, description: "A fresh globally unique UUID for a new operation. Never reuse sample IDs or IDs from another chat or task. Retain this exact UUID and input only when recovering the same operation." };
19
+ const mutation = { requestId, expectedRevision: revision };
20
+ const writeScope = object({ mode: { enum: ["read", "write", "exclusive"] }, paths: { type: "array", items: text(2000), maxItems: 100 } }, ["mode", "paths"]);
21
+ const optionalText = (maxLength) => ({ oneOf: [text(maxLength), { type: "null" }] });
22
+ const profileFields = {
23
+ name: text(100), description: text(2000), instructions: text(8000), connectionId: optionalText(128),
24
+ model: optionalText(256), reasoningEffort: optionalText(128), skillIds: { type: "array", items: text(64), maxItems: 202 },
25
+ };
26
+ const gitSkillSource = object({ repository: text(2048), ref: text(256), path: text(1024), connectionId: optionalText(200) }, ["repository"]);
27
+ const schemas = {
28
+ "profile-list": object({ profileId: text(200) }),
29
+ "profile-options": object({ connectionId: text(128) }),
30
+ "profile-create": object({ expectedRevision: counter, profile: object(profileFields, ["name"]) }, ["expectedRevision", "profile"]),
31
+ "profile-edit": object({ profileId: text(200), expectedRevision: counter, changes: object(profileFields) }, ["profileId", "expectedRevision", "changes"]),
32
+ "skill-list": object({ includeSourceConnections: { type: "boolean" } }),
33
+ "skill-discover": object({ source: gitSkillSource }, ["source"]),
34
+ "skill-install": object({ source: gitSkillSource, commit: text(64), paths: { type: "array", items: text(1024), minItems: 1, maxItems: 200 } }, ["source", "commit", "paths"]),
35
+ "subagent-profiles": object({}),
36
+ "subagent-spawn": object({ requestId, profileId: text(200), profileRevision: revision, prompt: text(32000), title: text(200) }, ["requestId", "profileId", "profileRevision", "prompt"]),
37
+ "subagent-status": object({ childSessionId: id }),
38
+ "subagent-wait": object({ requestId, childSessionIds: { type: "array", items: id, minItems: 1, maxItems: 100 }, mode: { enum: ["any", "all"] } }, ["requestId", "childSessionIds", "mode"]),
39
+ "task-executor-options": object({}),
40
+ "task-options": object({ executor: provider }),
41
+ "task-list": object({ cursor: text(200), limit: { type: "integer", minimum: 1, maximum: 100 }, status: { enum: ["Draft", "Ready", "InProgress", "Blocked", "Done", "Cancelled"] }, parentTaskRef: ref, rootTaskRef: ref, rootsOnly: { type: "boolean" }, removed: { type: "boolean" } }),
42
+ "task-get": object({ taskId: id }, ["taskId"]),
43
+ "task-create": object({ requestId, expectedGraphRevision: revision, input }, ["requestId", "input"]),
44
+ "task-edit": object({ ...mutation, taskId: id, expectedGraphRevision: revision, input }, ["requestId", "expectedRevision", "taskId", "expectedGraphRevision", "input"]),
45
+ "task-action": object({ ...mutation, taskId: id, action: { enum: ["ready", "draft", "start", "complete", "cancel", "accept", "request_changes", "retry", "disposition", "remove", "restore"] },
46
+ removalScope: { type: "array", minItems: 1, maxItems: 100, items: object({ taskRef: ref, revision }, ["taskRef", "revision"]) },
47
+ result, resultRef: outcome, feedback: text(4000), selection,
48
+ disposition: object({ kind: { enum: ["superseded", "not_required"] }, reason: text(2000), replacementRefs: refs }, ["kind", "reason", "replacementRefs"]) }, ["requestId", "expectedRevision", "taskId", "action"]),
49
+ "task-result": object({ requestId, completed: { const: true, description: "Attest that the requested work and required checks are complete; an unfinished blocker is not success." }, result }, ["requestId", "completed", "result"]),
50
+ "task-fail": object({ requestId, result }, ["requestId", "result"]),
51
+ "task-request-input": object({ requestId, reason: text(2000), questions: { type: "array", minItems: 1, maxItems: 4,
52
+ items: object({ id: text(100), header: text(100), question: text(4000), isOther: { type: "boolean" },
53
+ options: { type: "array", maxItems: 8, items: object({ label: text(500), description: text(2000) }, ["label", "description"]) } }, ["id", "header", "question"]) } }, ["requestId", "reason", "questions"]),
54
+ "task-adopt": object({ requestId, title: text(200), markdown: text(32000), resources, review,
55
+ selectionRevision: counter, contextRevision: counter, autonomyRevision: counter }, ["requestId", "title", "markdown", "resources", "selectionRevision", "contextRevision", "autonomyRevision"]),
56
+ "task-prepare-executor": object({ requestId, directoryRevision: counter, option: object({ id: text(200), revision }, ["id", "revision"]),
57
+ name: text(100), rationale: text(2000), instructions: text(32000), skillIds: { type: "array", items: text(200), maxItems: 64 } }, ["requestId", "directoryRevision"]),
58
+ "task-delegate": object({ requestId, expectedGraphRevision: revision, title: text(200), markdown: text(32000), resources, selection,
59
+ rationale: text(2000), dependsOn: refs, writeScope }, ["requestId", "expectedGraphRevision", "title", "markdown", "resources", "selection", "rationale"]),
60
+ "task-wait": object({ requestId, children: refs, mode: { enum: ["any", "all"] },
61
+ observed: { type: "array", maxItems: 100, items: object({ taskRef: ref, taskRevision: counter }, ["taskRef", "taskRevision"]) } }, ["requestId", "children", "mode"]),
62
+ "task-plan": object({ requestId, expectedRevision: counter, markdown: text(32000) }, ["requestId", "expectedRevision", "markdown"]),
63
+ "task-bind-workspace": object({ requestId, expectedRevision: counter, workspaceId: text(200),
64
+ prepare: object({ appId: text(200), name: text(120), targetBranch: text(200) }, ["appId", "name"]) }, ["requestId", "expectedRevision"]),
65
+ "task-execution-get": object({ cursor: text(200), limit: { type: "integer", minimum: 1, maximum: 100 } }),
66
+ };
67
+ const descriptions = {
68
+ "profile-list": "List saved profile summaries and the directory revision. Supply a profile ID to read its configuration.",
69
+ "profile-options": "List available connections. Supply one connection ID to read its model and reasoning choices.",
70
+ "profile-create": "Create a reusable profile at the current directory revision. Attach installed skills by their stable IDs.",
71
+ "profile-edit": "Edit the named fields of a reusable profile at the current directory revision. Read the stored configuration before editing.",
72
+ "skill-list": "List installed skill packages with stable IDs, descriptions and provenance. Set includeSourceConnections to see the operator's source connection IDs and labels for private Git repositories.",
73
+ "skill-discover": "Read skill candidates from a Git source. Use their descriptions for recommendations and retain the commit and exact paths for installation.",
74
+ "skill-install": "Install the selected package paths into the shared skill library at the commit returned by discovery. Use the returned stable IDs to attach them to profiles.",
75
+ "subagent-profiles": "List saved agent profiles and their current revisions for a child chat.",
76
+ "subagent-spawn": "Open a child chat with the selected profile and prompt. Reuse the request UUID only to recover this exact delegation.",
77
+ "subagent-status": "Read the state and available results of this chat’s children. Supply a child session ID to inspect one.",
78
+ "subagent-wait": "Register a durable wait for the selected direct children. If pending, yield this turn. The parent receives the outcome when the condition is met.",
79
+ "task-executor-options": "Read the owning consumer executor directory: saved profile descriptions, immutable revisions and availability. Use this session-owned tool to choose task performers and recheck setup after a Decision. It never creates profiles.",
80
+ "task-options": "Read the current executor directory: profile descriptions, immutable selection revisions and known availability. Choose existing profiles first.",
81
+ "task-list": "List visible tasks with optional ancestry filters; in an admitted execution, read the current tree.",
82
+ "task-get": "Read a task's current revisions, accepted outcomes and retained attempts before changing it.",
83
+ "task-create": "Create a Draft task, preserving requestId on retry. An admitted execution creates only direct children of its bound task; use task_delegate for armed delegated work.",
84
+ "task-edit": "Replace a stopped Draft's input with current task and graph revisions. Parent is immutable.",
85
+ "task-action": "Apply a common lifecycle action. Review direct children using exact resultRef; request_changes needs feedback. Retry only after confirmed stop, preserving the task and its history. remove/restore require the complete reviewed removalScope of taskRef and revision, preserve history and resources, and are unavailable to task-bound agents.",
86
+ "task-result": "Report successful completion only after required work, child review and verification. Set completed=true to attest success. Never report an unfinished blocker here. Then finish the turn.",
87
+ "task-fail": "Report an unsuccessful terminal attempt with diagnostic evidence, then finish. This leaves the task Blocked, not Done. For missing human input use task_request_input instead so the same attempt can continue.",
88
+ "task-request-input": "Request mandatory human information or setup intervention for this task through Decisions. Supply stable question IDs and a reason; never request secrets. After the durable acknowledgement, yield immediately without task_result or polling. The same task resumes after the answer; recheck setup prerequisites against real state. Use native nonblocking questions only for optional clarification.",
89
+ "task-adopt": "Start task work from chat by creating or recovering one root and adopting this same session. Read session revisions with task_execution_get first. Normal mode requires the owner's Decisions approval; never launch children before admission.",
90
+ "task-prepare-executor": "Choose a saved option at the current directory revision. Only when no profile fits, supply name, rationale, instructions and installed skillIds for a one-off child. It inherits this session's connection/model; no catalog profile is created.",
91
+ "task-delegate": "Create and arm a direct child under this admitted task with the chosen selection and rationale. Dependencies require accepted results; every child has a fresh session and delegator review. Unknown write scope is exclusive.",
92
+ "task-wait": "Register a durable wait for direct child outcomes. Include each observed child taskRevision to avoid replaying known results; task revisions remain monotonic across execution attempts. If pending, yield the turn immediately: Worker parks it and resumes the same context after a relevant result or failure, without polling.",
93
+ "task-plan": "Save a versioned execution plan for this root without altering its admitted objective. Use expectedRevision 0 for the first plan.",
94
+ "task-bind-workspace": "Select or prepare the root's optional authorized workspace. All descendant and retained sessions share its association. This grants no lifecycle or publication authority.",
95
+ "task-execution-get": "Read this session's task binding, root plan, limits and bounded child results. Before adoption, read the current session revisions and mode.",
96
+ };
97
+ /** Fixed business tools only. Their schemas grant no native, Core MCP or source authority. */
98
+ const knownTools = [...AGENT_SESSION_WORKFLOW_TOOLS, ...AGENT_SUBAGENT_WORKFLOW_TOOLS, ...AGENT_PROFILE_MANAGEMENT_WORKFLOW_TOOLS];
99
+ export const workflowTools = (selected = AGENT_SESSION_WORKFLOW_TOOLS) => knownTools.filter(name => selected.includes(name)).map(name => {
100
+ const action = name.replaceAll("_", "-");
101
+ return { name, description: descriptions[action], inputSchema: object(name.startsWith("task_") ? { input: schemas[action], source: provider } : { input: schemas[action] }, ["input"]),
102
+ annotations: { readOnlyHint: ["profile_list", "profile_options", "skill_list", "skill_discover", "subagent_profiles", "subagent_status", "task_executor_options", "task_options", "task_list", "task_get", "task_execution_get"].includes(name), destructiveHint: name === "task_action", openWorldHint: name === "skill_discover" || name === "skill_install" } };
103
+ });
package/dist/agent.d.ts CHANGED
@@ -29,6 +29,8 @@ export declare const AGENT_CAPABILITIES: {
29
29
  readonly approvalMode: "configuration.approval-mode";
30
30
  readonly mcpPolicy: "mcp.policy-update";
31
31
  readonly consumerWorkflow: "workflow.consumer";
32
+ readonly sessionSubagents: "workflow.subagents";
33
+ readonly profileManagement: "workflow.profile-management";
32
34
  };
33
35
  export type AgentCapability = typeof AGENT_CAPABILITIES[keyof typeof AGENT_CAPABILITIES] | (string & {});
34
36
  export type AgentLimits = {
@@ -505,7 +507,10 @@ export type AgentOperation = "capabilities" | "connections.list" | "connections.
505
507
  /** Core transport names for the optional consumer-bound task workflow, without general Core tools. */
506
508
  export declare const AGENT_SESSION_WORKFLOW_TOOLS: readonly ["task_executor_options", "task_options", "task_list", "task_get", "task_create", "task_edit", "task_action", "task_result", "task_fail", "task_request_input", "task_adopt", "task_prepare_executor", "task_delegate", "task_wait", "task_plan", "task_bind_workspace", "task_execution_get"];
507
509
  /** Optional business workflow owned by the invoking consumer, separate from native execution. */
508
- export type AgentSessionWorkflowTool = typeof AGENT_SESSION_WORKFLOW_TOOLS[number];
510
+ export declare const AGENT_SUBAGENT_WORKFLOW_TOOLS: readonly ["subagent_profiles", "subagent_spawn", "subagent_status", "subagent_wait"];
511
+ /** Profile and skill management is separately selected for an operator's conversation. */
512
+ export declare const AGENT_PROFILE_MANAGEMENT_WORKFLOW_TOOLS: readonly ["profile_list", "profile_options", "profile_create", "profile_edit", "skill_list", "skill_discover", "skill_install"];
513
+ export type AgentSessionWorkflowTool = typeof AGENT_SESSION_WORKFLOW_TOOLS[number] | typeof AGENT_SUBAGENT_WORKFLOW_TOOLS[number] | typeof AGENT_PROFILE_MANAGEMENT_WORKFLOW_TOOLS[number];
509
514
  export type AgentSessionWorkflowBinding = {
510
515
  executor: ProviderRef;
511
516
  sessionId: string;
@@ -553,6 +558,7 @@ export type AgentOperationAuthorization = {
553
558
  token: string;
554
559
  expiresAt: string;
555
560
  admissionRef?: string;
561
+ supportedWorkflowCapabilities?: string[];
556
562
  };
557
563
  export type AgentAuthorizer = (request: AgentAuthorizationRequest, signal?: AbortSignal) => Promise<AgentOperationAuthorization>;
558
564
  /** Persist this value before a mutation; body is the exact UTF-8 JSON string used on every retry. */
package/dist/agent.js CHANGED
@@ -10,7 +10,8 @@ export const AGENT_CAPABILITIES = {
10
10
  barrier: "runs.barrier", reconcile: "runs.reconcile", retire: "runs.retire", liveConfigure: "runs.live-configure",
11
11
  predictions: "predictions", connectionUsage: "connections.usage",
12
12
  approvalMode: "configuration.approval-mode",
13
- mcpPolicy: "mcp.policy-update", consumerWorkflow: "workflow.consumer",
13
+ mcpPolicy: "mcp.policy-update", consumerWorkflow: "workflow.consumer", sessionSubagents: "workflow.subagents",
14
+ profileManagement: "workflow.profile-management",
14
15
  };
15
16
  export class AgentApiError extends Error {
16
17
  code;
@@ -34,3 +35,9 @@ export const AGENT_SESSION_WORKFLOW_TOOLS = [
34
35
  "task_result", "task_fail", "task_request_input", "task_adopt", "task_prepare_executor", "task_delegate",
35
36
  "task_wait", "task_plan", "task_bind_workspace", "task_execution_get",
36
37
  ];
38
+ /** Optional business workflow owned by the invoking consumer, separate from native execution. */
39
+ export const AGENT_SUBAGENT_WORKFLOW_TOOLS = ["subagent_profiles", "subagent_spawn", "subagent_status", "subagent_wait"];
40
+ /** Profile and skill management is separately selected for an operator's conversation. */
41
+ export const AGENT_PROFILE_MANAGEMENT_WORKFLOW_TOOLS = [
42
+ "profile_list", "profile_options", "profile_create", "profile_edit", "skill_list", "skill_discover", "skill_install",
43
+ ];
@@ -191,7 +191,7 @@ export class ProviderClient {
191
191
  const execution = invocation.agentExecution;
192
192
  const identity = (value) => typeof value === "string" && value.length > 0 && value.length <= 512
193
193
  && value.trim() === value && !/[\u0000-\u001f\u007f]/.test(value);
194
- if (request.operation === "session.workflow" && (kind !== "task-executor" || !execution)
194
+ if (request.operation === "session.workflow" && ((kind !== "task-executor" && kind !== "agent-sessions") || !execution)
195
195
  || execution && (!identity(execution.sessionId) || !identity(execution.runId)
196
196
  || !execution.provider || !identity(execution.provider.appId) || !identity(execution.provider.installationId) || !identity(execution.provider.key)))
197
197
  throw new ProviderError("token_invalid", "Core returned an invalid admitted agent workflow binding.", 401);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hosty-sdk/app",
3
- "version": "0.53.0",
3
+ "version": "0.55.0",
4
4
  "description": "Hosty app auth: session state machine, recovery bridge, Core revalidation, and the embedder responder.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
@@ -157,6 +157,10 @@
157
157
  "types": "./dist/agent.d.ts",
158
158
  "default": "./dist/agent.js"
159
159
  },
160
+ "./agent/workflow-tools": {
161
+ "types": "./dist/agent-workflow-tools.d.ts",
162
+ "default": "./dist/agent-workflow-tools.js"
163
+ },
160
164
  "./agent/client": {
161
165
  "types": "./dist/agent-client.d.ts",
162
166
  "default": "./dist/agent-client.js"