@finalai/agents 0.13.0 → 0.15.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 +7 -1
- package/dist/modules/agent-client/api.d.mts +35 -0
- package/dist/modules/agent-client/api.mjs +110 -0
- package/dist/modules/agent-client/api.mjs.map +7 -0
- package/dist/modules/agent-client/channels.mjs +9 -1
- package/dist/modules/agent-client/channels.mjs.map +2 -2
- package/dist/modules/agent-client/client.d.mts +29 -7
- package/dist/modules/agent-client/client.mjs +15 -12
- package/dist/modules/agent-client/client.mjs.map +2 -2
- package/dist/modules/agent-client/conversations.d.mts +17 -25
- package/dist/modules/agent-client/conversations.mjs +10 -62
- package/dist/modules/agent-client/conversations.mjs.map +2 -2
- package/dist/modules/agent-client/defaults.d.mts +0 -4
- package/dist/modules/agent-client/defaults.mjs +1 -52
- package/dist/modules/agent-client/defaults.mjs.map +2 -2
- package/dist/modules/agent-client/index.d.mts +2 -33
- package/dist/modules/agent-client/index.mjs +3 -109
- package/dist/modules/agent-client/index.mjs.map +2 -2
- package/dist/modules/agent-client/integrations.d.mts +5 -1
- package/dist/modules/agent-client/integrations.mjs +9 -1
- package/dist/modules/agent-client/integrations.mjs.map +2 -2
- package/dist/modules/agent-client/node.d.mts +2 -0
- package/dist/modules/agent-client/node.mjs +62 -0
- package/dist/modules/agent-client/node.mjs.map +7 -0
- package/dist/modules/agent-client/organization.d.mts +83 -0
- package/dist/modules/agent-client/organization.mjs +209 -0
- package/dist/modules/agent-client/organization.mjs.map +7 -0
- package/dist/modules/agent-client/participant-configuration.d.mts +21 -0
- package/dist/modules/agent-client/participant-configuration.mjs +38 -0
- package/dist/modules/agent-client/participant-configuration.mjs.map +7 -0
- package/dist/modules/agent-client/portable.d.mts +3 -0
- package/dist/modules/agent-client/portable.mjs +28 -0
- package/dist/modules/agent-client/portable.mjs.map +7 -0
- package/dist/modules/agent-client/project.d.mts +3 -0
- package/dist/modules/agent-client/project.mjs +3 -1
- package/dist/modules/agent-client/project.mjs.map +2 -2
- package/dist/modules/agent-client/provide.d.mts +0 -1
- package/dist/modules/agent-client/provide.mjs +0 -1
- package/dist/modules/agent-client/provide.mjs.map +2 -2
- package/dist/modules/agent-client/sandboxes.d.mts +8 -1
- package/dist/modules/agent-client/sandboxes.mjs +9 -0
- package/dist/modules/agent-client/sandboxes.mjs.map +2 -2
- package/dist/modules/agent-client/sessions.d.mts +8 -1
- package/dist/modules/agent-client/sessions.mjs +24 -5
- package/dist/modules/agent-client/sessions.mjs.map +2 -2
- package/dist/modules/cli/cli.mjs +2 -1
- package/dist/modules/cli/cli.mjs.map +2 -2
- package/package.json +7 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type ParticipantConfigurationApiIface } from "./participant-configuration.mjs";
|
|
1
2
|
import { type ProcessInspectionRequestIface, type ProcessInspectionResultIface } from '@finalai/agent-protocol';
|
|
2
|
-
import { AgentSessionState, type
|
|
3
|
+
import { AgentSessionState, 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 ReactionIface, type ReadStateIface, type RespondDecisionResponseIface, type SandboxDirectoryIface, type SandboxEditorSessionIface, type SandboxFileIface, type SandboxPathIface, type SandboxPreviewType, type SandboxSearchIface, type SearchMessagesPageIface, type UpdateConversationRequestIface, type UpdateConversationScheduleRequestIface, type ScheduleRunResultIface, type UpdateParticipantRequestIface, type WireFallback } from '@finalai/agent-protocol/agent-platform';
|
|
3
4
|
import type { AgentInput } from "./agent-input.mjs";
|
|
4
5
|
import { type ConversationResourcesIface } from "./conversation-resources.mjs";
|
|
5
6
|
import { type CollectionEvent, type CollectionEventsOptionsIface } from "./collection-events.mjs";
|
|
@@ -104,6 +105,8 @@ export interface ParticipantsApiIface {
|
|
|
104
105
|
* `harness_unsuitable` for harness settings it cannot run on.
|
|
105
106
|
*/
|
|
106
107
|
provide: (participantId: string, patch: ProvidePatchIface, options?: SignalOptionsIface) => Promise<ParticipantProvideResponseIface>;
|
|
108
|
+
/** Changes to an agent participant's settings through proposals a manager decides. */
|
|
109
|
+
configuration: ParticipantConfigurationApiIface;
|
|
107
110
|
}
|
|
108
111
|
export interface SentMessageIface {
|
|
109
112
|
message: ConversationMessageIface;
|
|
@@ -138,9 +141,16 @@ export interface ConversationHandleIface extends ConversationResourcesIface {
|
|
|
138
141
|
send: (content: ContentInput, options?: SendMessageOptionsIface) => Promise<SentMessageIface>;
|
|
139
142
|
events: (options?: ConversationEventsOptionsIface) => AsyncIterableIterator<ConversationEvent>;
|
|
140
143
|
messages: (options?: ListMessagesOptionsIface) => Promise<ConversationMessagesPageIface>;
|
|
141
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* One message: by id (`GET /v1/conversations/:id/messages/:messageId`), e.g. a thread root,
|
|
146
|
+
* or the reply a turn's streamed text became, by the session seq its text started at (a
|
|
147
|
+
* preview's `fromSeq`).
|
|
148
|
+
*/
|
|
142
149
|
message: (args: {
|
|
143
150
|
messageId: string;
|
|
151
|
+
} | {
|
|
152
|
+
turnId: string;
|
|
153
|
+
fromSeq: number;
|
|
144
154
|
}, options?: SignalOptionsIface) => Promise<ConversationMessageIface>;
|
|
145
155
|
react: (args: {
|
|
146
156
|
messageId: string;
|
|
@@ -150,11 +160,6 @@ export interface ConversationHandleIface extends ConversationResourcesIface {
|
|
|
150
160
|
messageId: string;
|
|
151
161
|
emoji: string;
|
|
152
162
|
}, options?: SignalOptionsIface) => Promise<ReactionIface[]>;
|
|
153
|
-
recordPushOpen: (args: {
|
|
154
|
-
deliveryId: string;
|
|
155
|
-
}, options?: SignalOptionsIface) => Promise<{
|
|
156
|
-
recorded: boolean;
|
|
157
|
-
}>;
|
|
158
163
|
markRead: (args: {
|
|
159
164
|
throughSeq: number;
|
|
160
165
|
}, options?: SignalOptionsIface) => Promise<ReadStateIface>;
|
|
@@ -175,13 +180,6 @@ export interface ConversationHandleIface extends ConversationResourcesIface {
|
|
|
175
180
|
typing: (args: {
|
|
176
181
|
typing: boolean;
|
|
177
182
|
}, options?: SignalOptionsIface) => Promise<void>;
|
|
178
|
-
/**
|
|
179
|
-
* Hands something that happened outside the conversation (`POST …/events`)
|
|
180
|
-
* to its Default agent as input from you, not as a message: the agent's
|
|
181
|
-
* reply carries the source as its caption. The same `eventId` from the same
|
|
182
|
-
* source is accepted once; the receipt says whether the agent was prompted.
|
|
183
|
-
*/
|
|
184
|
-
postEvent: (event: PostConversationEventRequestIface, options?: SignalOptionsIface) => Promise<PostConversationEventResponseIface>;
|
|
185
183
|
respond: (args: RespondArgs, options?: SignalOptionsIface) => Promise<RespondDecisionResponseIface>;
|
|
186
184
|
/** Stops the agents' running turns in this conversation. */
|
|
187
185
|
cancel: (options?: SignalOptionsIface & {
|
|
@@ -371,16 +369,6 @@ export interface ProjectConversationsApiIface extends ConversationsApiIface {
|
|
|
371
369
|
* creating nothing, unless each agent's requirements are met.
|
|
372
370
|
*/
|
|
373
371
|
create: (args: CreateConversationArgsIface) => Promise<OpenedConversationIface>;
|
|
374
|
-
/**
|
|
375
|
-
* The caller's own Home thread with the project's agent, found or created.
|
|
376
|
-
* `provide` is stored only when the agent has no settings there yet.
|
|
377
|
-
*/
|
|
378
|
-
home: (args: {
|
|
379
|
-
id?: string;
|
|
380
|
-
provide: ProvideIface;
|
|
381
|
-
} & SignalOptionsIface) => Promise<OpenedConversationIface>;
|
|
382
|
-
/** The caller's Home thread, if there is one. Creates nothing. */
|
|
383
|
-
findHome: (options?: SignalOptionsIface) => Promise<ConversationIface | null>;
|
|
384
372
|
/**
|
|
385
373
|
* The caller's direct conversation with an agent, found or created.
|
|
386
374
|
* `provide` is stored only when the agent has no settings there yet.
|
|
@@ -420,10 +408,14 @@ export interface ConversationsApiIface {
|
|
|
420
408
|
}) => Promise<ConversationListIface>;
|
|
421
409
|
/** I/O-free handle. */
|
|
422
410
|
get: (conversationId: string) => ConversationHandleIface;
|
|
423
|
-
/**
|
|
411
|
+
/**
|
|
412
|
+
* Full-text search over the caller's conversations (or one, or those in a project and the
|
|
413
|
+
* projects below it), newest first.
|
|
414
|
+
*/
|
|
424
415
|
search: (args: {
|
|
425
416
|
q: string;
|
|
426
417
|
conversationId?: string;
|
|
418
|
+
projectId?: string;
|
|
427
419
|
cursor?: string;
|
|
428
420
|
limit?: number;
|
|
429
421
|
} & SignalOptionsIface) => Promise<SearchMessagesPageIface>;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createParticipantConfigurationApi
|
|
3
|
+
} from "./participant-configuration.mjs";
|
|
1
4
|
import {
|
|
2
5
|
PROCESS_CAPABILITIES,
|
|
3
6
|
ProcessInspectionOperation,
|
|
@@ -34,7 +37,6 @@ import {
|
|
|
34
37
|
scheduleRunResultSchema,
|
|
35
38
|
DecisionEventState,
|
|
36
39
|
decisionRecordListSchema,
|
|
37
|
-
homeConversationRequestSchema,
|
|
38
40
|
decisionsPageSchema,
|
|
39
41
|
markReadRequestSchema,
|
|
40
42
|
messageDeliveriesSchema,
|
|
@@ -47,10 +49,7 @@ import {
|
|
|
47
49
|
participantListSchema,
|
|
48
50
|
participantProvideResponseSchema,
|
|
49
51
|
participantSchema,
|
|
50
|
-
postConversationEventRequestSchema,
|
|
51
52
|
provideParticipantRequestSchema,
|
|
52
|
-
postConversationEventResponseSchema,
|
|
53
|
-
pushDeliveryOpenResponseSchema,
|
|
54
53
|
reactionRequestSchema,
|
|
55
54
|
reactionsResponseSchema,
|
|
56
55
|
readStateSchema,
|
|
@@ -722,7 +721,10 @@ const createConversationHandle = (context, conversationId, starter) => {
|
|
|
722
721
|
})).deliveries,
|
|
723
722
|
message: (args, options) => http.request({
|
|
724
723
|
method: HttpMethod.Get,
|
|
725
|
-
path: messagePath(conversationId, args.messageId)
|
|
724
|
+
path: "messageId" in args ? messagePath(conversationId, args.messageId) : conversationPath(
|
|
725
|
+
conversationId,
|
|
726
|
+
`/turns/${encodePath(args.turnId)}/messages/${args.fromSeq}`
|
|
727
|
+
),
|
|
726
728
|
response: conversationMessageSchema,
|
|
727
729
|
signal: options?.signal
|
|
728
730
|
}),
|
|
@@ -737,13 +739,6 @@ const createConversationHandle = (context, conversationId, starter) => {
|
|
|
737
739
|
signal: options?.signal
|
|
738
740
|
});
|
|
739
741
|
},
|
|
740
|
-
postEvent: (event, options) => http.request({
|
|
741
|
-
method: HttpMethod.Post,
|
|
742
|
-
path: conversationPath(conversationId, "/events"),
|
|
743
|
-
body: { schema: postConversationEventRequestSchema, value: event },
|
|
744
|
-
response: postConversationEventResponseSchema,
|
|
745
|
-
signal: options?.signal
|
|
746
|
-
}),
|
|
747
742
|
typing: async (args, options) => {
|
|
748
743
|
await http.request({
|
|
749
744
|
method: HttpMethod.Post,
|
|
@@ -753,15 +748,6 @@ const createConversationHandle = (context, conversationId, starter) => {
|
|
|
753
748
|
signal: options?.signal
|
|
754
749
|
});
|
|
755
750
|
},
|
|
756
|
-
recordPushOpen: (args, options) => http.request({
|
|
757
|
-
method: HttpMethod.Post,
|
|
758
|
-
path: conversationPath(
|
|
759
|
-
conversationId,
|
|
760
|
-
`/push-deliveries/${encodeURIComponent(args.deliveryId)}/open`
|
|
761
|
-
),
|
|
762
|
-
response: pushDeliveryOpenResponseSchema,
|
|
763
|
-
signal: options?.signal
|
|
764
|
-
}),
|
|
765
751
|
markRead: (args, options) => http.request({
|
|
766
752
|
method: HttpMethod.Post,
|
|
767
753
|
path: conversationPath(conversationId, "/read"),
|
|
@@ -819,7 +805,8 @@ const createConversationHandle = (context, conversationId, starter) => {
|
|
|
819
805
|
response: participantProvideResponseSchema,
|
|
820
806
|
signal: options?.signal
|
|
821
807
|
});
|
|
822
|
-
}
|
|
808
|
+
},
|
|
809
|
+
configuration: createParticipantConfigurationApi({ context, conversationId })
|
|
823
810
|
}
|
|
824
811
|
),
|
|
825
812
|
turns: async (options) => {
|
|
@@ -1189,6 +1176,7 @@ const createConversationsApi = (context, starter) => {
|
|
|
1189
1176
|
query: {
|
|
1190
1177
|
q: args.q,
|
|
1191
1178
|
conversationId: args.conversationId,
|
|
1179
|
+
projectId: args.projectId,
|
|
1192
1180
|
cursor: args.cursor,
|
|
1193
1181
|
limit: args.limit
|
|
1194
1182
|
},
|
|
@@ -1349,46 +1337,6 @@ const createProjectConversationsApi = (args) => {
|
|
|
1349
1337
|
}
|
|
1350
1338
|
return opened(conversation);
|
|
1351
1339
|
},
|
|
1352
|
-
home: async ({ id, provide, signal }) => {
|
|
1353
|
-
const document = provideDocumentOf(provide);
|
|
1354
|
-
const placed = document.harness == null ? null : await withWorkersEnvironment({
|
|
1355
|
-
context,
|
|
1356
|
-
projectId,
|
|
1357
|
-
harness: document.harness,
|
|
1358
|
-
owner: { kind: LocalHostOwnerKind.Conversation, id },
|
|
1359
|
-
signal
|
|
1360
|
-
});
|
|
1361
|
-
const homeId = placed?.ownerId ?? id;
|
|
1362
|
-
const discard = () => void placed?.created?.discard().catch(() => void 0);
|
|
1363
|
-
try {
|
|
1364
|
-
const { conversation } = await context.http.request({
|
|
1365
|
-
method: HttpMethod.Post,
|
|
1366
|
-
path: "/v1/conversations/home",
|
|
1367
|
-
body: {
|
|
1368
|
-
schema: homeConversationRequestSchema,
|
|
1369
|
-
value: {
|
|
1370
|
-
projectId,
|
|
1371
|
-
id: homeId,
|
|
1372
|
-
provide: placed == null ? document : { ...document, harness: placed.harness }
|
|
1373
|
-
}
|
|
1374
|
-
},
|
|
1375
|
-
response: conversationResponseSchema,
|
|
1376
|
-
signal
|
|
1377
|
-
});
|
|
1378
|
-
if (conversation.id !== homeId) discard();
|
|
1379
|
-
return opened(conversation);
|
|
1380
|
-
} catch (cause) {
|
|
1381
|
-
discard();
|
|
1382
|
-
throw cause;
|
|
1383
|
-
}
|
|
1384
|
-
},
|
|
1385
|
-
findHome: async (options) => (await context.http.request({
|
|
1386
|
-
method: HttpMethod.Get,
|
|
1387
|
-
path: "/v1/conversations/home",
|
|
1388
|
-
query: { projectId },
|
|
1389
|
-
response: conversationLookupSchema,
|
|
1390
|
-
signal: options?.signal
|
|
1391
|
-
})).conversation,
|
|
1392
1340
|
direct: async ({ id, agent, provide, actor, signal }) => {
|
|
1393
1341
|
const started = await startAgent(args.start, {
|
|
1394
1342
|
projectId,
|