lemma-sdk 0.2.37 → 0.2.40
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 +30 -14
- package/dist/browser/lemma-client.js +260 -206
- package/dist/client.d.ts +2 -2
- package/dist/client.js +3 -3
- package/dist/index.d.ts +2 -4
- package/dist/index.js +1 -2
- package/dist/namespaces/conversations.d.ts +0 -5
- package/dist/namespaces/conversations.js +0 -15
- package/dist/namespaces/pod-members.d.ts +5 -3
- package/dist/namespaces/pod-members.js +12 -6
- package/dist/namespaces/schedules.d.ts +22 -0
- package/dist/namespaces/schedules.js +24 -0
- package/dist/namespaces/workflows.d.ts +4 -5
- package/dist/namespaces/workflows.js +1 -4
- package/dist/openapi_client/index.d.ts +12 -12
- package/dist/openapi_client/index.js +5 -3
- package/dist/openapi_client/models/AgentModelName.d.ts +1 -1
- package/dist/openapi_client/models/AgentModelName.js +1 -1
- package/dist/openapi_client/models/CreateScheduleRequest.d.ts +14 -0
- package/dist/openapi_client/models/FlowResponse.d.ts +2 -2
- package/dist/openapi_client/models/FlowRunEntity.d.ts +5 -4
- package/dist/openapi_client/models/FormNodeConfig.d.ts +8 -0
- package/dist/openapi_client/models/MessageResponse.d.ts +0 -1
- package/dist/openapi_client/models/PodConfigResponse.d.ts +0 -2
- package/dist/openapi_client/models/PodMemberDetailResponse.d.ts +2 -0
- package/dist/openapi_client/models/PodMemberResponse.d.ts +2 -0
- package/dist/openapi_client/models/ScheduleListResponse.d.ts +9 -0
- package/dist/openapi_client/models/{TriggerResponse.d.ts → ScheduleResponse.d.ts} +8 -4
- package/dist/openapi_client/models/{TriggerType.d.ts → ScheduleType.d.ts} +2 -2
- package/dist/openapi_client/models/ScheduleType.js +13 -0
- package/dist/openapi_client/models/ScheduledFlowStartInput.d.ts +1 -1
- package/dist/openapi_client/models/ScheduledFlowStartOutput.d.ts +1 -1
- package/dist/openapi_client/models/SendMessageRequest.d.ts +0 -2
- package/dist/openapi_client/models/{UpdateTriggerRequest.d.ts → UpdateScheduleRequest.d.ts} +4 -2
- package/dist/openapi_client/models/WorkflowCreateRequest.d.ts +3 -3
- package/dist/openapi_client/models/WorkflowMode.d.ts +7 -0
- package/dist/openapi_client/models/WorkflowMode.js +12 -0
- package/dist/openapi_client/models/WorkflowRunWaitAssignment.d.ts +6 -0
- package/dist/openapi_client/models/WorkflowRunWaitAssignmentListResponse.d.ts +6 -0
- package/dist/openapi_client/models/WorkflowRunWaitEntity.d.ts +20 -0
- package/dist/openapi_client/models/WorkflowRunWaitStatus.d.ts +6 -0
- package/dist/openapi_client/models/WorkflowRunWaitStatus.js +11 -0
- package/dist/openapi_client/models/WorkflowRunWaitType.d.ts +7 -0
- package/dist/openapi_client/models/WorkflowRunWaitType.js +12 -0
- package/dist/openapi_client/models/WorkflowUpdateRequest.d.ts +3 -3
- package/dist/openapi_client/services/AgentConversationsService.d.ts +4 -14
- package/dist/openapi_client/services/AgentConversationsService.js +4 -30
- package/dist/openapi_client/services/PodMembersService.d.ts +25 -7
- package/dist/openapi_client/services/PodMembersService.js +57 -13
- package/dist/openapi_client/services/SchedulesService.d.ts +59 -0
- package/dist/openapi_client/services/SchedulesService.js +125 -0
- package/dist/openapi_client/services/WebhooksService.d.ts +4 -4
- package/dist/openapi_client/services/WebhooksService.js +6 -6
- package/dist/openapi_client/services/WorkflowsService.d.ts +12 -33
- package/dist/openapi_client/services/WorkflowsService.js +26 -69
- package/dist/react/AuthGuard.js +1 -1
- package/dist/react/index.d.ts +10 -8
- package/dist/react/index.js +5 -4
- package/dist/react/useAssistantController.js +0 -2
- package/dist/react/useAssistantSession.d.ts +0 -2
- package/dist/react/useAssistantSession.js +8 -14
- package/dist/react/useCreateSchedule.d.ts +17 -0
- package/dist/react/useCreateSchedule.js +45 -0
- package/dist/react/useDeleteSchedule.d.ts +19 -0
- package/dist/react/useDeleteSchedule.js +49 -0
- package/dist/react/usePodAccess.js +1 -1
- package/dist/react/useSchedules.d.ts +30 -0
- package/dist/react/useSchedules.js +123 -0
- package/dist/react/useUpdateSchedule.d.ts +20 -0
- package/dist/react/useUpdateSchedule.js +49 -0
- package/dist/react/useWorkflowRun.js +1 -1
- package/dist/react/useWorkflowRunWaitAssignments.d.ts +26 -0
- package/dist/react/useWorkflowRunWaitAssignments.js +102 -0
- package/dist/react/useWorkflowStart.js +1 -1
- package/dist/run-utils.d.ts +1 -5
- package/dist/run-utils.js +0 -10
- package/dist/types.d.ts +3 -43
- package/package.json +1 -1
- package/dist/namespaces/tasks.d.ts +0 -25
- package/dist/namespaces/tasks.js +0 -91
- package/dist/openapi_client/models/CreateTriggerRequest.d.ts +0 -13
- package/dist/openapi_client/models/FlowInstallResponse.d.ts +0 -15
- package/dist/openapi_client/models/PodFlowConfigItem.d.ts +0 -7
- package/dist/openapi_client/models/TriggerListResponse.d.ts +0 -9
- package/dist/openapi_client/models/TriggerType.js +0 -13
- package/dist/openapi_client/models/WorkflowInstallListResponse.d.ts +0 -4
- package/dist/openapi_client/models/WorkflowInstallMode.d.ts +0 -7
- package/dist/openapi_client/models/WorkflowInstallMode.js +0 -12
- package/dist/openapi_client/models/WorkflowInstallRequest.d.ts +0 -11
- package/dist/openapi_client/models/WorkflowInstallRequest.js +0 -1
- package/dist/openapi_client/models/WorkflowTimeInstallConfig.d.ts +0 -19
- package/dist/openapi_client/models/WorkflowTimeInstallConfig.js +0 -1
- package/dist/openapi_client/services/TriggersService.d.ts +0 -53
- package/dist/openapi_client/services/TriggersService.js +0 -109
- package/dist/react/useAgentRun.d.ts +0 -38
- package/dist/react/useAgentRun.js +0 -149
- package/dist/react/useAgentRuns.d.ts +0 -33
- package/dist/react/useAgentRuns.js +0 -149
- package/dist/react/useAssistantRun.d.ts +0 -27
- package/dist/react/useAssistantRun.js +0 -47
- package/dist/react/useTaskSession.d.ts +0 -35
- package/dist/react/useTaskSession.js +0 -269
- package/dist/task-events.d.ts +0 -8
- package/dist/task-events.js +0 -115
- /package/dist/openapi_client/models/{CreateTriggerRequest.js → CreateScheduleRequest.js} +0 -0
- /package/dist/openapi_client/models/{FlowInstallResponse.js → ScheduleListResponse.js} +0 -0
- /package/dist/openapi_client/models/{PodFlowConfigItem.js → ScheduleResponse.js} +0 -0
- /package/dist/openapi_client/models/{TriggerListResponse.js → UpdateScheduleRequest.js} +0 -0
- /package/dist/openapi_client/models/{TriggerResponse.js → WorkflowRunWaitAssignment.js} +0 -0
- /package/dist/openapi_client/models/{UpdateTriggerRequest.js → WorkflowRunWaitAssignmentListResponse.js} +0 -0
- /package/dist/openapi_client/models/{WorkflowInstallListResponse.js → WorkflowRunWaitEntity.js} +0 -0
|
@@ -33,7 +33,7 @@ export function useWorkflowRun({ workflowName, ...options }) {
|
|
|
33
33
|
const isWaitingForInput = normalizedStatus === "WAITING"
|
|
34
34
|
|| !!session.run?.waiting_agent_conversation_id
|
|
35
35
|
|| !!session.run?.waiting_function_run_id
|
|
36
|
-
|| !!session.run?.
|
|
36
|
+
|| !!session.run?.waiting_timer_id;
|
|
37
37
|
const output = session.run?.execution_context ?? null;
|
|
38
38
|
const finalOutput = isFinished ? output : null;
|
|
39
39
|
return {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LemmaClient } from "../client.js";
|
|
2
|
+
import type { WorkflowRunWait } from "../types.js";
|
|
3
|
+
export interface UseWorkflowRunWaitAssignmentsOptions {
|
|
4
|
+
client: LemmaClient;
|
|
5
|
+
podId?: string;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
autoLoad?: boolean;
|
|
8
|
+
limit?: number;
|
|
9
|
+
pageToken?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface UseWorkflowRunWaitAssignmentsResult {
|
|
12
|
+
assignments: WorkflowRunWait[];
|
|
13
|
+
total: number;
|
|
14
|
+
nextPageToken: string | null;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
isLoadingMore: boolean;
|
|
17
|
+
error: Error | null;
|
|
18
|
+
refresh: (overrides?: {
|
|
19
|
+
limit?: number;
|
|
20
|
+
pageToken?: string | null;
|
|
21
|
+
}) => Promise<WorkflowRunWait[]>;
|
|
22
|
+
loadMore: (overrides?: {
|
|
23
|
+
limit?: number;
|
|
24
|
+
}) => Promise<WorkflowRunWait[]>;
|
|
25
|
+
}
|
|
26
|
+
export declare function useWorkflowRunWaitAssignments({ client, podId, enabled, autoLoad, limit, pageToken, }: UseWorkflowRunWaitAssignmentsOptions): UseWorkflowRunWaitAssignmentsResult;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
+
export function useWorkflowRunWaitAssignments({ client, podId, enabled = true, autoLoad = true, limit = 100, pageToken = null, }) {
|
|
4
|
+
const [assignments, setAssignments] = useState([]);
|
|
5
|
+
const [total, setTotal] = useState(0);
|
|
6
|
+
const [nextPageToken, setNextPageToken] = useState(null);
|
|
7
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
8
|
+
const [isLoadingMore, setIsLoadingMore] = useState(false);
|
|
9
|
+
const [error, setError] = useState(null);
|
|
10
|
+
const refresh = useCallback(async (overrides = {}, signal) => {
|
|
11
|
+
if (!enabled) {
|
|
12
|
+
setAssignments([]);
|
|
13
|
+
setTotal(0);
|
|
14
|
+
setNextPageToken(null);
|
|
15
|
+
setError(null);
|
|
16
|
+
setIsLoading(false);
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
setIsLoading(true);
|
|
20
|
+
setError(null);
|
|
21
|
+
try {
|
|
22
|
+
const scopedClient = resolvePodClient(client, podId);
|
|
23
|
+
const response = await scopedClient.workflows.runs.waitingAssignedToMe({
|
|
24
|
+
limit: overrides.limit ?? limit,
|
|
25
|
+
pageToken: overrides.pageToken ?? pageToken ?? undefined,
|
|
26
|
+
});
|
|
27
|
+
if (signal?.aborted)
|
|
28
|
+
return [];
|
|
29
|
+
const nextAssignments = response.items ?? [];
|
|
30
|
+
setAssignments(nextAssignments);
|
|
31
|
+
setTotal(response.total ?? nextAssignments.length);
|
|
32
|
+
setNextPageToken(response.next_page_token ?? null);
|
|
33
|
+
return nextAssignments;
|
|
34
|
+
}
|
|
35
|
+
catch (refreshError) {
|
|
36
|
+
if (signal?.aborted)
|
|
37
|
+
return [];
|
|
38
|
+
const normalized = normalizeError(refreshError, "Failed to load waiting workflow runs.");
|
|
39
|
+
setError(normalized);
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
if (!signal?.aborted)
|
|
44
|
+
setIsLoading(false);
|
|
45
|
+
}
|
|
46
|
+
}, [client, enabled, limit, pageToken, podId]);
|
|
47
|
+
const loadMore = useCallback(async (overrides = {}) => {
|
|
48
|
+
if (!enabled || !nextPageToken || isLoading || isLoadingMore) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
setIsLoadingMore(true);
|
|
52
|
+
setError(null);
|
|
53
|
+
try {
|
|
54
|
+
const scopedClient = resolvePodClient(client, podId);
|
|
55
|
+
const response = await scopedClient.workflows.runs.waitingAssignedToMe({
|
|
56
|
+
limit: overrides.limit ?? limit,
|
|
57
|
+
pageToken: nextPageToken,
|
|
58
|
+
});
|
|
59
|
+
const moreAssignments = response.items ?? [];
|
|
60
|
+
setAssignments((previous) => [...previous, ...moreAssignments]);
|
|
61
|
+
setTotal(response.total ?? assignments.length + moreAssignments.length);
|
|
62
|
+
setNextPageToken(response.next_page_token ?? null);
|
|
63
|
+
return moreAssignments;
|
|
64
|
+
}
|
|
65
|
+
catch (loadError) {
|
|
66
|
+
const normalized = normalizeError(loadError, "Failed to load more waiting workflow runs.");
|
|
67
|
+
setError(normalized);
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
setIsLoadingMore(false);
|
|
72
|
+
}
|
|
73
|
+
}, [assignments.length, client, enabled, isLoading, isLoadingMore, limit, nextPageToken, podId]);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!enabled) {
|
|
76
|
+
setAssignments([]);
|
|
77
|
+
setTotal(0);
|
|
78
|
+
setNextPageToken(null);
|
|
79
|
+
setError(null);
|
|
80
|
+
setIsLoading(false);
|
|
81
|
+
setIsLoadingMore(false);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!autoLoad)
|
|
85
|
+
return;
|
|
86
|
+
const controller = new AbortController();
|
|
87
|
+
void refresh({}, controller.signal);
|
|
88
|
+
return () => {
|
|
89
|
+
controller.abort();
|
|
90
|
+
};
|
|
91
|
+
}, [autoLoad, enabled, refresh]);
|
|
92
|
+
return useMemo(() => ({
|
|
93
|
+
assignments,
|
|
94
|
+
total,
|
|
95
|
+
nextPageToken,
|
|
96
|
+
isLoading,
|
|
97
|
+
isLoadingMore,
|
|
98
|
+
error,
|
|
99
|
+
refresh,
|
|
100
|
+
loadMore,
|
|
101
|
+
}), [assignments, error, isLoading, isLoadingMore, loadMore, nextPageToken, refresh, total]);
|
|
102
|
+
}
|
|
@@ -23,7 +23,7 @@ function isWaitingFlowRun(run) {
|
|
|
23
23
|
return normalizedStatus === "WAITING"
|
|
24
24
|
|| !!run.waiting_function_run_id
|
|
25
25
|
|| !!run.waiting_agent_conversation_id
|
|
26
|
-
|| !!run.
|
|
26
|
+
|| !!run.waiting_timer_id;
|
|
27
27
|
}
|
|
28
28
|
export function useWorkflowStart({ client, podId, workflowName, runId = null, enabled = true, autoLoad = true, autoPoll = true, pollIntervalMs = 2000, onRun, onError, }) {
|
|
29
29
|
const [workflow, setWorkflow] = useState(null);
|
package/dist/run-utils.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import type { FlowRunStatus, FunctionRunStatus } from "./openapi_client/index.js";
|
|
2
|
-
|
|
3
|
-
export type AnyRunStatus = TaskStatus | FunctionRunStatus | FlowRunStatus | (string & {});
|
|
2
|
+
export type AnyRunStatus = FunctionRunStatus | FlowRunStatus | (string & {});
|
|
4
3
|
interface BackoffOptions {
|
|
5
4
|
baseMs?: number;
|
|
6
5
|
maxMs?: number;
|
|
7
6
|
factor?: number;
|
|
8
7
|
}
|
|
9
8
|
export declare function normalizeRunStatus(status: unknown): string | undefined;
|
|
10
|
-
export declare function isTerminalTaskStatus(status: unknown, options?: {
|
|
11
|
-
treatWaitingAsTerminal?: boolean;
|
|
12
|
-
}): boolean;
|
|
13
9
|
export declare function isTerminalFunctionStatus(status: unknown): boolean;
|
|
14
10
|
export declare function isTerminalFlowStatus(status: unknown, options?: {
|
|
15
11
|
treatWaitingAsTerminal?: boolean;
|
package/dist/run-utils.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const TASK_TERMINAL = new Set(["COMPLETED", "FAILED", "CANCELLED", "STOPPED"]);
|
|
2
1
|
const FUNCTION_TERMINAL = new Set(["COMPLETED", "FAILED", "CANCELLED"]);
|
|
3
2
|
const FLOW_TERMINAL = new Set(["COMPLETED", "FAILED", "CANCELLED"]);
|
|
4
3
|
export function normalizeRunStatus(status) {
|
|
@@ -8,15 +7,6 @@ export function normalizeRunStatus(status) {
|
|
|
8
7
|
const normalized = status.trim().toUpperCase();
|
|
9
8
|
return normalized.length > 0 ? normalized : undefined;
|
|
10
9
|
}
|
|
11
|
-
export function isTerminalTaskStatus(status, options = {}) {
|
|
12
|
-
const normalized = normalizeRunStatus(status);
|
|
13
|
-
if (!normalized)
|
|
14
|
-
return false;
|
|
15
|
-
if (normalized === "WAITING") {
|
|
16
|
-
return options.treatWaitingAsTerminal === true;
|
|
17
|
-
}
|
|
18
|
-
return TASK_TERMINAL.has(normalized);
|
|
19
|
-
}
|
|
20
10
|
export function isTerminalFunctionStatus(status) {
|
|
21
11
|
const normalized = normalizeRunStatus(status);
|
|
22
12
|
return !!normalized && FUNCTION_TERMINAL.has(normalized);
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelName, AgentResponse, ColumnSchema, ConversationResponse as GeneratedConversationResponse, CreateAgentRequest, DatastoreQueryResponse, DirectoryTreeNode, DirectoryTreeResponse, FileResponse, FileNamespace, FileSearchResponse, FileSearchResultSchema, FlowRunEntity, FlowResponse, FunctionRunResponse, IconUploadResponse, OrganizationInvitationResponse, OrganizationMemberResponse, OrganizationResponse, PodConfigResponse, PodJoinRequestCreateResponse, PodMemberResponse, PodResponse, TableResponse, UpdateAgentRequest, UserResponse } from "./openapi_client/index.js";
|
|
1
|
+
import type { AgentModelName, AgentResponse, ColumnSchema, ConversationResponse as GeneratedConversationResponse, CreateAgentRequest, DatastoreQueryResponse, DirectoryTreeNode, DirectoryTreeResponse, FileResponse, FileNamespace, FileSearchResponse, FileSearchResultSchema, FlowRunEntity, FlowResponse, FunctionRunResponse, IconUploadResponse, OrganizationInvitationResponse, OrganizationMemberResponse, OrganizationResponse, PodConfigResponse, PodJoinRequestCreateResponse, PodMemberResponse, PodResponse, ScheduleResponse, TableResponse, UpdateAgentRequest, UserResponse, WorkflowRunWaitAssignment } from "./openapi_client/index.js";
|
|
2
2
|
/** Public ergonomic types. */
|
|
3
3
|
export interface AvailableModelInfo {
|
|
4
4
|
id: ConversationModel;
|
|
@@ -35,8 +35,6 @@ export interface RunFunctionOptions {
|
|
|
35
35
|
/** Input payload for the function */
|
|
36
36
|
input?: Record<string, unknown>;
|
|
37
37
|
}
|
|
38
|
-
/** Alias kept for backward compatibility; shape follows generated OpenAPI schema exactly. */
|
|
39
|
-
export type CreateTaskOptions = CreateTaskRequest;
|
|
40
38
|
export interface WorkflowRunInputs {
|
|
41
39
|
[key: string]: unknown;
|
|
42
40
|
}
|
|
@@ -59,56 +57,18 @@ export interface ConversationMessageResponse {
|
|
|
59
57
|
created_at: string;
|
|
60
58
|
conversation_id?: string;
|
|
61
59
|
sequence?: number;
|
|
62
|
-
agent_run_id?: string | null;
|
|
63
60
|
metadata?: Record<string, unknown> | null;
|
|
64
61
|
tool_call_id?: string | null;
|
|
65
62
|
tool_name?: string | null;
|
|
66
63
|
}
|
|
67
64
|
export type ConversationMessage = ConversationMessageResponse;
|
|
68
|
-
export type TaskStatus = "PENDING" | "RUNNING" | "WAITING" | "COMPLETED" | "FAILED" | "CANCELLED" | "STOPPED" | (string & {});
|
|
69
|
-
export interface CreateTaskRequest {
|
|
70
|
-
agent_name: string;
|
|
71
|
-
input_data?: Record<string, unknown> | null;
|
|
72
|
-
title?: string | null;
|
|
73
|
-
conversation_id?: string | null;
|
|
74
|
-
content?: string | null;
|
|
75
|
-
}
|
|
76
|
-
export interface AddMessageRequest {
|
|
77
|
-
content: string;
|
|
78
|
-
}
|
|
79
|
-
export interface TaskResponse {
|
|
80
|
-
id: string;
|
|
81
|
-
agent_id?: string | null;
|
|
82
|
-
agent_name?: string | null;
|
|
83
|
-
pod_id: string;
|
|
84
|
-
user_id?: string;
|
|
85
|
-
input_data?: Record<string, unknown> | null;
|
|
86
|
-
output_data?: unknown;
|
|
87
|
-
error?: string | null;
|
|
88
|
-
status?: TaskStatus;
|
|
89
|
-
created_at?: string;
|
|
90
|
-
updated_at?: string;
|
|
91
|
-
conversation?: Conversation;
|
|
92
|
-
}
|
|
93
|
-
export interface TaskListResponse {
|
|
94
|
-
items: TaskResponse[];
|
|
95
|
-
limit: number;
|
|
96
|
-
next_page_token?: string | null;
|
|
97
|
-
total?: number;
|
|
98
|
-
}
|
|
99
|
-
export type TaskMessageResponse = ConversationMessageResponse;
|
|
100
|
-
export interface TaskMessageListResponse {
|
|
101
|
-
items: TaskMessageResponse[];
|
|
102
|
-
limit: number;
|
|
103
|
-
next_page_token?: string | null;
|
|
104
|
-
}
|
|
105
|
-
export type Task = TaskResponse;
|
|
106
|
-
export type TaskMessage = TaskMessageResponse;
|
|
107
65
|
export type FunctionRun = FunctionRunResponse;
|
|
108
66
|
export type FlowRun = FlowRunEntity;
|
|
109
67
|
export type Workflow = FlowResponse;
|
|
110
68
|
export type WorkflowStart = Workflow["start"];
|
|
111
69
|
export type WorkflowStartType = NonNullable<WorkflowStart>["type"];
|
|
70
|
+
export type Schedule = ScheduleResponse;
|
|
71
|
+
export type WorkflowRunWait = WorkflowRunWaitAssignment;
|
|
112
72
|
export type Table = TableResponse;
|
|
113
73
|
export type TableColumn = ColumnSchema;
|
|
114
74
|
export type DatastoreQueryResult = DatastoreQueryResponse;
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { AddMessageRequest, CreateTaskRequest, TaskListResponse, TaskMessageListResponse, TaskResponse } from "../types.js";
|
|
3
|
-
export declare class TasksNamespace {
|
|
4
|
-
private readonly http;
|
|
5
|
-
private readonly podId;
|
|
6
|
-
constructor(http: HttpClient, podId: () => string);
|
|
7
|
-
list(options?: {
|
|
8
|
-
agent_name?: string;
|
|
9
|
-
limit?: number;
|
|
10
|
-
page_token?: string;
|
|
11
|
-
}): Promise<TaskListResponse>;
|
|
12
|
-
create(payload: CreateTaskRequest): Promise<TaskResponse>;
|
|
13
|
-
get(taskId: string): Promise<TaskResponse>;
|
|
14
|
-
stop(taskId: string): Promise<TaskResponse>;
|
|
15
|
-
stream(taskId: string, options?: {
|
|
16
|
-
signal?: AbortSignal;
|
|
17
|
-
}): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
18
|
-
readonly messages: {
|
|
19
|
-
list: (taskId: string, options?: {
|
|
20
|
-
limit?: number;
|
|
21
|
-
page_token?: string;
|
|
22
|
-
}) => Promise<TaskMessageListResponse>;
|
|
23
|
-
add: (taskId: string, payload: AddMessageRequest) => Promise<TaskResponse>;
|
|
24
|
-
};
|
|
25
|
-
}
|
package/dist/namespaces/tasks.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
function toTask(conversation, inputData) {
|
|
2
|
-
return {
|
|
3
|
-
id: conversation.id,
|
|
4
|
-
agent_id: conversation.agent_id,
|
|
5
|
-
pod_id: conversation.pod_id,
|
|
6
|
-
user_id: conversation.user_id,
|
|
7
|
-
input_data: inputData ?? null,
|
|
8
|
-
output_data: null,
|
|
9
|
-
error: null,
|
|
10
|
-
status: conversation.status?.toUpperCase() ?? "WAITING",
|
|
11
|
-
created_at: conversation.created_at,
|
|
12
|
-
updated_at: conversation.updated_at,
|
|
13
|
-
conversation,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function normalizeConversation(conversation) {
|
|
17
|
-
return {
|
|
18
|
-
...conversation,
|
|
19
|
-
model: conversation.model ?? conversation.model_name ?? null,
|
|
20
|
-
status: conversation.status ?? "waiting",
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function normalizeMessages(messages) {
|
|
24
|
-
return messages;
|
|
25
|
-
}
|
|
26
|
-
export class TasksNamespace {
|
|
27
|
-
http;
|
|
28
|
-
podId;
|
|
29
|
-
constructor(http, podId) {
|
|
30
|
-
this.http = http;
|
|
31
|
-
this.podId = podId;
|
|
32
|
-
}
|
|
33
|
-
list(options = {}) {
|
|
34
|
-
return this.http.request("GET", `/pods/${this.podId()}/conversations`, {
|
|
35
|
-
params: {
|
|
36
|
-
agent_name: options.agent_name,
|
|
37
|
-
limit: options.limit ?? 100,
|
|
38
|
-
page_token: options.page_token,
|
|
39
|
-
},
|
|
40
|
-
}).then((response) => {
|
|
41
|
-
const conversations = (response.items ?? []).map(normalizeConversation);
|
|
42
|
-
return {
|
|
43
|
-
items: conversations.map((conversation) => toTask(conversation)),
|
|
44
|
-
limit: response.limit ?? options.limit ?? 100,
|
|
45
|
-
next_page_token: response.next_page_token ?? null,
|
|
46
|
-
total: response.total,
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
create(payload) {
|
|
51
|
-
return this.http.request("POST", `/pods/${this.podId()}/conversations`, {
|
|
52
|
-
body: {
|
|
53
|
-
agent_name: payload.agent_name,
|
|
54
|
-
title: payload.title ?? payload.content ?? payload.agent_name,
|
|
55
|
-
},
|
|
56
|
-
}).then((conversation) => toTask(normalizeConversation(conversation), payload.input_data));
|
|
57
|
-
}
|
|
58
|
-
get(taskId) {
|
|
59
|
-
return this.http.request("GET", `/pods/${this.podId()}/conversations/${taskId}`)
|
|
60
|
-
.then((conversation) => toTask(normalizeConversation(conversation)));
|
|
61
|
-
}
|
|
62
|
-
stop(taskId) {
|
|
63
|
-
return this.http.request("POST", `/pods/${this.podId()}/conversations/${taskId}/stop`, {
|
|
64
|
-
body: {},
|
|
65
|
-
}).then((conversation) => toTask(normalizeConversation(conversation)));
|
|
66
|
-
}
|
|
67
|
-
stream(taskId, options = {}) {
|
|
68
|
-
return this.http.stream(`/pods/${this.podId()}/conversations/${taskId}/stream`, {
|
|
69
|
-
signal: options.signal,
|
|
70
|
-
headers: {
|
|
71
|
-
Accept: "text/event-stream",
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
messages = {
|
|
76
|
-
list: (taskId, options = {}) => this.http.request("GET", `/pods/${this.podId()}/conversations/${taskId}/messages`, {
|
|
77
|
-
params: {
|
|
78
|
-
limit: options.limit ?? 100,
|
|
79
|
-
after_sequence: options.page_token,
|
|
80
|
-
},
|
|
81
|
-
}).then((response) => ({
|
|
82
|
-
...response,
|
|
83
|
-
items: normalizeMessages(response.items ?? []),
|
|
84
|
-
})),
|
|
85
|
-
add: (taskId, payload) => {
|
|
86
|
-
return this.http.request("POST", `/pods/${this.podId()}/conversations/${taskId}/messages`, {
|
|
87
|
-
body: payload,
|
|
88
|
-
}).then(() => this.get(taskId));
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { TriggerType } from './TriggerType.js';
|
|
2
|
-
/**
|
|
3
|
-
* Request to create a trigger.
|
|
4
|
-
*/
|
|
5
|
-
export type CreateTriggerRequest = {
|
|
6
|
-
account_id?: (string | null);
|
|
7
|
-
application_trigger_id?: (string | null);
|
|
8
|
-
config?: Record<string, any>;
|
|
9
|
-
filter_instruction?: (string | null);
|
|
10
|
-
filter_output_schema?: (Record<string, any> | null);
|
|
11
|
-
pod_id?: (string | null);
|
|
12
|
-
trigger_type: TriggerType;
|
|
13
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { DataStoreWorkflowStartOutput } from './DataStoreWorkflowStartOutput.js';
|
|
2
|
-
import type { EventWorkflowStartOutput } from './EventWorkflowStartOutput.js';
|
|
3
|
-
import type { ManualWorkflowStartOutput } from './ManualWorkflowStartOutput.js';
|
|
4
|
-
import type { ScheduledWorkflowStartOutput } from './ScheduledWorkflowStartOutput.js';
|
|
5
|
-
export type FlowInstallResponse = {
|
|
6
|
-
created_at: string;
|
|
7
|
-
flow_id: string;
|
|
8
|
-
flow_start: (ManualWorkflowStartOutput | ScheduledWorkflowStartOutput | EventWorkflowStartOutput | DataStoreWorkflowStartOutput);
|
|
9
|
-
id: string;
|
|
10
|
-
is_active?: boolean;
|
|
11
|
-
pod_id: string;
|
|
12
|
-
trigger_id?: (string | null);
|
|
13
|
-
updated_at: string;
|
|
14
|
-
user_id: string;
|
|
15
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
/**
|
|
6
|
-
* Type of trigger.
|
|
7
|
-
*/
|
|
8
|
-
export var TriggerType;
|
|
9
|
-
(function (TriggerType) {
|
|
10
|
-
TriggerType["TIME"] = "TIME";
|
|
11
|
-
TriggerType["WEBHOOK"] = "WEBHOOK";
|
|
12
|
-
TriggerType["DATASTORE"] = "DATASTORE";
|
|
13
|
-
})(TriggerType || (TriggerType = {}));
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
/**
|
|
6
|
-
* Workflow install scope for non-manual starts.
|
|
7
|
-
*/
|
|
8
|
-
export var WorkflowInstallMode;
|
|
9
|
-
(function (WorkflowInstallMode) {
|
|
10
|
-
WorkflowInstallMode["GLOBAL"] = "GLOBAL";
|
|
11
|
-
WorkflowInstallMode["USER"] = "USER";
|
|
12
|
-
})(WorkflowInstallMode || (WorkflowInstallMode = {}));
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { WorkflowTimeInstallConfig } from './WorkflowTimeInstallConfig.js';
|
|
2
|
-
export type WorkflowInstallRequest = {
|
|
3
|
-
/**
|
|
4
|
-
* Optional integration account to bind when installing an event-driven workflow. Scheduled and datastore-event workflows usually do not need this.
|
|
5
|
-
*/
|
|
6
|
-
account_id?: (string | null);
|
|
7
|
-
/**
|
|
8
|
-
* Concrete time trigger settings for scheduled workflows. Provide either a one-time `time` or a recurring `cron_expression`.
|
|
9
|
-
*/
|
|
10
|
-
schedule?: (WorkflowTimeInstallConfig | null);
|
|
11
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ScheduledFlowStartType } from './ScheduledFlowStartType.js';
|
|
2
|
-
export type WorkflowTimeInstallConfig = {
|
|
3
|
-
/**
|
|
4
|
-
* Cron expression for `CRON` schedules.
|
|
5
|
-
*/
|
|
6
|
-
cron_expression?: (string | null);
|
|
7
|
-
/**
|
|
8
|
-
* Concrete time trigger mode to install: `ONCE` or `CRON`.
|
|
9
|
-
*/
|
|
10
|
-
schedule_type: ScheduledFlowStartType;
|
|
11
|
-
/**
|
|
12
|
-
* One-time execution timestamp for `ONCE` schedules.
|
|
13
|
-
*/
|
|
14
|
-
time?: (string | null);
|
|
15
|
-
/**
|
|
16
|
-
* IANA timezone used for cron evaluation or naive one-time values.
|
|
17
|
-
*/
|
|
18
|
-
timezone?: (string | null);
|
|
19
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { CreateTriggerRequest } from '../models/CreateTriggerRequest.js';
|
|
2
|
-
import type { TriggerListResponse } from '../models/TriggerListResponse.js';
|
|
3
|
-
import type { TriggerResponse } from '../models/TriggerResponse.js';
|
|
4
|
-
import type { TriggerType } from '../models/TriggerType.js';
|
|
5
|
-
import type { UpdateTriggerRequest } from '../models/UpdateTriggerRequest.js';
|
|
6
|
-
import type { CancelablePromise } from '../core/CancelablePromise.js';
|
|
7
|
-
export declare class TriggersService {
|
|
8
|
-
/**
|
|
9
|
-
* List Triggers
|
|
10
|
-
* List triggers.
|
|
11
|
-
* @param triggerType
|
|
12
|
-
* @param isActive
|
|
13
|
-
* @param podId
|
|
14
|
-
* @param limit
|
|
15
|
-
* @param pageToken
|
|
16
|
-
* @returns TriggerListResponse Successful Response
|
|
17
|
-
* @throws ApiError
|
|
18
|
-
*/
|
|
19
|
-
static triggerList(triggerType?: (TriggerType | null), isActive?: (boolean | null), podId?: (string | null), limit?: number, pageToken?: (string | null)): CancelablePromise<TriggerListResponse>;
|
|
20
|
-
/**
|
|
21
|
-
* Create Trigger
|
|
22
|
-
* Create a new trigger.
|
|
23
|
-
* @param requestBody
|
|
24
|
-
* @returns TriggerResponse Successful Response
|
|
25
|
-
* @throws ApiError
|
|
26
|
-
*/
|
|
27
|
-
static triggerCreate(requestBody: CreateTriggerRequest): CancelablePromise<TriggerResponse>;
|
|
28
|
-
/**
|
|
29
|
-
* Delete Trigger
|
|
30
|
-
* Delete a trigger.
|
|
31
|
-
* @param triggerId
|
|
32
|
-
* @returns void
|
|
33
|
-
* @throws ApiError
|
|
34
|
-
*/
|
|
35
|
-
static triggerDelete(triggerId: string): CancelablePromise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Get Trigger
|
|
38
|
-
* Get a trigger by ID.
|
|
39
|
-
* @param triggerId
|
|
40
|
-
* @returns TriggerResponse Successful Response
|
|
41
|
-
* @throws ApiError
|
|
42
|
-
*/
|
|
43
|
-
static triggerGet(triggerId: string): CancelablePromise<TriggerResponse>;
|
|
44
|
-
/**
|
|
45
|
-
* Update Trigger
|
|
46
|
-
* Update a trigger.
|
|
47
|
-
* @param triggerId
|
|
48
|
-
* @param requestBody
|
|
49
|
-
* @returns TriggerResponse Successful Response
|
|
50
|
-
* @throws ApiError
|
|
51
|
-
*/
|
|
52
|
-
static triggerUpdate(triggerId: string, requestBody: UpdateTriggerRequest): CancelablePromise<TriggerResponse>;
|
|
53
|
-
}
|