@finalai/agents 0.10.0 → 0.12.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/HOSTING.md +334 -245
- package/README.md +214 -29
- package/dist/modules/agent-client/agent-input.d.mts +24 -0
- package/dist/modules/agent-client/agent-input.mjs +46 -0
- package/dist/modules/agent-client/agent-input.mjs.map +7 -0
- package/dist/modules/agent-client/channels.d.mts +52 -3
- package/dist/modules/agent-client/channels.mjs +71 -10
- package/dist/modules/agent-client/channels.mjs.map +2 -2
- package/dist/modules/agent-client/client.d.mts +85 -20
- package/dist/modules/agent-client/client.mjs +74 -21
- package/dist/modules/agent-client/client.mjs.map +2 -2
- package/dist/modules/agent-client/config-options.mjs +1 -2
- package/dist/modules/agent-client/config-options.mjs.map +2 -2
- package/dist/modules/agent-client/conversation-resources.d.mts +85 -0
- package/dist/modules/agent-client/conversation-resources.mjs +150 -0
- package/dist/modules/agent-client/conversation-resources.mjs.map +7 -0
- package/dist/modules/agent-client/conversations.d.mts +116 -38
- package/dist/modules/agent-client/conversations.mjs +379 -71
- package/dist/modules/agent-client/conversations.mjs.map +2 -2
- package/dist/modules/agent-client/defaults.d.mts +8 -0
- package/dist/modules/agent-client/defaults.mjs +77 -0
- package/dist/modules/agent-client/defaults.mjs.map +7 -0
- package/dist/modules/agent-client/errors.d.mts +22 -2
- package/dist/modules/agent-client/errors.mjs +19 -0
- package/dist/modules/agent-client/errors.mjs.map +2 -2
- package/dist/modules/agent-client/events.d.mts +62 -0
- package/dist/modules/agent-client/events.mjs +107 -0
- package/dist/modules/agent-client/events.mjs.map +7 -0
- package/dist/modules/agent-client/harnesses.d.mts +66 -0
- package/dist/modules/agent-client/harnesses.mjs +156 -0
- package/dist/modules/agent-client/harnesses.mjs.map +7 -0
- package/dist/modules/agent-client/http.d.mts +2 -1
- package/dist/modules/agent-client/http.mjs +21 -2
- package/dist/modules/agent-client/http.mjs.map +2 -2
- package/dist/modules/agent-client/index.d.mts +21 -6
- package/dist/modules/agent-client/index.mjs +26 -0
- package/dist/modules/agent-client/index.mjs.map +2 -2
- package/dist/modules/agent-client/integrations.d.mts +40 -0
- package/dist/modules/agent-client/integrations.mjs +92 -0
- package/dist/modules/agent-client/integrations.mjs.map +7 -0
- package/dist/modules/agent-client/local-host-protocol.d.mts +156 -0
- package/dist/modules/agent-client/local-host-protocol.mjs +258 -0
- package/dist/modules/agent-client/local-host-protocol.mjs.map +7 -0
- package/dist/modules/agent-client/local-host.d.mts +56 -0
- package/dist/modules/agent-client/local-host.mjs +200 -0
- package/dist/modules/agent-client/local-host.mjs.map +7 -0
- package/dist/modules/agent-client/oauth-clients.d.mts +36 -0
- package/dist/modules/agent-client/oauth-clients.mjs +67 -0
- package/dist/modules/agent-client/oauth-clients.mjs.map +7 -0
- package/dist/modules/agent-client/project-agents.d.mts +54 -0
- package/dist/modules/agent-client/project-agents.mjs +111 -0
- package/dist/modules/agent-client/project-agents.mjs.map +7 -0
- package/dist/modules/agent-client/project.d.mts +43 -0
- package/dist/modules/agent-client/project.mjs +66 -0
- package/dist/modules/agent-client/project.mjs.map +7 -0
- package/dist/modules/agent-client/projects.d.mts +61 -0
- package/dist/modules/agent-client/projects.mjs +145 -0
- package/dist/modules/agent-client/projects.mjs.map +7 -0
- package/dist/modules/agent-client/provide.d.mts +41 -0
- package/dist/modules/agent-client/provide.mjs +90 -0
- package/dist/modules/agent-client/provide.mjs.map +7 -0
- package/dist/modules/agent-client/publishers.d.mts +57 -0
- package/dist/modules/agent-client/publishers.mjs +109 -0
- package/dist/modules/agent-client/publishers.mjs.map +7 -0
- package/dist/modules/agent-client/requirements.d.mts +60 -0
- package/dist/modules/agent-client/requirements.mjs +83 -0
- package/dist/modules/agent-client/requirements.mjs.map +7 -0
- package/dist/modules/agent-client/sandbox-providers.d.mts +34 -0
- package/dist/modules/agent-client/sandbox-providers.mjs +75 -0
- package/dist/modules/agent-client/sandbox-providers.mjs.map +7 -0
- package/dist/modules/agent-client/sandbox-uri.d.mts +1 -1
- package/dist/modules/agent-client/sandbox-uri.mjs +4 -4
- package/dist/modules/agent-client/sandbox-uri.mjs.map +1 -1
- package/dist/modules/agent-client/sandboxes.d.mts +65 -0
- package/dist/modules/agent-client/sandboxes.mjs +130 -0
- package/dist/modules/agent-client/sandboxes.mjs.map +7 -0
- package/dist/modules/agent-client/schedules.d.mts +24 -0
- package/dist/modules/agent-client/schedules.mjs +56 -0
- package/dist/modules/agent-client/schedules.mjs.map +7 -0
- package/dist/modules/agent-client/sessions.d.mts +46 -8
- package/dist/modules/agent-client/sessions.mjs +91 -29
- package/dist/modules/agent-client/sessions.mjs.map +2 -2
- package/dist/modules/agent-client/start.d.mts +101 -0
- package/dist/modules/agent-client/start.mjs +260 -0
- package/dist/modules/agent-client/start.mjs.map +7 -0
- package/dist/modules/agent-client/test-fakes.d.mts +1 -0
- package/dist/modules/agent-client/test-fakes.mjs +3 -1
- package/dist/modules/agent-client/test-fakes.mjs.map +2 -2
- package/dist/modules/cli/agent-module.d.mts +39 -0
- package/dist/modules/cli/agent-module.mjs +89 -0
- package/dist/modules/cli/agent-module.mjs.map +7 -0
- package/dist/modules/cli/cli.d.mts +6 -6
- package/dist/modules/cli/cli.mjs +94 -120
- package/dist/modules/cli/cli.mjs.map +2 -2
- package/dist/modules/cli/conformance.d.mts +2 -6
- package/dist/modules/cli/conformance.mjs +5 -8
- package/dist/modules/cli/conformance.mjs.map +2 -2
- package/dist/modules/cli/main.mjs.map +1 -1
- package/dist/modules/cli/output.d.mts +0 -9
- package/dist/modules/cli/output.mjs +7 -85
- package/dist/modules/cli/output.mjs.map +2 -2
- package/dist/modules/harnesses.mjs.map +2 -2
- package/dist/modules/index.d.mts +0 -2
- package/dist/modules/index.mjs +0 -4
- package/dist/modules/index.mjs.map +2 -2
- package/dist/modules/integrations.d.mts +24 -0
- package/dist/modules/integrations.mjs +30 -0
- package/dist/modules/integrations.mjs.map +7 -0
- package/dist/modules/public.d.mts +10 -10
- package/dist/modules/public.mjs +29 -78
- package/dist/modules/public.mjs.map +2 -2
- package/dist/modules/sandboxes.d.mts +2 -0
- package/dist/modules/sandboxes.mjs +4 -0
- package/dist/modules/sandboxes.mjs.map +2 -2
- package/dist/modules/verify.d.mts +1 -0
- package/dist/modules/verify.mjs +2 -0
- package/dist/modules/verify.mjs.map +7 -0
- package/dist/modules/webhooks.d.mts +37 -0
- package/dist/modules/webhooks.mjs +100 -0
- package/dist/modules/webhooks.mjs.map +7 -0
- package/examples/release-scout/README.md +18 -10
- package/examples/release-scout/agent.ts +41 -0
- package/examples/release-scout/by-name.ts +43 -0
- package/examples/release-scout/db.ts +6 -0
- package/examples/release-scout/instructions.md +5 -0
- package/examples/release-scout/run-on-a-computer.ts +49 -0
- package/examples/release-scout/run.ts +38 -0
- package/package.json +42 -28
- package/dist/modules/agent-client/build.d.mts +0 -110
- package/dist/modules/agent-client/build.mjs +0 -213
- package/dist/modules/agent-client/build.mjs.map +0 -7
- package/dist/modules/authoring/index.d.mts +0 -1
- package/dist/modules/authoring/index.mjs +0 -2
- package/dist/modules/authoring/index.mjs.map +0 -7
- package/dist/modules/authoring/instructions.d.mts +0 -1
- package/dist/modules/authoring/instructions.mjs +0 -2
- package/dist/modules/authoring/instructions.mjs.map +0 -7
- package/dist/modules/authoring/providers.d.mts +0 -2
- package/dist/modules/authoring/providers.mjs +0 -1
- package/dist/modules/authoring/providers.mjs.map +0 -7
- package/dist/modules/cli/build.d.mts +0 -22
- package/dist/modules/cli/build.mjs +0 -77
- package/dist/modules/cli/build.mjs.map +0 -7
- package/dist/modules/cli/channel-install.d.mts +0 -12
- package/dist/modules/cli/channel-install.mjs +0 -25
- package/dist/modules/cli/channel-install.mjs.map +0 -7
- package/dist/modules/cli/channel-socket.d.mts +0 -9
- package/dist/modules/cli/channel-socket.mjs +0 -114
- package/dist/modules/cli/channel-socket.mjs.map +0 -7
- package/dist/modules/cli/dev.d.mts +0 -26
- package/dist/modules/cli/dev.mjs +0 -311
- package/dist/modules/cli/dev.mjs.map +0 -7
- package/dist/modules/cli/files.d.mts +0 -18
- package/dist/modules/cli/files.mjs +0 -66
- package/dist/modules/cli/files.mjs.map +0 -7
- package/dist/modules/cli/harness-descriptions.d.mts +0 -20
- package/dist/modules/cli/harness-descriptions.mjs +0 -70
- package/dist/modules/cli/harness-descriptions.mjs.map +0 -7
- package/dist/modules/cli/publish.d.mts +0 -15
- package/dist/modules/cli/publish.mjs +0 -92
- package/dist/modules/cli/publish.mjs.map +0 -7
- package/dist/modules/compile.d.mts +0 -3
- package/dist/modules/compile.mjs +0 -58
- package/dist/modules/compile.mjs.map +0 -7
- package/dist/modules/index.browser.d.mts +0 -4
- package/dist/modules/index.browser.mjs +0 -8
- package/dist/modules/index.browser.mjs.map +0 -7
- package/examples/custom-harness/README.md +0 -16
- package/examples/custom-harness/agent.ts +0 -154
- package/examples/custom-sandbox/README.md +0 -12
- package/examples/custom-sandbox/agent.ts +0 -14
- package/examples/custom-sandbox/sandbox.ts +0 -24
- package/examples/release-scout/agent/agent.ts +0 -22
- package/examples/release-scout/agent/channels/github-signature.ts +0 -27
- package/examples/release-scout/agent/channels/github.ts +0 -32
- package/examples/release-scout/agent/connections/linear.ts +0 -9
- package/examples/release-scout/agent/hooks/audit.ts +0 -24
- package/examples/release-scout/agent/instructions/org-context.ts +0 -26
- package/examples/release-scout/agent/instructions.md +0 -2
- package/examples/release-scout/agent/sandbox.ts +0 -20
- package/examples/release-scout/agent/schedules/daily-digest.md +0 -7
- package/examples/release-scout/agent/skills/triage/SKILL.md +0 -8
- package/examples/release-scout/agent/skills/triage/checklist.md +0 -3
- package/examples/release-scout/agent/tools/lookup_release_notes.ts +0 -24
- package/examples/release-scout/client.ts +0 -122
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
apiDecisionResponseSchema,
|
|
3
|
+
conversationContextEntryResponseSchema,
|
|
4
|
+
conversationContextListSchema,
|
|
5
|
+
conversationLabelsResponseSchema,
|
|
6
|
+
conversationReadGrantListSchema,
|
|
7
|
+
conversationReadGrantResponseSchema,
|
|
8
|
+
createConversationReadGrantRequestSchema,
|
|
9
|
+
createResourceSubscriptionRequestSchema,
|
|
10
|
+
endResourceSubscriptionResponseSchema,
|
|
11
|
+
okResponseSchema,
|
|
12
|
+
postConversationInputRequestSchema,
|
|
13
|
+
postConversationInputResponseSchema,
|
|
14
|
+
putConversationContextEntryRequestSchema,
|
|
15
|
+
raiseConversationDecisionRequestSchema,
|
|
16
|
+
resourceSubscriptionListSchema,
|
|
17
|
+
resourceSubscriptionResponseSchema,
|
|
18
|
+
setConversationLabelsRequestSchema
|
|
19
|
+
} from "@finalai/agent-protocol/agent-platform";
|
|
20
|
+
import * as z from "zod";
|
|
21
|
+
import {
|
|
22
|
+
encodePath
|
|
23
|
+
} from "./context.mjs";
|
|
24
|
+
import { HttpMethod } from "./http.mjs";
|
|
25
|
+
const emptyBodySchema = z.strictObject({});
|
|
26
|
+
const createConversationResources = (context, conversationId) => {
|
|
27
|
+
const { http } = context;
|
|
28
|
+
const path = (suffix) => `/v1/conversations/${encodePath(conversationId)}${suffix}`;
|
|
29
|
+
const decisionPath = (decisionId, suffix = "") => path(`/decisions/${encodePath(decisionId)}${suffix}`);
|
|
30
|
+
return {
|
|
31
|
+
labels: {
|
|
32
|
+
set: async (labels, options) => (await http.request({
|
|
33
|
+
method: HttpMethod.Patch,
|
|
34
|
+
path: path("/labels"),
|
|
35
|
+
body: { schema: setConversationLabelsRequestSchema, value: { labels } },
|
|
36
|
+
response: conversationLabelsResponseSchema,
|
|
37
|
+
signal: options?.signal
|
|
38
|
+
})).labels
|
|
39
|
+
},
|
|
40
|
+
context: {
|
|
41
|
+
set: async (key, entry, options) => (await http.request({
|
|
42
|
+
method: HttpMethod.Put,
|
|
43
|
+
path: path(`/context/${encodePath(key)}`),
|
|
44
|
+
body: {
|
|
45
|
+
schema: putConversationContextEntryRequestSchema,
|
|
46
|
+
value: { role: entry.role, text: entry.text, participantId: entry.participantId }
|
|
47
|
+
},
|
|
48
|
+
response: conversationContextEntryResponseSchema,
|
|
49
|
+
signal: options?.signal
|
|
50
|
+
})).entry,
|
|
51
|
+
delete: async (key, options) => {
|
|
52
|
+
await http.request({
|
|
53
|
+
method: HttpMethod.Delete,
|
|
54
|
+
path: path(`/context/${encodePath(key)}`),
|
|
55
|
+
query: { participantId: options?.participantId },
|
|
56
|
+
response: okResponseSchema,
|
|
57
|
+
signal: options?.signal
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
list: async (options) => (await http.request({
|
|
61
|
+
method: HttpMethod.Get,
|
|
62
|
+
path: path("/context"),
|
|
63
|
+
response: conversationContextListSchema,
|
|
64
|
+
signal: options?.signal
|
|
65
|
+
})).entries
|
|
66
|
+
},
|
|
67
|
+
readGrants: {
|
|
68
|
+
create: async ({ signal, ...value }) => (await http.request({
|
|
69
|
+
method: HttpMethod.Post,
|
|
70
|
+
path: path("/read-grants"),
|
|
71
|
+
body: { schema: createConversationReadGrantRequestSchema, value },
|
|
72
|
+
response: conversationReadGrantResponseSchema,
|
|
73
|
+
signal
|
|
74
|
+
})).grant,
|
|
75
|
+
list: async (options) => (await http.request({
|
|
76
|
+
method: HttpMethod.Get,
|
|
77
|
+
path: path("/read-grants"),
|
|
78
|
+
response: conversationReadGrantListSchema,
|
|
79
|
+
signal: options?.signal
|
|
80
|
+
})).grants,
|
|
81
|
+
revoke: async ({ grantId, signal }) => (await http.request({
|
|
82
|
+
method: HttpMethod.Delete,
|
|
83
|
+
path: path(`/read-grants/${encodePath(grantId)}`),
|
|
84
|
+
response: conversationReadGrantResponseSchema,
|
|
85
|
+
signal
|
|
86
|
+
})).grant
|
|
87
|
+
},
|
|
88
|
+
inputs: {
|
|
89
|
+
send: async ({ signal, idempotencyKey, ...value }) => (await http.request({
|
|
90
|
+
method: HttpMethod.Post,
|
|
91
|
+
path: path("/inputs"),
|
|
92
|
+
body: {
|
|
93
|
+
schema: postConversationInputRequestSchema,
|
|
94
|
+
value: { ...value, idempotencyKey: idempotencyKey ?? context.newKey() }
|
|
95
|
+
},
|
|
96
|
+
response: postConversationInputResponseSchema,
|
|
97
|
+
signal
|
|
98
|
+
})).input
|
|
99
|
+
},
|
|
100
|
+
decisions: {
|
|
101
|
+
raise: async ({ signal, ...value }) => (await http.request({
|
|
102
|
+
method: HttpMethod.Post,
|
|
103
|
+
path: path("/decisions"),
|
|
104
|
+
body: { schema: raiseConversationDecisionRequestSchema, value },
|
|
105
|
+
response: apiDecisionResponseSchema,
|
|
106
|
+
signal
|
|
107
|
+
})).decision,
|
|
108
|
+
get: async ({ decisionId, signal }) => (await http.request({
|
|
109
|
+
method: HttpMethod.Get,
|
|
110
|
+
path: decisionPath(decisionId),
|
|
111
|
+
response: apiDecisionResponseSchema,
|
|
112
|
+
signal,
|
|
113
|
+
context: { decisionId }
|
|
114
|
+
})).decision,
|
|
115
|
+
cancel: async ({ decisionId, signal }) => (await http.request({
|
|
116
|
+
method: HttpMethod.Post,
|
|
117
|
+
path: decisionPath(decisionId, "/cancel"),
|
|
118
|
+
body: { schema: emptyBodySchema, value: {} },
|
|
119
|
+
response: apiDecisionResponseSchema,
|
|
120
|
+
signal,
|
|
121
|
+
context: { decisionId }
|
|
122
|
+
})).decision
|
|
123
|
+
},
|
|
124
|
+
resourceSubscriptions: {
|
|
125
|
+
list: async (options) => (await http.request({
|
|
126
|
+
method: HttpMethod.Get,
|
|
127
|
+
path: path("/resource-subscriptions"),
|
|
128
|
+
response: resourceSubscriptionListSchema,
|
|
129
|
+
signal: options?.signal
|
|
130
|
+
})).subscriptions,
|
|
131
|
+
create: async ({ signal, ...value }) => (await http.request({
|
|
132
|
+
method: HttpMethod.Post,
|
|
133
|
+
path: path("/resource-subscriptions"),
|
|
134
|
+
body: { schema: createResourceSubscriptionRequestSchema, value },
|
|
135
|
+
response: resourceSubscriptionResponseSchema,
|
|
136
|
+
signal
|
|
137
|
+
})).subscription,
|
|
138
|
+
delete: async ({ resourceKey, signal }) => (await http.request({
|
|
139
|
+
method: HttpMethod.Delete,
|
|
140
|
+
path: path(`/resource-subscriptions/${encodePath(resourceKey)}`),
|
|
141
|
+
response: endResourceSubscriptionResponseSchema,
|
|
142
|
+
signal
|
|
143
|
+
})).ended
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export {
|
|
148
|
+
createConversationResources
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=conversation-resources.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/agent-client/conversation-resources.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n apiDecisionResponseSchema,\n conversationContextEntryResponseSchema,\n conversationContextListSchema,\n conversationLabelsResponseSchema,\n conversationReadGrantListSchema,\n conversationReadGrantResponseSchema,\n createConversationReadGrantRequestSchema,\n createResourceSubscriptionRequestSchema,\n endResourceSubscriptionResponseSchema,\n okResponseSchema,\n postConversationInputRequestSchema,\n postConversationInputResponseSchema,\n putConversationContextEntryRequestSchema,\n raiseConversationDecisionRequestSchema,\n resourceSubscriptionListSchema,\n resourceSubscriptionResponseSchema,\n setConversationLabelsRequestSchema,\n type ApiDecisionIface,\n type ConversationContextEntryIface,\n type ConversationContextRole,\n type ConversationReadGrantIface,\n type CreateConversationReadGrantRequestIface,\n type CreateResourceSubscriptionRequestIface,\n type InputReceiptIface,\n type PostConversationInputRequestIface,\n type RaiseConversationDecisionRequestIface,\n type ResourceSubscriptionIface,\n} from '@finalai/agent-protocol/agent-platform';\nimport * as z from 'zod';\nimport {\n encodePath,\n type ClientContextIface,\n type EnumInput,\n type SignalOptionsIface,\n} from \"./context.mjs\";\nimport { HttpMethod } from \"./http.mjs\";\n\n// What a caller keeps on a conversation besides its messages: labels,\n// standing context, read grants, inputs, the decisions it raises and the\n// outside resources a person follows from it.\n\nexport interface ConversationLabelsApiIface {\n /**\n * Sets labels in the caller's namespace (`PATCH \u2026/labels`); `null` removes a\n * key and keys not named are kept. Needs `labels:write`. Returns every label\n * the conversation now carries for the caller; `info()` carries them too.\n */\n set: (\n labels: Record<string, string | null>,\n options?: SignalOptionsIface,\n ) => Promise<Record<string, string>>;\n}\n\nexport interface ConversationContextEntryInputIface {\n role: EnumInput<ConversationContextRole>;\n /** Delivered verbatim; the platform adds no headers. */\n text: string;\n /** The one agent participant it is for; omitted or null for every agent in the conversation. */\n participantId?: string | null;\n}\n\nexport interface ConversationContextApiIface {\n /**\n * Creates or replaces the caller's entry `key` (`PUT \u2026/context/:key`). The\n * agent gets the text at its next turn boundary, and again whenever it\n * changes or the agent's context was compacted or restored.\n */\n set: (\n key: string,\n entry: ConversationContextEntryInputIface,\n options?: SignalOptionsIface,\n ) => Promise<ConversationContextEntryIface>;\n /** Stops delivering an entry; the agent is told nothing (write replacement text to tell it). */\n delete: (key: string, options?: SignalOptionsIface & { participantId?: string }) => Promise<void>;\n /** The caller's entries. */\n list: (options?: SignalOptionsIface) => Promise<ConversationContextEntryIface[]>;\n}\n\nexport interface ConversationReadGrantsApiIface {\n /** Lets this conversation's agents read one message of another conversation (`POST \u2026/read-grants`). */\n create: (\n args: CreateConversationReadGrantRequestIface & SignalOptionsIface,\n ) => Promise<ConversationReadGrantIface>;\n list: (options?: SignalOptionsIface) => Promise<ConversationReadGrantIface[]>;\n revoke: (args: { grantId: string } & SignalOptionsIface) => Promise<ConversationReadGrantIface>;\n}\n\nexport type SendInputArgsIface = Omit<PostConversationInputRequestIface, 'idempotencyKey'> & {\n /** Redelivering the same key from the same caller and `from.id` returns the first receipt; defaults to a new key. */\n idempotencyKey?: string;\n} & SignalOptionsIface;\n\nexport interface ConversationInputsApiIface {\n /**\n * Hands the conversation's agent something to act on that is not a message\n * from a member (`POST \u2026/inputs`). The reply arrives later as the agent's\n * message, captioned with `label` (or \"From <from.name>\").\n */\n send: (args: SendInputArgsIface) => Promise<InputReceiptIface>;\n}\n\nexport interface ConversationDecisionsApiIface {\n /**\n * Asks the audience a question card (`POST \u2026/decisions`). The caller owns\n * the decision; raising the same `requestKey` again returns it. Its\n * resolution arrives as a `decision.resolved` event carrying `requestKey`.\n */\n raise: (\n args: RaiseConversationDecisionRequestIface & SignalOptionsIface,\n ) => Promise<ApiDecisionIface>;\n /** A decision the caller raised (404 for anyone else's). */\n get: (args: { decisionId: string } & SignalOptionsIface) => Promise<ApiDecisionIface>;\n cancel: (args: { decisionId: string } & SignalOptionsIface) => Promise<ApiDecisionIface>;\n}\n\nexport interface ResourceSubscriptionsApiIface {\n /** The outside resources the caller's person follows from this conversation. */\n list: (options?: SignalOptionsIface) => Promise<ResourceSubscriptionIface[]>;\n /** Follows a resource; fails with `no_linked_channel` unless a linked channel handles it. */\n create: (\n args: CreateResourceSubscriptionRequestIface & SignalOptionsIface,\n ) => Promise<ResourceSubscriptionIface>;\n /** Stops following; resolves whether a follow ended. */\n delete: (args: { resourceKey: string } & SignalOptionsIface) => Promise<boolean>;\n}\n\nexport interface ConversationResourcesIface {\n labels: ConversationLabelsApiIface;\n context: ConversationContextApiIface;\n readGrants: ConversationReadGrantsApiIface;\n inputs: ConversationInputsApiIface;\n decisions: ConversationDecisionsApiIface;\n resourceSubscriptions: ResourceSubscriptionsApiIface;\n}\n\nconst emptyBodySchema = z.strictObject({});\n\nexport const createConversationResources = (\n context: ClientContextIface,\n conversationId: string,\n): ConversationResourcesIface => {\n const { http } = context;\n const path = (suffix: string): string =>\n `/v1/conversations/${encodePath(conversationId)}${suffix}`;\n const decisionPath = (decisionId: string, suffix = ''): string =>\n path(`/decisions/${encodePath(decisionId)}${suffix}`);\n return {\n labels: {\n set: async (labels, options) =>\n (\n await http.request({\n method: HttpMethod.Patch,\n path: path('/labels'),\n body: { schema: setConversationLabelsRequestSchema, value: { labels } },\n response: conversationLabelsResponseSchema,\n signal: options?.signal,\n })\n ).labels,\n },\n context: {\n set: async (key, entry, options) =>\n (\n await http.request({\n method: HttpMethod.Put,\n path: path(`/context/${encodePath(key)}`),\n body: {\n schema: putConversationContextEntryRequestSchema,\n value: { role: entry.role, text: entry.text, participantId: entry.participantId },\n },\n response: conversationContextEntryResponseSchema,\n signal: options?.signal,\n })\n ).entry,\n delete: async (key, options) => {\n await http.request({\n method: HttpMethod.Delete,\n path: path(`/context/${encodePath(key)}`),\n query: { participantId: options?.participantId },\n response: okResponseSchema,\n signal: options?.signal,\n });\n },\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: path('/context'),\n response: conversationContextListSchema,\n signal: options?.signal,\n })\n ).entries,\n },\n readGrants: {\n create: async ({ signal, ...value }) =>\n (\n await http.request({\n method: HttpMethod.Post,\n path: path('/read-grants'),\n body: { schema: createConversationReadGrantRequestSchema, value },\n response: conversationReadGrantResponseSchema,\n signal,\n })\n ).grant,\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: path('/read-grants'),\n response: conversationReadGrantListSchema,\n signal: options?.signal,\n })\n ).grants,\n revoke: async ({ grantId, signal }) =>\n (\n await http.request({\n method: HttpMethod.Delete,\n path: path(`/read-grants/${encodePath(grantId)}`),\n response: conversationReadGrantResponseSchema,\n signal,\n })\n ).grant,\n },\n inputs: {\n send: async ({ signal, idempotencyKey, ...value }) =>\n (\n await http.request({\n method: HttpMethod.Post,\n path: path('/inputs'),\n body: {\n schema: postConversationInputRequestSchema,\n value: { ...value, idempotencyKey: idempotencyKey ?? context.newKey() },\n },\n response: postConversationInputResponseSchema,\n signal,\n })\n ).input,\n },\n decisions: {\n raise: async ({ signal, ...value }) =>\n (\n await http.request({\n method: HttpMethod.Post,\n path: path('/decisions'),\n body: { schema: raiseConversationDecisionRequestSchema, value },\n response: apiDecisionResponseSchema,\n signal,\n })\n ).decision,\n get: async ({ decisionId, signal }) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: decisionPath(decisionId),\n response: apiDecisionResponseSchema,\n signal,\n context: { decisionId },\n })\n ).decision,\n cancel: async ({ decisionId, signal }) =>\n (\n await http.request({\n method: HttpMethod.Post,\n path: decisionPath(decisionId, '/cancel'),\n body: { schema: emptyBodySchema, value: {} },\n response: apiDecisionResponseSchema,\n signal,\n context: { decisionId },\n })\n ).decision,\n },\n resourceSubscriptions: {\n list: async (options) =>\n (\n await http.request({\n method: HttpMethod.Get,\n path: path('/resource-subscriptions'),\n response: resourceSubscriptionListSchema,\n signal: options?.signal,\n })\n ).subscriptions,\n create: async ({ signal, ...value }) =>\n (\n await http.request({\n method: HttpMethod.Post,\n path: path('/resource-subscriptions'),\n body: { schema: createResourceSubscriptionRequestSchema, value },\n response: resourceSubscriptionResponseSchema,\n signal,\n })\n ).subscription,\n delete: async ({ resourceKey, signal }) =>\n (\n await http.request({\n method: HttpMethod.Delete,\n path: path(`/resource-subscriptions/${encodePath(resourceKey)}`),\n response: endResourceSubscriptionResponseSchema,\n signal,\n })\n ).ended,\n },\n };\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { type ProcessInspectionRequestIface, type ProcessInspectionResultIface } from '@finalai/agent-protocol';
|
|
2
|
-
import { AgentSessionState, type PostConversationEventResponseIface, type AgentRealtimeEvent, type AgentTurnPolicy, type AttachmentDownloadIface, type AttachmentUploadIface, type ContentInput, type ConversationIface, type ConversationKind, type ConversationLinkIface, type ConversationListIface, type ConversationMessageIface, type ConversationMessagesPageIface, type ConversationSandboxIface, type ConversationScheduleIface, type CreateConversationScheduleRequestIface, type DecisionsPageIface, type MessageDeliveryIface, type ParticipantIface, type ParticipantInput, type PostConversationEventRequestIface, type ReactionIface, type ReadStateIface, type RespondDecisionResponseIface, type SandboxDirectoryIface, type SandboxEditorSessionIface, type SandboxFileIface, type SandboxPathIface, type SandboxPreviewType, type SandboxSearchIface, type SearchMessagesPageIface, type UpdateConversationRequestIface, type UpdateConversationScheduleRequestIface, type UpdateParticipantRequestIface, type WireFallback } from '@finalai/agent-protocol/agent-platform';
|
|
2
|
+
import { AgentSessionState, type PostConversationEventResponseIface, type AgentRealtimeEvent, type AgentTurnPolicy, type AttachmentDownloadIface, type AttachmentUploadIface, type ContentInput, type ConversationIface, type ConversationKind, type ConversationLinkIface, type ConversationListIface, type ConversationMessageIface, type ConversationMessagesPageIface, type ConversationSandboxIface, type ConversationScheduleIface, type CreateConversationScheduleRequestIface, type DecisionsPageIface, type MessageDeliveryIface, type ParticipantIface, type ActorInputIface, type ParticipantInput, type ParticipantProvideResponseIface, type PostConversationEventRequestIface, type ReactionIface, type ReadStateIface, type RespondDecisionResponseIface, type SandboxDirectoryIface, type SandboxEditorSessionIface, type SandboxFileIface, type SandboxPathIface, type SandboxPreviewType, type SandboxSearchIface, type SearchMessagesPageIface, type UpdateConversationRequestIface, type UpdateConversationScheduleRequestIface, type UpdateParticipantRequestIface, type WireFallback } from '@finalai/agent-protocol/agent-platform';
|
|
3
|
+
import type { AgentInput } from "./agent-input.mjs";
|
|
4
|
+
import { type ConversationResourcesIface } from "./conversation-resources.mjs";
|
|
3
5
|
import { type CollectionEvent, type CollectionEventsOptionsIface } from "./collection-events.mjs";
|
|
4
6
|
import { type ClientContextIface, type EnumInput, type SignalOptionsIface } from "./context.mjs";
|
|
7
|
+
import { type ProvideIface, type ProvidePatchIface } from "./provide.mjs";
|
|
5
8
|
import { type RespondArgs } from "./sessions.mjs";
|
|
9
|
+
import { type AgentStartDepsIface } from "./start.mjs";
|
|
6
10
|
export interface SandboxFileContentArgsIface {
|
|
7
11
|
snapshotId?: string;
|
|
8
|
-
|
|
12
|
+
sandboxId: string;
|
|
9
13
|
path: string;
|
|
10
14
|
download?: boolean;
|
|
11
15
|
/** One HTTP byte range, for example `bytes=1024-2047`. */
|
|
@@ -70,15 +74,37 @@ export interface SendMessageOptionsIface extends SignalOptionsIface {
|
|
|
70
74
|
attachmentIds?: string[];
|
|
71
75
|
/** When the person submitted, for the prompt-to-inference trace; defaults to now. */
|
|
72
76
|
clientSubmittedAtMs?: number;
|
|
77
|
+
/** The caller's own end user posting it; API keys and app tokens only. */
|
|
78
|
+
actor?: ActorInputIface;
|
|
73
79
|
}
|
|
80
|
+
type RoutingModeInput = EnumInput<NonNullable<Extract<ParticipantInput, {
|
|
81
|
+
routingMode?: unknown;
|
|
82
|
+
}>['routingMode']>>;
|
|
83
|
+
/**
|
|
84
|
+
* A person by id, the caller's own end user (API keys and app tokens only), or
|
|
85
|
+
* an agent with what it is provided in this conversation.
|
|
86
|
+
*/
|
|
74
87
|
export type ParticipantCreateInput = {
|
|
75
88
|
user: string;
|
|
76
89
|
} | {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
90
|
+
actor: ActorInputIface;
|
|
91
|
+
} | {
|
|
92
|
+
/** The agent you defined, or one fetched with `project.agents.get`; never a string. */
|
|
93
|
+
agent: AgentInput;
|
|
94
|
+
routingMode?: RoutingModeInput;
|
|
95
|
+
provide: ProvideIface;
|
|
81
96
|
};
|
|
97
|
+
export interface ParticipantsApiIface {
|
|
98
|
+
(options?: SignalOptionsIface): Promise<ParticipantIface[]>;
|
|
99
|
+
/** An agent participant's settings: its provide document and per-chat overrides. */
|
|
100
|
+
settings: (participantId: string, options?: SignalOptionsIface) => Promise<ParticipantProvideResponseIface>;
|
|
101
|
+
/**
|
|
102
|
+
* Changes an agent participant's settings. Fails with `requirements_unmet` if
|
|
103
|
+
* the result no longer meets the agent's requirements, or
|
|
104
|
+
* `harness_unsuitable` for harness settings it cannot run on.
|
|
105
|
+
*/
|
|
106
|
+
provide: (participantId: string, patch: ProvidePatchIface, options?: SignalOptionsIface) => Promise<ParticipantProvideResponseIface>;
|
|
107
|
+
}
|
|
82
108
|
export interface SentMessageIface {
|
|
83
109
|
message: ConversationMessageIface;
|
|
84
110
|
messageId: string;
|
|
@@ -102,7 +128,7 @@ export interface UploadAttachmentArgsIface extends SignalOptionsIface {
|
|
|
102
128
|
contentType: string;
|
|
103
129
|
data: Blob | ArrayBuffer;
|
|
104
130
|
}
|
|
105
|
-
export interface ConversationHandleIface {
|
|
131
|
+
export interface ConversationHandleIface extends ConversationResourcesIface {
|
|
106
132
|
/** Durable accepted prompt receipts for a message, including queued deliveries once admitted. */
|
|
107
133
|
deliveries: (args: {
|
|
108
134
|
messageId: string;
|
|
@@ -162,7 +188,7 @@ export interface ConversationHandleIface {
|
|
|
162
188
|
reason?: string;
|
|
163
189
|
throughMessageSeq?: number;
|
|
164
190
|
}) => Promise<void>;
|
|
165
|
-
participants:
|
|
191
|
+
participants: ParticipantsApiIface;
|
|
166
192
|
/**
|
|
167
193
|
* Each agent participant's session state, read now: whether a turn is
|
|
168
194
|
* running in it. What a client re-reads when it may have missed a
|
|
@@ -202,48 +228,48 @@ export interface ConversationHandleIface {
|
|
|
202
228
|
* Never starts a parked sandbox.
|
|
203
229
|
*/
|
|
204
230
|
sandboxes: (options?: SignalOptionsIface) => Promise<ConversationSandboxIface[]>;
|
|
205
|
-
/** One directory of a running sandbox, confined to its workspace (`…/sandboxes/:
|
|
231
|
+
/** One directory of a running sandbox, confined to its workspace (`…/sandboxes/:sandboxId/files`). */
|
|
206
232
|
sandboxFiles: (args: {
|
|
207
|
-
|
|
233
|
+
sandboxId: string;
|
|
208
234
|
path?: string;
|
|
209
235
|
snapshotId?: string;
|
|
210
236
|
}, options?: SignalOptionsIface) => Promise<SandboxDirectoryIface>;
|
|
211
237
|
/** Resolves a file or directory without waking its sandbox. */
|
|
212
238
|
sandboxPath: (args: {
|
|
213
|
-
|
|
239
|
+
sandboxId: string;
|
|
214
240
|
path?: string;
|
|
215
241
|
snapshotId?: string;
|
|
216
242
|
}, options?: SignalOptionsIface) => Promise<SandboxPathIface>;
|
|
217
243
|
/** Bounded recursive path search; truncated signals incomplete traversal. */
|
|
218
244
|
searchSandboxFiles: (args: {
|
|
219
|
-
|
|
245
|
+
sandboxId: string;
|
|
220
246
|
path?: string;
|
|
221
247
|
query: string;
|
|
222
248
|
limit?: number;
|
|
223
249
|
}, options?: SignalOptionsIface) => Promise<SandboxSearchIface>;
|
|
224
|
-
/** A byte range of a file in a running sandbox, at most 1 MiB (`…/sandboxes/:
|
|
250
|
+
/** A byte range of a file in a running sandbox, at most 1 MiB (`…/sandboxes/:sandboxId/file`). */
|
|
225
251
|
sandboxFile: (args: {
|
|
226
|
-
|
|
252
|
+
sandboxId: string;
|
|
227
253
|
path: string;
|
|
228
254
|
offset?: number;
|
|
229
255
|
length?: number;
|
|
230
256
|
snapshotId?: string;
|
|
231
257
|
}, options?: SignalOptionsIface) => Promise<SandboxFileIface>;
|
|
232
258
|
inspectSandboxProcesses(args: {
|
|
233
|
-
|
|
259
|
+
sandboxId: string;
|
|
234
260
|
request: ProcessInspectionRequestIface;
|
|
235
261
|
}, options?: SignalOptionsIface): Promise<ProcessInspectionResultIface>;
|
|
236
262
|
/** Opens a provider editor for an existing workspace, with write authorization. */
|
|
237
263
|
openSandboxEditor(args: {
|
|
238
|
-
|
|
264
|
+
sandboxId: string;
|
|
239
265
|
}, options?: SignalOptionsIface): Promise<SandboxEditorSessionIface>;
|
|
240
266
|
refreshSandboxEditor(args: {
|
|
241
|
-
|
|
267
|
+
sandboxId: string;
|
|
242
268
|
editorId: string;
|
|
243
269
|
authorizationId: string;
|
|
244
270
|
}, options?: SignalOptionsIface): Promise<SandboxEditorSessionIface>;
|
|
245
271
|
closeSandboxEditor(args: {
|
|
246
|
-
|
|
272
|
+
sandboxId: string;
|
|
247
273
|
editorId: string;
|
|
248
274
|
authorizationId: string;
|
|
249
275
|
}, options?: SignalOptionsIface & {
|
|
@@ -259,12 +285,12 @@ export interface ConversationHandleIface {
|
|
|
259
285
|
sandboxFileContentRequest: (args: SandboxFileContentArgsIface) => Promise<SandboxFileContentRequestIface>;
|
|
260
286
|
/** A short-lived screen preview of a running sandbox; 404 when it serves none (`…/preview`). */
|
|
261
287
|
sandboxPreview: (args: {
|
|
262
|
-
|
|
288
|
+
sandboxId: string;
|
|
263
289
|
viewOnly?: boolean;
|
|
264
290
|
}, options?: SignalOptionsIface) => Promise<SandboxPreviewType>;
|
|
265
291
|
/** Starts a parked sandbox (conversation owners and admins; `POST …/wake`). */
|
|
266
292
|
wakeSandbox: (args: {
|
|
267
|
-
|
|
293
|
+
sandboxId: string;
|
|
268
294
|
}, options?: SignalOptionsIface) => Promise<ConversationSandboxIface>;
|
|
269
295
|
/** The conversation's runtime schedules: reminders and recurring checks (`GET …/schedules`). */
|
|
270
296
|
schedules: (options?: SignalOptionsIface) => Promise<ConversationScheduleIface[]>;
|
|
@@ -314,15 +340,63 @@ export interface OpenedConversationIface extends ConversationHandleIface {
|
|
|
314
340
|
}
|
|
315
341
|
export interface CreateConversationArgsIface extends SignalOptionsIface {
|
|
316
342
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* A direct chat is the caller's own and lives in their personal project.
|
|
343
|
+
* A conversation id you chose, so whatever you create for it first (a sandbox
|
|
344
|
+
* it owns) can name it. Creating with an id that exists returns that conversation.
|
|
320
345
|
*/
|
|
321
|
-
|
|
346
|
+
id?: string;
|
|
322
347
|
kind: EnumInput<ConversationKind>;
|
|
323
348
|
title?: string;
|
|
324
349
|
participants: ParticipantCreateInput[];
|
|
325
350
|
turnPolicy?: EnumInput<AgentTurnPolicy>;
|
|
351
|
+
/** Shared by the conversation's agents; each participant's own `provide` wins per key. */
|
|
352
|
+
provide?: ProvideIface;
|
|
353
|
+
/**
|
|
354
|
+
* Direct only. True (the default): the person's one direct conversation with
|
|
355
|
+
* the agent in this project, found or created. False: another private 1:1
|
|
356
|
+
* thread, created on every call (a retry with the same `id` returns it).
|
|
357
|
+
*/
|
|
358
|
+
primary?: boolean;
|
|
359
|
+
/** Written with the conversation in the caller's namespace; needs `labels:write`. */
|
|
360
|
+
labels?: Record<string, string>;
|
|
361
|
+
/** The caller's own end user creating it; API keys and app tokens only. */
|
|
362
|
+
actor?: ActorInputIface;
|
|
363
|
+
}
|
|
364
|
+
export interface ProjectConversationsApiIface extends ConversationsApiIface {
|
|
365
|
+
/**
|
|
366
|
+
* Creates a conversation in this project. Fails with `requirements_unmet`,
|
|
367
|
+
* creating nothing, unless each agent's requirements are met.
|
|
368
|
+
*/
|
|
369
|
+
create: (args: CreateConversationArgsIface) => Promise<OpenedConversationIface>;
|
|
370
|
+
/**
|
|
371
|
+
* The caller's own Home thread with the project's agent, found or created.
|
|
372
|
+
* `provide` is stored only when the agent has no settings there yet.
|
|
373
|
+
*/
|
|
374
|
+
home: (args: {
|
|
375
|
+
id?: string;
|
|
376
|
+
provide: ProvideIface;
|
|
377
|
+
} & SignalOptionsIface) => Promise<OpenedConversationIface>;
|
|
378
|
+
/** The caller's Home thread, if there is one. Creates nothing. */
|
|
379
|
+
findHome: (options?: SignalOptionsIface) => Promise<ConversationIface | null>;
|
|
380
|
+
/**
|
|
381
|
+
* The caller's direct conversation with an agent, found or created.
|
|
382
|
+
* `provide` is stored only when the agent has no settings there yet.
|
|
383
|
+
*/
|
|
384
|
+
direct: (args: {
|
|
385
|
+
id?: string;
|
|
386
|
+
agent: AgentInput;
|
|
387
|
+
provide: ProvideIface;
|
|
388
|
+
/** The caller's own end user whose direct conversation it is; API keys and app tokens only. */
|
|
389
|
+
actor?: ActorInputIface;
|
|
390
|
+
} & SignalOptionsIface) => Promise<OpenedConversationIface>;
|
|
391
|
+
/**
|
|
392
|
+
* The caller's primary direct conversation with an agent (by its id), if
|
|
393
|
+
* there is one. Creates nothing. `actorExternalId` names the caller's own end
|
|
394
|
+
* user (API keys and app tokens only).
|
|
395
|
+
*/
|
|
396
|
+
findDirect: (args: {
|
|
397
|
+
agent: string;
|
|
398
|
+
actorExternalId?: string;
|
|
399
|
+
} & SignalOptionsIface) => Promise<ConversationIface | null>;
|
|
326
400
|
}
|
|
327
401
|
export interface ConversationsApiIface {
|
|
328
402
|
/**
|
|
@@ -335,19 +409,11 @@ export interface ConversationsApiIface {
|
|
|
335
409
|
limit?: number;
|
|
336
410
|
includeArchived?: boolean;
|
|
337
411
|
projectId?: string;
|
|
412
|
+
/** With `projectId`: false leaves out the projects below it. */
|
|
413
|
+
includeSubprojects?: boolean;
|
|
414
|
+
/** Only conversations carrying every one of these labels in the caller's namespace. */
|
|
415
|
+
labels?: Record<string, string>;
|
|
338
416
|
}) => Promise<ConversationListIface>;
|
|
339
|
-
/** Finds or creates the caller's direct conversation with an agent. */
|
|
340
|
-
direct: (args: {
|
|
341
|
-
agent: string;
|
|
342
|
-
} & SignalOptionsIface) => Promise<OpenedConversationIface>;
|
|
343
|
-
/**
|
|
344
|
-
* Finds or creates the caller's own Project Agent thread in `projectId`, which
|
|
345
|
-
* omitted, is the signed-in person's personal project. Requires person authority.
|
|
346
|
-
*/
|
|
347
|
-
home: (options?: SignalOptionsIface & {
|
|
348
|
-
projectId?: string;
|
|
349
|
-
}) => Promise<OpenedConversationIface>;
|
|
350
|
-
create: (args: CreateConversationArgsIface) => Promise<OpenedConversationIface>;
|
|
351
417
|
/** I/O-free handle. */
|
|
352
418
|
get: (conversationId: string) => ConversationHandleIface;
|
|
353
419
|
/** Full-text search over the caller's conversations (or one), newest first. */
|
|
@@ -403,5 +469,17 @@ export declare const messageVersionOf: (message: ConversationMessageIface) => Me
|
|
|
403
469
|
* time, and equal times fall back to content.
|
|
404
470
|
*/
|
|
405
471
|
export declare const isNewerMessageVersion: (incoming: MessageVersionIface, current: MessageVersionIface | undefined) => boolean;
|
|
406
|
-
|
|
407
|
-
export
|
|
472
|
+
/** How a conversation handle starts the agents added to it. */
|
|
473
|
+
export interface ConversationStarterIface {
|
|
474
|
+
deps: AgentStartDepsIface;
|
|
475
|
+
/** Null for handles made outside a project, which cannot serve local compute. */
|
|
476
|
+
projectId: string | null;
|
|
477
|
+
}
|
|
478
|
+
export declare const createConversationHandle: (context: ClientContextIface, conversationId: string, starter: ConversationStarterIface) => ConversationHandleIface;
|
|
479
|
+
export declare const createConversationsApi: (context: ClientContextIface, starter: ConversationStarterIface) => ConversationsApiIface;
|
|
480
|
+
export declare const createProjectConversationsApi: (args: {
|
|
481
|
+
context: ClientContextIface;
|
|
482
|
+
projectId: string;
|
|
483
|
+
start: AgentStartDepsIface;
|
|
484
|
+
}) => ProjectConversationsApiIface;
|
|
485
|
+
export {};
|