@hosty-sdk/app 0.51.0 → 0.53.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/README.md +10 -0
- package/dist/agent-client.js +2 -1
- package/dist/agent-schemas.js +3 -2
- package/dist/agent-server.js +4 -2
- package/dist/agent-sessions.d.ts +1 -0
- package/dist/agent.d.ts +5 -0
- package/dist/agent.js +1 -1
- package/dist/assistant.d.ts +1 -0
- package/dist/assistant.js +2 -1
- package/dist/providers-server.d.ts +15 -8
- package/dist/providers-server.js +39 -2
- package/dist/providers.d.ts +26 -1
- package/dist/tasks-server.js +2 -1
- package/dist/tasks.d.ts +1 -0
- package/dist/tasks.js +1 -1
- package/package.json +1 -1
- package/schemas/agent-event-v1.schema.json +39 -0
- package/schemas/agent-v1.fixtures.json +21 -0
- package/schemas/agent-v1.openapi.json +40 -1
package/README.md
CHANGED
|
@@ -303,6 +303,16 @@ their existing behavior. Validate the selected provider's duration/byte capabili
|
|
|
303
303
|
credentials and the acting user's access. It does not expose general agent execution.
|
|
304
304
|
See [Provider consumption](../../docs/features/provider-consumption/feature.md) for the full contract.
|
|
305
305
|
|
|
306
|
+
### Named implementations and read-aloud
|
|
307
|
+
|
|
308
|
+
Call `listImplementations("speech-to-text")` or `listImplementations("text-to-speech")` to list both
|
|
309
|
+
static and named entries. Keep the installation, key and implementation ID with each choice. The
|
|
310
|
+
`displayName` is the current human-readable label. Pass the selection to `speechCapabilities`
|
|
311
|
+
and `transcribe`, or to `textToSpeechCapabilities` and `synthesize(selected, { text }, signal)`.
|
|
312
|
+
Synthesis returns a streaming fetch Response. Abort or cancel its body to stop the request.
|
|
313
|
+
The provider backend publishes with `publishImplementations` and resolves the exact implementation
|
|
314
|
+
from `validate` on each request. See the [app manifest guide](../../skills/hosty-app-skill/references/app-manifest.md#named-provider-implementations).
|
|
315
|
+
|
|
306
316
|
## Tasks And Execution Providers
|
|
307
317
|
|
|
308
318
|
Core 0.159.0 and SDK 0.36.0 support independent `tasks` and `task-executor` categories. Request
|
package/dist/agent-client.js
CHANGED
|
@@ -8,7 +8,8 @@ const segment = (id) => {
|
|
|
8
8
|
throw new AgentApiError("invalid_input", "A bounded opaque resource ID is required.", 400);
|
|
9
9
|
return encodeURIComponent(id);
|
|
10
10
|
};
|
|
11
|
-
const sameProvider = (a, b) => a.appId === b.appId && a.installationId === b.installationId && a.key === b.key
|
|
11
|
+
const sameProvider = (a, b) => a.appId === b.appId && a.installationId === b.installationId && a.key === b.key
|
|
12
|
+
&& (a.implementationId ?? null) === (b.implementationId ?? null);
|
|
12
13
|
/** Preparing once lets an application persist exactly the bytes it must reuse after an uncertain delivery. */
|
|
13
14
|
export function prepareAgentRequest(operation, method, path, input, metadata = {}) {
|
|
14
15
|
const body = JSON.stringify(input);
|
package/dist/agent-schemas.js
CHANGED
|
@@ -22,7 +22,7 @@ const historyObservation = {
|
|
|
22
22
|
object({ kind: { const: "event" }, event: ref("Event"), cursor: text(8192) })] },
|
|
23
23
|
};
|
|
24
24
|
export const AGENT_SCHEMAS = {
|
|
25
|
-
ProviderRef: object(refProperties),
|
|
25
|
+
ProviderRef: object({ ...refProperties, implementationId: { anyOf: [text(128), { type: "null" }] } }, Object.keys(refProperties)),
|
|
26
26
|
QualifiedRef: object({ provider: ref("ProviderRef"), id }),
|
|
27
27
|
Instruction: object({ id: text(128), text: { type: "string", maxLength: 262144 } }),
|
|
28
28
|
Skill: object({ skillId: digest, expectedDigest: digest }, ["skillId"]),
|
|
@@ -52,6 +52,7 @@ export const AGENT_SCHEMAS = {
|
|
|
52
52
|
object({ ...baseControl, command: { const: "park" }, decisionId: id, decisionRevision: revision, reason: text(8192) }, [...Object.keys(baseControl), "command", "decisionId", "decisionRevision"]),
|
|
53
53
|
object({ ...baseControl, command: { const: "barrier" }, barrierId: id, kind: { enum: ["task_adoption", "child_wait", "source_rebind", "limits", "human_input"] }, generation: revision, acknowledgedSequence: sequence, snapshot: text(8192) }, [...Object.keys(baseControl), "command", "barrierId", "kind", "generation", "acknowledgedSequence"]),
|
|
54
54
|
object({ ...baseControl, command: { const: "reconcile" }, stopped: { const: true }, evidence: text(8192) }, [...Object.keys(baseControl), "command", "stopped"]),
|
|
55
|
+
object({ ...baseControl, command: { const: "retire" } }),
|
|
55
56
|
object({ ...baseControl, command: { const: "liveConfigure" }, mcp: ref("McpSelection") }),
|
|
56
57
|
object({ ...baseControl, command: { const: "mcpPolicy" }, mcp: ref("McpSelection") }),
|
|
57
58
|
object({ ...baseControl, command: { const: "predictions" }, enabled: boolean }),
|
|
@@ -163,7 +164,7 @@ export const AGENT_OPENAPI = {
|
|
|
163
164
|
responses: { ...errors, "200": { description: "Persisted agent event stream.", content: { "text/event-stream": { schema: { type: "string" }, "x-event-schema": ref("Event") } } } } } },
|
|
164
165
|
"/runs/{runId}/responses": { post: operation("runs.respond", "ControlReceipt", "ResponseInput", ["runId"], [200, 202]) },
|
|
165
166
|
"/runs/{runId}/cancel": { post: operation("runs.cancel", "ControlReceipt", "CancelInput", ["runId"], [200, 202]) },
|
|
166
|
-
"/runs/{runId}/controls": { post: { ...operation("runs.control", "ControlReceipt", "ControlInput", ["runId"], [200, 202]), description: "Optional controls require their advertised capabilities. Reconcile input is an attestation, never proof of actual native exit." } },
|
|
167
|
+
"/runs/{runId}/controls": { post: { ...operation("runs.control", "ControlReceipt", "ControlInput", ["runId"], [200, 202]), description: "Optional controls require their advertised capabilities. Reconcile input is an attestation, never proof of actual native exit. Retirement requires provider-owned evidence of native process exit. Its applied receipt records retirement of the exact run and preserves unresolved tool outcomes." } },
|
|
167
168
|
"/runs/{runId}/controls/{requestId}": { get: operation("runs.controls.read", "ControlReceipt", undefined, ["runId", "requestId"]) },
|
|
168
169
|
}, components: { securitySchemes: { installationHistory: { type: "http", scheme: "bearer", description: "Core-issued installation history credential." }, coreOperation: { type: "http", scheme: "bearer", description: "Fresh Core exact-operation credential, never the caller's service/user token." } }, schemas: AGENT_SCHEMAS },
|
|
169
170
|
};
|
package/dist/agent-server.js
CHANGED
|
@@ -20,7 +20,9 @@ function strings(value, max = 128, width = 256) {
|
|
|
20
20
|
fail("Selections require distinct bounded strings.");
|
|
21
21
|
}
|
|
22
22
|
function provider(value) {
|
|
23
|
-
shape(value, ["appId", "installationId", "key"], "provider reference");
|
|
23
|
+
shape(value, ["appId", "installationId", "key", "implementationId"], "provider reference");
|
|
24
|
+
if (value.implementationId != null && !bounded(value.implementationId, 128))
|
|
25
|
+
fail("Invalid named implementation ID.");
|
|
24
26
|
if (![value.appId, value.installationId, value.key].every(v => bounded(v)))
|
|
25
27
|
fail("An installation-qualified provider reference is required.");
|
|
26
28
|
}
|
|
@@ -259,7 +261,7 @@ export function validateAgentCancelInput(value) {
|
|
|
259
261
|
export function validateAgentRunControlInput(value) {
|
|
260
262
|
if (!object(value))
|
|
261
263
|
fail("An execution control is required.");
|
|
262
|
-
const fields = { park: ["decisionId", "decisionRevision", "reason"], barrier: ["barrierId", "kind", "generation", "acknowledgedSequence", "snapshot"], reconcile: ["stopped", "evidence"], liveConfigure: ["mcp"], mcpPolicy: ["mcp"], predictions: ["enabled"] };
|
|
264
|
+
const fields = { park: ["decisionId", "decisionRevision", "reason"], barrier: ["barrierId", "kind", "generation", "acknowledgedSequence", "snapshot"], reconcile: ["stopped", "evidence"], retire: [], liveConfigure: ["mcp"], mcpPolicy: ["mcp"], predictions: ["enabled"] };
|
|
263
265
|
if (typeof value.command !== "string" || !fields[value.command])
|
|
264
266
|
fail("Unsupported execution control.", 422, "unsupported_capability");
|
|
265
267
|
shape(value, ["requestId", "expectedGeneration", "expectedRevision", "command", ...fields[value.command]], "execution control");
|
package/dist/agent-sessions.d.ts
CHANGED
package/dist/agent.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const AGENT_CAPABILITIES: {
|
|
|
22
22
|
readonly park: "runs.park";
|
|
23
23
|
readonly barrier: "runs.barrier";
|
|
24
24
|
readonly reconcile: "runs.reconcile";
|
|
25
|
+
readonly retire: "runs.retire";
|
|
25
26
|
readonly liveConfigure: "runs.live-configure";
|
|
26
27
|
readonly predictions: "predictions";
|
|
27
28
|
readonly connectionUsage: "connections.usage";
|
|
@@ -417,6 +418,10 @@ export type AgentRunControlInput = {
|
|
|
417
418
|
command: "reconcile";
|
|
418
419
|
stopped: true;
|
|
419
420
|
evidence?: string;
|
|
421
|
+
}
|
|
422
|
+
/** Requires provider-owned exit evidence. Applied retirement preserves uncertain tool outcomes. */
|
|
423
|
+
| {
|
|
424
|
+
command: "retire";
|
|
420
425
|
} | {
|
|
421
426
|
command: "liveConfigure";
|
|
422
427
|
mcp: AgentMcpSelection;
|
package/dist/agent.js
CHANGED
|
@@ -7,7 +7,7 @@ export const AGENT_CAPABILITIES = {
|
|
|
7
7
|
noNativeTools: "native-tools.none", skills: "skills.catalog", exclusiveSkills: "skills.exclusive-selection",
|
|
8
8
|
coreMcp: "mcp.core", externalMcp: "mcp.external", modelChange: "model.change-on-resume",
|
|
9
9
|
nextTurnDecisions: "decisions.next-turn", nativeSubagents: "subagents.native", park: "runs.park",
|
|
10
|
-
barrier: "runs.barrier", reconcile: "runs.reconcile", liveConfigure: "runs.live-configure",
|
|
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
13
|
mcpPolicy: "mcp.policy-update", consumerWorkflow: "workflow.consumer",
|
package/dist/assistant.d.ts
CHANGED
package/dist/assistant.js
CHANGED
|
@@ -48,7 +48,8 @@ export function resolveAssistantPresentation(provider, result, options) {
|
|
|
48
48
|
const expected = options.expectedProvider;
|
|
49
49
|
if (!provider.installationId)
|
|
50
50
|
throw new AssistantError("unsupported_core", "Update Core to identify assistant installations.", 409);
|
|
51
|
-
if (provider.appId !== expected.appId || provider.key !== expected.key || provider.installationId !== expected.installationId
|
|
51
|
+
if (provider.appId !== expected.appId || provider.key !== expected.key || provider.installationId !== expected.installationId
|
|
52
|
+
|| (provider.implementationId ?? null) !== (expected.implementationId ?? null))
|
|
52
53
|
throw new AssistantError("provider_changed", "The original assistant installation is no longer available.", 409);
|
|
53
54
|
try {
|
|
54
55
|
resolveAssistantDestination(result.open, provider.uiSurfaces ?? []);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HistoryExportGrant, HistoryExportAcknowledge, HistoryExportQuery, HistoryExportSnapshot, HistoryChangePage } from "./history.js";
|
|
2
2
|
import { AssistantClient } from "@hosty-sdk/app/assistant";
|
|
3
|
-
import { type AppPermissionState, type ProviderDescriptor, type ProviderInvocation, type ProviderKind, type MediatedProviderInvocation, type MediatedProviderRequest, type SpeechCapabilities, type SpeechResult, type TranslationRequest, type TranslationResult, type TranslationCapabilities } from "@hosty-sdk/app/providers";
|
|
3
|
+
import { type AppPermissionState, type ProviderDescriptor, type ProviderInvocation, type ProviderKind, type MediatedProviderInvocation, type MediatedProviderRequest, type SpeechCapabilities, type SpeechResult, type TranslationRequest, type TranslationResult, type TranslationCapabilities, type ProviderSelection, type ProviderImplementationSnapshot, type TextToSpeechCapabilities, type SpeechSynthesisRequest } from "@hosty-sdk/app/providers";
|
|
4
4
|
export type ProviderServerOptions = {
|
|
5
5
|
appId?: string;
|
|
6
6
|
coreOrigin?: string;
|
|
@@ -32,25 +32,32 @@ export declare class ProviderClient {
|
|
|
32
32
|
historyExportChanges(input: HistoryExportQuery, signal?: AbortSignal): Promise<HistoryChangePage>;
|
|
33
33
|
permissions(signal?: AbortSignal): Promise<AppPermissionState>;
|
|
34
34
|
list(kind: ProviderKind, signal?: AbortSignal): Promise<ProviderDescriptor[]>;
|
|
35
|
+
/** Discover static and named implementations. Retain the complete selection across calls. */
|
|
36
|
+
listImplementations(kind: ProviderKind, signal?: AbortSignal): Promise<ProviderDescriptor[]>;
|
|
37
|
+
/** Replace this installation's complete snapshot for one reviewed interface entry. */
|
|
38
|
+
publishImplementations(kind: ProviderKind, key: string, snapshot: ProviderImplementationSnapshot, signal?: AbortSignal): Promise<{
|
|
39
|
+
revision: number;
|
|
40
|
+
}>;
|
|
35
41
|
private connect;
|
|
36
|
-
speechCapabilities(provider:
|
|
37
|
-
transcribe(provider:
|
|
42
|
+
speechCapabilities(provider: ProviderSelection, signal?: AbortSignal): Promise<SpeechCapabilities>;
|
|
43
|
+
transcribe(provider: ProviderSelection, audio: Blob, options?: {
|
|
38
44
|
language?: string;
|
|
39
45
|
signal?: AbortSignal; /** Total deadline, 1–930000 ms; defaults to five minutes. */
|
|
40
46
|
timeoutMs?: number;
|
|
41
47
|
}): Promise<SpeechResult>;
|
|
42
|
-
|
|
48
|
+
textToSpeechCapabilities(provider: ProviderSelection, signal?: AbortSignal): Promise<TextToSpeechCapabilities>;
|
|
49
|
+
/** Stream 24 kHz mono signed 16-bit little-endian PCM. Cancel the signal or response body to stop. */
|
|
50
|
+
synthesize(provider: ProviderSelection, input: SpeechSynthesisRequest, signal?: AbortSignal): Promise<Response>;
|
|
51
|
+
translationCapabilities(provider: ProviderSelection, signal?: AbortSignal, options?: {
|
|
43
52
|
connection: {
|
|
44
53
|
id: string;
|
|
45
54
|
revision: string;
|
|
46
55
|
};
|
|
47
56
|
}): Promise<TranslationCapabilities>;
|
|
48
57
|
/** Translate text or Markdown through the explicitly selected provider; never retries or falls back. */
|
|
49
|
-
translate(provider:
|
|
58
|
+
translate(provider: ProviderSelection, input: TranslationRequest, signal?: AbortSignal): Promise<TranslationResult>;
|
|
50
59
|
/** User-attributed requests preserve the assistant's existing handoff and dispatch policy. */
|
|
51
|
-
assistant(provider:
|
|
52
|
-
installationId?: string | null;
|
|
53
|
-
}, userToken: () => Promise<string>): Promise<AssistantClient>;
|
|
60
|
+
assistant(provider: ProviderSelection, userToken: () => Promise<string>): Promise<AssistantClient>;
|
|
54
61
|
/** Bounded task protocol transport. The selected installation is checked on every operation. */
|
|
55
62
|
taskRequest<T>(provider: import("./tasks.js").TaskProviderRef, kind: "tasks" | "task-executor", route: string, method: string, input?: unknown, userToken?: () => Promise<string>, signal?: AbortSignal): Promise<T>;
|
|
56
63
|
/** Validate an operation-bound Core credential against this exact request. Source ACL checks remain mandatory. */
|
package/dist/providers-server.js
CHANGED
|
@@ -48,12 +48,25 @@ export class ProviderClient {
|
|
|
48
48
|
async list(kind, signal) {
|
|
49
49
|
return (await this.coreRequest(`/providers/${kind}`, undefined, signal)).providers;
|
|
50
50
|
}
|
|
51
|
+
/** Discover static and named implementations. Retain the complete selection across calls. */
|
|
52
|
+
async listImplementations(kind, signal) {
|
|
53
|
+
return (await this.coreRequest(`/providers/${kind}?named=true`, undefined, signal)).providers;
|
|
54
|
+
}
|
|
55
|
+
/** Replace this installation's complete snapshot for one reviewed interface entry. */
|
|
56
|
+
publishImplementations(kind, key, snapshot, signal) {
|
|
57
|
+
return this.coreRequest(`/providers/${kind}/implementations`, { key, revision: snapshot.revision, implementations: snapshot.implementations }, signal);
|
|
58
|
+
}
|
|
51
59
|
async connect(provider, signal, userToken) {
|
|
52
|
-
|
|
60
|
+
if (provider.implementationId != null && !provider.installationId)
|
|
61
|
+
throw new ProviderError("provider_selection_invalid", "A named implementation requires an installation.", 400);
|
|
62
|
+
const issued = await this.coreRequest(`/providers/${provider.kind}/token`, { providerAppId: provider.appId, key: provider.key, installationId: provider.installationId, implementationId: provider.implementationId }, signal, userToken);
|
|
63
|
+
if (issued.provider.appId !== provider.appId || issued.provider.kind !== provider.kind || issued.provider.key !== provider.key
|
|
64
|
+
|| (issued.provider.implementationId ?? null) !== (provider.implementationId ?? null))
|
|
65
|
+
throw new ProviderError("provider_changed", "The selected provider binding changed.", 409);
|
|
53
66
|
if (issued.provider.version !== 1 || !issued.provider.url)
|
|
54
67
|
throw new ProviderError("provider_incompatible", "This provider does not support interface version 1.", 409);
|
|
55
68
|
if (provider.installationId && issued.provider.installationId !== provider.installationId)
|
|
56
|
-
throw new ProviderError("provider_changed", "The selected
|
|
69
|
+
throw new ProviderError("provider_changed", "The selected provider installation changed. Select it again.", 409);
|
|
57
70
|
const url = new URL(issued.provider.url);
|
|
58
71
|
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password)
|
|
59
72
|
throw new ProviderError("provider_url_invalid", "Invalid provider endpoint.", 409);
|
|
@@ -92,6 +105,30 @@ export class ProviderClient {
|
|
|
92
105
|
await dispatcher.close();
|
|
93
106
|
}
|
|
94
107
|
}
|
|
108
|
+
async textToSpeechCapabilities(provider, signal) {
|
|
109
|
+
const binding = await this.connect({ ...provider, kind: "text-to-speech" }, signal);
|
|
110
|
+
const deadline = AbortSignal.timeout(10_000);
|
|
111
|
+
return read(await fetch(`${binding.url}/capabilities`, { redirect: "error", signal: signal ? AbortSignal.any([signal, deadline]) : deadline,
|
|
112
|
+
headers: { authorization: `Bearer ${binding.token}` } }));
|
|
113
|
+
}
|
|
114
|
+
/** Stream 24 kHz mono signed 16-bit little-endian PCM. Cancel the signal or response body to stop. */
|
|
115
|
+
async synthesize(provider, input, signal) {
|
|
116
|
+
if (typeof input.text !== "string" || !input.text.trim() || input.text.length > 4000)
|
|
117
|
+
throw new ProviderError("speech_text_invalid", "Provide between 1 and 4000 UTF-16 code units of text.", 400);
|
|
118
|
+
const timeout = AbortSignal.timeout(300_000);
|
|
119
|
+
const deadline = signal ? AbortSignal.any([signal, timeout]) : timeout;
|
|
120
|
+
const binding = await this.connect({ ...provider, kind: "text-to-speech" }, deadline);
|
|
121
|
+
const response = await fetch(`${binding.url}/speech`, { method: "POST", redirect: "error", signal: deadline,
|
|
122
|
+
headers: { authorization: `Bearer ${binding.token}`, "content-type": "application/json", accept: "audio/pcm" },
|
|
123
|
+
body: JSON.stringify({ text: input.text }) });
|
|
124
|
+
if (!response.ok)
|
|
125
|
+
await read(response);
|
|
126
|
+
if (!response.body || !/^audio\/pcm\s*;\s*rate=24000\s*$/i.test(response.headers.get("content-type") ?? "")) {
|
|
127
|
+
await response.body?.cancel();
|
|
128
|
+
throw new ProviderError("provider_response_invalid", "Expected a 24 kHz PCM audio stream.", 502);
|
|
129
|
+
}
|
|
130
|
+
return response;
|
|
131
|
+
}
|
|
95
132
|
async translationCapabilities(provider, signal, options) {
|
|
96
133
|
const connection = options?.connection;
|
|
97
134
|
if (options && (!connection || typeof connection.id !== "string" || !connection.id || connection.id.length > 200
|
package/dist/providers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Provider categories supported by Core. Task execution does not expose model/profile configuration. */
|
|
2
|
-
export type ProviderKind = "agent" | "speech-to-text" | "assistant" | "translation" | "tasks" | "task-executor" | "conversation-history" | "agent-sessions";
|
|
2
|
+
export type ProviderKind = "agent" | "speech-to-text" | "text-to-speech" | "assistant" | "translation" | "tasks" | "task-executor" | "conversation-history" | "agent-sessions";
|
|
3
3
|
export type ProviderDescriptor = {
|
|
4
4
|
appId: string;
|
|
5
5
|
displayName: string;
|
|
@@ -19,6 +19,19 @@ export type ProviderDescriptor = {
|
|
|
19
19
|
}> | null;
|
|
20
20
|
/** Opaque Core installation identity; compare for equality, never parse. */
|
|
21
21
|
installationId?: string | null;
|
|
22
|
+
/** Opaque provider-owned ID, scoped to this installation, kind and declared key. */
|
|
23
|
+
implementationId?: string | null;
|
|
24
|
+
implementationName?: string | null;
|
|
25
|
+
};
|
|
26
|
+
export type ProviderSelection = Pick<ProviderDescriptor, "appId" | "key" | "installationId" | "implementationId">;
|
|
27
|
+
export type ProviderImplementation = {
|
|
28
|
+
id: string;
|
|
29
|
+
displayName: string;
|
|
30
|
+
available: boolean;
|
|
31
|
+
};
|
|
32
|
+
export type ProviderImplementationSnapshot = {
|
|
33
|
+
revision: number;
|
|
34
|
+
implementations: ProviderImplementation[];
|
|
22
35
|
};
|
|
23
36
|
export type AppPermissionState = {
|
|
24
37
|
required: string[];
|
|
@@ -35,6 +48,7 @@ export type ProviderInvocation = {
|
|
|
35
48
|
hostRole: string | null;
|
|
36
49
|
kind: ProviderKind;
|
|
37
50
|
key: string;
|
|
51
|
+
implementationId?: string | null;
|
|
38
52
|
};
|
|
39
53
|
/** Core-mediated v2 invocations carry the original principal; direct clients have no app identity. */
|
|
40
54
|
export type MediatedProviderInvocation = {
|
|
@@ -49,6 +63,7 @@ export type MediatedProviderInvocation = {
|
|
|
49
63
|
principalId: string;
|
|
50
64
|
kind: ProviderKind;
|
|
51
65
|
key: string;
|
|
66
|
+
implementationId?: string | null;
|
|
52
67
|
operation: string;
|
|
53
68
|
resourceIds: string[];
|
|
54
69
|
taskDispatch?: TaskDispatchRef | null;
|
|
@@ -84,6 +99,16 @@ export type SpeechCapabilities = {
|
|
|
84
99
|
backend: string;
|
|
85
100
|
ready: boolean;
|
|
86
101
|
};
|
|
102
|
+
export type TextToSpeechCapabilities = {
|
|
103
|
+
version: 1;
|
|
104
|
+
mediaTypes: string[];
|
|
105
|
+
maxCharacters: number;
|
|
106
|
+
backend: string;
|
|
107
|
+
ready: boolean;
|
|
108
|
+
};
|
|
109
|
+
export type SpeechSynthesisRequest = {
|
|
110
|
+
text: string;
|
|
111
|
+
};
|
|
87
112
|
export type TranslationRequest = {
|
|
88
113
|
text: string;
|
|
89
114
|
targetLanguage: string;
|
package/dist/tasks-server.js
CHANGED
|
@@ -13,7 +13,8 @@ export class TaskClient {
|
|
|
13
13
|
return this.providers.taskRequest(this.provider, "tasks", route, method, input, this.userToken, signal);
|
|
14
14
|
}
|
|
15
15
|
id(ref) {
|
|
16
|
-
if (ref.appId !== this.provider.appId || ref.installationId !== this.provider.installationId || ref.key !== this.provider.key
|
|
16
|
+
if (ref.appId !== this.provider.appId || ref.installationId !== this.provider.installationId || ref.key !== this.provider.key
|
|
17
|
+
|| (ref.implementationId ?? null) !== (this.provider.implementationId ?? null))
|
|
17
18
|
throw new Error("The task belongs to another provider installation.");
|
|
18
19
|
return encodeURIComponent(ref.id);
|
|
19
20
|
}
|
package/dist/tasks.d.ts
CHANGED
package/dist/tasks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export const taskStatuses = ["Draft", "Ready", "InProgress", "Blocked", "Done", "Cancelled"];
|
|
2
2
|
export const taskExecutionTerminal = (state) => ["completed", "failed", "cancelled", "interrupted"].includes(state);
|
|
3
3
|
/** Collision-free opaque reference for cross-provider links and filters; grants no task access. */
|
|
4
|
-
export const taskReferenceKey = (ref) => JSON.stringify([ref.appId, ref.installationId, ref.key, ref.id]);
|
|
4
|
+
export const taskReferenceKey = (ref) => JSON.stringify(ref.implementationId ? [ref.appId, ref.installationId, ref.key, ref.id, ref.implementationId] : [ref.appId, ref.installationId, ref.key, ref.id]);
|
package/package.json
CHANGED
|
@@ -20,6 +20,18 @@
|
|
|
20
20
|
"type": "string",
|
|
21
21
|
"minLength": 1,
|
|
22
22
|
"maxLength": 256
|
|
23
|
+
},
|
|
24
|
+
"implementationId": {
|
|
25
|
+
"anyOf": [
|
|
26
|
+
{
|
|
27
|
+
"type": "string",
|
|
28
|
+
"minLength": 1,
|
|
29
|
+
"maxLength": 128
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "null"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
23
35
|
}
|
|
24
36
|
},
|
|
25
37
|
"required": [
|
|
@@ -1008,6 +1020,33 @@
|
|
|
1008
1020
|
],
|
|
1009
1021
|
"additionalProperties": false
|
|
1010
1022
|
},
|
|
1023
|
+
{
|
|
1024
|
+
"type": "object",
|
|
1025
|
+
"properties": {
|
|
1026
|
+
"requestId": {
|
|
1027
|
+
"type": "string",
|
|
1028
|
+
"format": "uuid"
|
|
1029
|
+
},
|
|
1030
|
+
"expectedGeneration": {
|
|
1031
|
+
"type": "string",
|
|
1032
|
+
"format": "uuid"
|
|
1033
|
+
},
|
|
1034
|
+
"expectedRevision": {
|
|
1035
|
+
"type": "string",
|
|
1036
|
+
"pattern": "^[1-9][0-9]{0,39}$"
|
|
1037
|
+
},
|
|
1038
|
+
"command": {
|
|
1039
|
+
"const": "retire"
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
"required": [
|
|
1043
|
+
"requestId",
|
|
1044
|
+
"expectedGeneration",
|
|
1045
|
+
"expectedRevision",
|
|
1046
|
+
"command"
|
|
1047
|
+
],
|
|
1048
|
+
"additionalProperties": false
|
|
1049
|
+
},
|
|
1011
1050
|
{
|
|
1012
1051
|
"type": "object",
|
|
1013
1052
|
"properties": {
|
|
@@ -84,6 +84,16 @@
|
|
|
84
84
|
"acknowledgedSequence": "8"
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
+
{
|
|
88
|
+
"method": "POST",
|
|
89
|
+
"path": "/runs/22222222-2222-4222-8222-222222222222/controls",
|
|
90
|
+
"body": {
|
|
91
|
+
"requestId": "44444444-4444-4444-8444-444444444444",
|
|
92
|
+
"expectedGeneration": "33333333-3333-4333-8333-333333333333",
|
|
93
|
+
"expectedRevision": "1",
|
|
94
|
+
"command": "retire"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
87
97
|
{
|
|
88
98
|
"method": "PUT",
|
|
89
99
|
"path": "/attachments/44444444-4444-4444-8444-444444444444/chunks/0",
|
|
@@ -161,6 +171,17 @@
|
|
|
161
171
|
"output": "fabricated"
|
|
162
172
|
}
|
|
163
173
|
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"method": "POST",
|
|
177
|
+
"path": "/runs/22222222-2222-4222-8222-222222222222/controls",
|
|
178
|
+
"body": {
|
|
179
|
+
"requestId": "44444444-4444-4444-8444-444444444444",
|
|
180
|
+
"expectedGeneration": "33333333-3333-4333-8333-333333333333",
|
|
181
|
+
"expectedRevision": "1",
|
|
182
|
+
"command": "retire",
|
|
183
|
+
"stopped": true
|
|
184
|
+
}
|
|
164
185
|
}
|
|
165
186
|
]
|
|
166
187
|
}
|
|
@@ -2945,7 +2945,7 @@
|
|
|
2945
2945
|
}
|
|
2946
2946
|
}
|
|
2947
2947
|
},
|
|
2948
|
-
"description": "Optional controls require their advertised capabilities. Reconcile input is an attestation, never proof of actual native exit."
|
|
2948
|
+
"description": "Optional controls require their advertised capabilities. Reconcile input is an attestation, never proof of actual native exit. Retirement requires provider-owned evidence of native process exit. Its applied receipt records retirement of the exact run and preserves unresolved tool outcomes."
|
|
2949
2949
|
}
|
|
2950
2950
|
},
|
|
2951
2951
|
"/runs/{runId}/controls/{requestId}": {
|
|
@@ -3129,6 +3129,18 @@
|
|
|
3129
3129
|
"type": "string",
|
|
3130
3130
|
"minLength": 1,
|
|
3131
3131
|
"maxLength": 256
|
|
3132
|
+
},
|
|
3133
|
+
"implementationId": {
|
|
3134
|
+
"anyOf": [
|
|
3135
|
+
{
|
|
3136
|
+
"type": "string",
|
|
3137
|
+
"minLength": 1,
|
|
3138
|
+
"maxLength": 128
|
|
3139
|
+
},
|
|
3140
|
+
{
|
|
3141
|
+
"type": "null"
|
|
3142
|
+
}
|
|
3143
|
+
]
|
|
3132
3144
|
}
|
|
3133
3145
|
},
|
|
3134
3146
|
"required": [
|
|
@@ -4117,6 +4129,33 @@
|
|
|
4117
4129
|
],
|
|
4118
4130
|
"additionalProperties": false
|
|
4119
4131
|
},
|
|
4132
|
+
{
|
|
4133
|
+
"type": "object",
|
|
4134
|
+
"properties": {
|
|
4135
|
+
"requestId": {
|
|
4136
|
+
"type": "string",
|
|
4137
|
+
"format": "uuid"
|
|
4138
|
+
},
|
|
4139
|
+
"expectedGeneration": {
|
|
4140
|
+
"type": "string",
|
|
4141
|
+
"format": "uuid"
|
|
4142
|
+
},
|
|
4143
|
+
"expectedRevision": {
|
|
4144
|
+
"type": "string",
|
|
4145
|
+
"pattern": "^[1-9][0-9]{0,39}$"
|
|
4146
|
+
},
|
|
4147
|
+
"command": {
|
|
4148
|
+
"const": "retire"
|
|
4149
|
+
}
|
|
4150
|
+
},
|
|
4151
|
+
"required": [
|
|
4152
|
+
"requestId",
|
|
4153
|
+
"expectedGeneration",
|
|
4154
|
+
"expectedRevision",
|
|
4155
|
+
"command"
|
|
4156
|
+
],
|
|
4157
|
+
"additionalProperties": false
|
|
4158
|
+
},
|
|
4120
4159
|
{
|
|
4121
4160
|
"type": "object",
|
|
4122
4161
|
"properties": {
|