-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdispatch-courier.wit
More file actions
135 lines (114 loc) · 3.48 KB
/
Copy pathdispatch-courier.wit
File metadata and controls
135 lines (114 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package dispatch:courier@0.0.1;
interface host {
record conversation-message {
role: string,
content: string,
}
record memory-entry {
namespace: string,
key: string,
value: string,
updated-at: u64,
}
record local-tool {
alias: string,
description: option<string>,
input-schema-json: option<string>,
}
enum model-tool-kind {
custom,
function,
}
record model-tool {
name: string,
description: string,
kind: model-tool-kind,
input-schema-json: option<string>,
}
record model-request {
/// Optional model id override. The host still applies parcel/provider policy
/// when selecting the backend for this request.
model: option<string>,
instructions: string,
messages: list<conversation-message>,
tools: list<model-tool>,
tool-outputs: list<model-tool-output>,
previous-response-id: option<string>,
}
record model-tool-call {
call-id: string,
name: string,
input: string,
kind: model-tool-kind,
}
record model-response {
backend: string,
text: option<string>,
response-id: option<string>,
tool-calls: list<model-tool-call>,
}
record model-tool-output {
call-id: string,
output: string,
kind: model-tool-kind,
}
record tool-invocation {
name: string,
input: option<string>,
}
record tool-result {
tool: string,
command: string,
args: list<string>,
exit-code: s32,
stdout: string,
stderr: string,
}
/// Executes a hosted-model request using the host's parcel-aware model policy.
/// Hosts may apply declared fallback models before returning an error.
model-complete: func(request: model-request) -> result<model-response, string>;
invoke-tool: func(invocation: tool-invocation) -> result<tool-result, string>;
memory-get: func(namespace: string, key: string) -> result<option<memory-entry>, string>;
memory-put: func(namespace: string, key: string, value: string) -> result<bool, string>;
memory-delete: func(namespace: string, key: string) -> result<bool, string>;
memory-list: func(namespace: string, prefix: option<string>) -> result<list<memory-entry>, string>;
}
interface guest {
use host.{conversation-message, local-tool};
record parcel-context {
parcel-digest: string,
entrypoint: option<string>,
prompt: string,
local-tools: list<local-tool>,
primary-model: option<string>,
}
record guest-session {
turn-count: u64,
history: list<conversation-message>,
backend-state: option<string>,
}
variant operation {
chat(string),
job(string),
heartbeat(option<string>),
}
record backend-fallback {
backend: string,
error: string,
}
variant guest-event {
message(conversation-message),
text-delta(string),
backend-fallback(backend-fallback),
}
record turn-result {
backend-state: option<string>,
events: list<guest-event>,
}
open-session: func(parcel: parcel-context) -> result<option<string>, string>;
handle-operation: func(parcel: parcel-context, session: guest-session, operation: operation) -> result<turn-result, string>;
}
world courier-guest {
import host;
export guest;
}