@lota-sdk/shared 0.2.2 → 0.3.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/package.json +1 -1
- package/src/constants/execution-plan.ts +2 -2
- package/src/constants/{workstream.ts → thread.ts} +2 -2
- package/src/index.ts +3 -3
- package/src/runtime/agent-types.ts +1 -1
- package/src/schemas/agent-plan-draft.ts +47 -21
- package/src/schemas/autonomous-job.ts +3 -3
- package/src/schemas/common.ts +3 -3
- package/src/schemas/execution-plan.ts +9 -30
- package/src/schemas/organization.ts +4 -4
- package/src/schemas/plan-board.ts +4 -4
- package/src/schemas/recent-activity.ts +5 -5
- package/src/schemas/thread-api.ts +66 -0
- package/src/schemas/{workstream.ts → thread.ts} +20 -23
- package/src/schemas/tools.ts +44 -78
- package/src/schemas/workstream-api.ts +0 -71
package/package.json
CHANGED
|
@@ -5,8 +5,8 @@ export const HUMAN_NODE_TYPES = ['human-input', 'human-approval', 'human-review-
|
|
|
5
5
|
export const STRUCTURAL_NODE_TYPES = ['switch', 'join', 'deliberation-fork'] as const
|
|
6
6
|
|
|
7
7
|
export const PROJECT_PLAN_ROUTING_PROMPT = `<project-plan-routing>
|
|
8
|
-
- Use createExecutionPlan for small inline work inside the current
|
|
9
|
-
- Use createProjectWithPlan when the work needs a dedicated project
|
|
8
|
+
- Use createExecutionPlan for small inline work inside the current thread.
|
|
9
|
+
- Use createProjectWithPlan when the work needs a dedicated project thread, should stay visible in the sidebar or board, or needs 3 or more meaningful execution nodes.
|
|
10
10
|
- If createExecutionPlan rejects a larger draft, immediately retry with createProjectWithPlan instead of forcing the plan inline.
|
|
11
11
|
</project-plan-routing>`
|
|
12
12
|
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './constants/attachments'
|
|
2
2
|
export * from './constants/execution-plan'
|
|
3
|
-
export * from './constants/
|
|
3
|
+
export * from './constants/thread'
|
|
4
4
|
export * from './runtime/agent-types'
|
|
5
5
|
export * from './runtime/chat-message-metadata'
|
|
6
6
|
export * from './runtime/execution-plan-result'
|
|
@@ -25,8 +25,8 @@ export * from './schemas/repository-structure'
|
|
|
25
25
|
export * from './schemas/tools'
|
|
26
26
|
export * from './schemas/user'
|
|
27
27
|
export * from './schemas/user-api'
|
|
28
|
-
export * from './schemas/
|
|
29
|
-
export * from './schemas/
|
|
28
|
+
export * from './schemas/thread'
|
|
29
|
+
export * from './schemas/thread-api'
|
|
30
30
|
export * from './constants/model'
|
|
31
31
|
export * from './constants/search'
|
|
32
32
|
export * from './utils/assistant-text'
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
ToolSet,
|
|
8
8
|
} from 'ai'
|
|
9
9
|
|
|
10
|
-
export type ChatMode = 'direct' | '
|
|
10
|
+
export type ChatMode = 'direct' | 'threadMode' | 'fixedThreadMode'
|
|
11
11
|
|
|
12
12
|
export interface CreateRoutedAgentOptions<TTools extends ToolSet = ToolSet> {
|
|
13
13
|
mode: ChatMode
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
|
|
3
3
|
import { HUMAN_NODE_TYPES, STRUCTURAL_NODE_TYPES } from '../constants/execution-plan'
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
DeliberationForkConfig,
|
|
6
|
+
MonitoringWindowConfig,
|
|
7
|
+
PlanArtifactSpec,
|
|
8
|
+
PlanCompletionCheck,
|
|
9
|
+
PlanDraft,
|
|
10
|
+
PlanNodeOwner,
|
|
11
|
+
PlanNodeType,
|
|
12
|
+
} from './execution-plan'
|
|
5
13
|
import {
|
|
6
|
-
ExecutionModeSchema,
|
|
7
14
|
PlanArtifactSpecSchema,
|
|
8
15
|
PlanCompletionCheckSchema,
|
|
9
16
|
PlanCompletionCheckTypeSchema,
|
|
10
17
|
PlanContextPolicySchema,
|
|
11
18
|
PlanEdgeSpecSchema,
|
|
12
19
|
PlanExecutionVisibilitySchema,
|
|
13
|
-
PlanNodeOwnerSchema,
|
|
14
20
|
PlanNodeTypeSchema,
|
|
15
21
|
PlanRetryPolicySchema,
|
|
16
22
|
PlanToolPolicySchema,
|
|
@@ -19,8 +25,6 @@ import {
|
|
|
19
25
|
const STRUCTURAL_NODE_TYPE_SET = new Set<PlanNodeType>(STRUCTURAL_NODE_TYPES)
|
|
20
26
|
const HUMAN_NODE_TYPE_SET = new Set<PlanNodeType>(HUMAN_NODE_TYPES)
|
|
21
27
|
|
|
22
|
-
const agentPlanOwnerStringSchema = z.string().trim().min(1).max(200)
|
|
23
|
-
|
|
24
28
|
const AgentPlanDeliverableDraftSchema = z.union([z.string().trim().min(1).max(1000), PlanArtifactSpecSchema])
|
|
25
29
|
|
|
26
30
|
const SimplifiedCompletionCheckSchema = z.object({
|
|
@@ -36,12 +40,14 @@ export const AgentPlanNodeDraftSchema = z.object({
|
|
|
36
40
|
id: z.string().trim().min(1).max(200),
|
|
37
41
|
type: PlanNodeTypeSchema,
|
|
38
42
|
label: z.string().trim().min(1).max(300),
|
|
39
|
-
owner: z.
|
|
40
|
-
objective: z.string().trim().
|
|
41
|
-
instructions: z.string().trim().
|
|
42
|
-
successCriteria: z.array(z.string().trim().min(1).max(1000)).
|
|
43
|
-
deliverables: z.array(AgentPlanDeliverableDraftSchema).
|
|
44
|
-
completionChecks: z.array(AgentPlanCompletionCheckDraftSchema).
|
|
43
|
+
owner: z.string().trim().min(1).max(200).optional(),
|
|
44
|
+
objective: z.string().trim().max(2000).optional(),
|
|
45
|
+
instructions: z.string().trim().max(4000).optional(),
|
|
46
|
+
successCriteria: z.array(z.string().trim().min(1).max(1000)).optional(),
|
|
47
|
+
deliverables: z.array(AgentPlanDeliverableDraftSchema).optional(),
|
|
48
|
+
completionChecks: z.array(AgentPlanCompletionCheckDraftSchema).optional(),
|
|
49
|
+
monitoringConfig: z.record(z.string(), z.unknown()).optional(),
|
|
50
|
+
deliberationConfig: z.record(z.string(), z.unknown()).optional(),
|
|
45
51
|
})
|
|
46
52
|
export type AgentPlanNodeDraft = z.infer<typeof AgentPlanNodeDraftSchema>
|
|
47
53
|
|
|
@@ -58,8 +64,6 @@ export const AgentPlanDraftSchema = z.object({
|
|
|
58
64
|
objective: z.string().trim().min(1).max(2000),
|
|
59
65
|
nodes: z.array(AgentPlanNodeDraftSchema).min(1).max(32),
|
|
60
66
|
edges: z.array(AgentPlanEdgeDraftSchema).default([]),
|
|
61
|
-
entryNodeIds: z.array(z.string().trim().min(1).max(200)).min(1).optional(),
|
|
62
|
-
executionMode: ExecutionModeSchema.optional(),
|
|
63
67
|
})
|
|
64
68
|
export type AgentPlanDraft = z.infer<typeof AgentPlanDraftSchema>
|
|
65
69
|
|
|
@@ -76,6 +80,16 @@ export function normalizeOwner(owner: string | PlanNodeOwner): PlanNodeOwner {
|
|
|
76
80
|
return { executorType: 'agent', ref: normalized }
|
|
77
81
|
}
|
|
78
82
|
|
|
83
|
+
function resolveOwner(node: AgentPlanNodeDraft): PlanNodeOwner {
|
|
84
|
+
if (HUMAN_NODE_TYPE_SET.has(node.type)) {
|
|
85
|
+
return { executorType: 'user', ref: 'user' }
|
|
86
|
+
}
|
|
87
|
+
if (node.owner) {
|
|
88
|
+
return normalizeOwner(node.owner)
|
|
89
|
+
}
|
|
90
|
+
return { executorType: 'agent', ref: 'lead' }
|
|
91
|
+
}
|
|
92
|
+
|
|
79
93
|
function toDeliverableName(value: string, fallback: string): string {
|
|
80
94
|
const normalized = value
|
|
81
95
|
.trim()
|
|
@@ -193,22 +207,32 @@ function expandCompletionChecks(node: AgentPlanNodeDraft, deliverables: PlanArti
|
|
|
193
207
|
})
|
|
194
208
|
}
|
|
195
209
|
|
|
210
|
+
function inferEntryNodeIds(draft: AgentPlanDraft): string[] {
|
|
211
|
+
const targets = new Set(draft.edges.map((e) => e.target))
|
|
212
|
+
const entryIds = draft.nodes.filter((n) => !targets.has(n.id)).map((n) => n.id)
|
|
213
|
+
return entryIds.length > 0 ? entryIds : [draft.nodes[0].id]
|
|
214
|
+
}
|
|
215
|
+
|
|
196
216
|
export function expandAgentPlanDraft(draft: AgentPlanDraft): PlanDraft {
|
|
197
217
|
const expandedNodes = draft.nodes.map((node) => {
|
|
198
218
|
const deliverables = expandDeliverables(node)
|
|
199
219
|
const completionChecks = expandCompletionChecks(node, deliverables)
|
|
220
|
+
const isStructural = isStructuralNodeType(node.type)
|
|
200
221
|
|
|
201
222
|
return {
|
|
202
223
|
id: node.id,
|
|
203
224
|
type: node.type,
|
|
204
225
|
label: node.label,
|
|
205
|
-
owner:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
objective: node.objective,
|
|
209
|
-
instructions: node.instructions,
|
|
226
|
+
owner: resolveOwner(node),
|
|
227
|
+
objective: node.objective || node.label,
|
|
228
|
+
instructions: node.instructions || (isStructural ? node.label : ''),
|
|
210
229
|
deliverables,
|
|
211
|
-
successCriteria:
|
|
230
|
+
successCriteria:
|
|
231
|
+
node.successCriteria && node.successCriteria.length > 0
|
|
232
|
+
? [...node.successCriteria]
|
|
233
|
+
: isStructural
|
|
234
|
+
? []
|
|
235
|
+
: ['Completed successfully'],
|
|
212
236
|
completionChecks,
|
|
213
237
|
retryPolicy: PlanRetryPolicySchema.parse({ maxAttempts: 0, retryOn: [] }),
|
|
214
238
|
failurePolicy: [],
|
|
@@ -219,6 +243,8 @@ export function expandAgentPlanDraft(draft: AgentPlanDraft): PlanDraft {
|
|
|
219
243
|
webPolicy: 'allowed',
|
|
220
244
|
}),
|
|
221
245
|
executionVisibility: PlanExecutionVisibilitySchema.parse('auto'),
|
|
246
|
+
...(node.monitoringConfig ? { monitoringConfig: node.monitoringConfig as MonitoringWindowConfig } : {}),
|
|
247
|
+
...(node.deliberationConfig ? { deliberationConfig: node.deliberationConfig as DeliberationForkConfig } : {}),
|
|
222
248
|
}
|
|
223
249
|
})
|
|
224
250
|
|
|
@@ -229,7 +255,7 @@ export function expandAgentPlanDraft(draft: AgentPlanDraft): PlanDraft {
|
|
|
229
255
|
defaultExecutionVisibility: 'auto',
|
|
230
256
|
nodes: expandedNodes,
|
|
231
257
|
edges: draft.edges.map((edge) => PlanEdgeSpecSchema.parse({ ...edge, map: {} })),
|
|
232
|
-
entryNodeIds: draft
|
|
233
|
-
executionMode:
|
|
258
|
+
entryNodeIds: inferEntryNodeIds(draft),
|
|
259
|
+
executionMode: 'linear',
|
|
234
260
|
}
|
|
235
261
|
}
|
|
@@ -35,7 +35,7 @@ export const AutonomousJobSchema = z
|
|
|
35
35
|
organizationId: z.string(),
|
|
36
36
|
ownerUserId: z.string(),
|
|
37
37
|
ownerUserName: z.string().optional(),
|
|
38
|
-
|
|
38
|
+
threadId: z.string(),
|
|
39
39
|
agentId: z.string(),
|
|
40
40
|
title: z.string(),
|
|
41
41
|
prompt: z.string(),
|
|
@@ -59,7 +59,7 @@ export const AutonomousJobRunSchema = z
|
|
|
59
59
|
.object({
|
|
60
60
|
id: z.string(),
|
|
61
61
|
autonomousJobId: z.string(),
|
|
62
|
-
|
|
62
|
+
threadId: z.string(),
|
|
63
63
|
queueJobId: z.string().optional(),
|
|
64
64
|
status: AutonomousJobRunStatusSchema,
|
|
65
65
|
inputMessageId: z.string().optional(),
|
|
@@ -86,7 +86,7 @@ export const CreateAutonomousJobInputSchema = z
|
|
|
86
86
|
prompt: z.string().trim().min(1).max(10_000),
|
|
87
87
|
schedule: AutonomousJobScheduleSchema,
|
|
88
88
|
autoPauseThreshold: z.number().int().positive().default(3),
|
|
89
|
-
|
|
89
|
+
threadTitle: z.string().trim().min(1).max(300).optional(),
|
|
90
90
|
})
|
|
91
91
|
.strict()
|
|
92
92
|
export type CreateAutonomousJobInput = z.infer<typeof CreateAutonomousJobInputSchema>
|
package/src/schemas/common.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { THREAD } from '../constants/thread'
|
|
4
4
|
|
|
5
5
|
const SURREALDB_RECORD_ID_CLASSES = new Set(['RecordId', 'StringRecordId'])
|
|
6
6
|
|
|
@@ -47,14 +47,14 @@ export const recordIdSchema = z.preprocess(
|
|
|
47
47
|
|
|
48
48
|
export const recordIdStringSchema = z.preprocess(coerceRecordIdToString, z.string())
|
|
49
49
|
|
|
50
|
-
export const paginationTakeSchema = z.coerce.number().int().min(1).max(
|
|
50
|
+
export const paginationTakeSchema = z.coerce.number().int().min(1).max(THREAD.MAX_MESSAGES_PER_PAGE)
|
|
51
51
|
export const paginationPageSchema = z.coerce.number().int().min(1)
|
|
52
52
|
export const paginationCursorSchema = z.preprocess((value) => value, recordIdSchema)
|
|
53
53
|
|
|
54
54
|
export const paginationSchemaBase = z.object({
|
|
55
55
|
page: paginationPageSchema.optional(),
|
|
56
56
|
cursor: paginationCursorSchema.optional(),
|
|
57
|
-
take: paginationTakeSchema.default(
|
|
57
|
+
take: paginationTakeSchema.default(THREAD.DEFAULT_PAGE_LIMIT),
|
|
58
58
|
})
|
|
59
59
|
|
|
60
60
|
export const paginationSchema = paginationSchemaBase.refine(
|
|
@@ -324,7 +324,7 @@ export type PlanScheduleStatus = ActiveRecordStatus
|
|
|
324
324
|
export const PlanScheduleRecordSchema = z.object({
|
|
325
325
|
id: recordIdSchema,
|
|
326
326
|
organizationId: recordIdSchema,
|
|
327
|
-
|
|
327
|
+
threadId: recordIdSchema,
|
|
328
328
|
planSpecId: recordIdSchema.optional(),
|
|
329
329
|
runId: recordIdSchema.optional(),
|
|
330
330
|
nodeId: z.string().optional(),
|
|
@@ -402,21 +402,6 @@ export const NodeWorkspaceEntrySchema = z
|
|
|
402
402
|
.strict()
|
|
403
403
|
export type NodeWorkspaceEntry = z.infer<typeof NodeWorkspaceEntrySchema>
|
|
404
404
|
|
|
405
|
-
export const NodeResultQualitySchema = z.enum(['full', 'partial']).default('full')
|
|
406
|
-
export type NodeResultQuality = z.infer<typeof NodeResultQualitySchema>
|
|
407
|
-
|
|
408
|
-
export const PlanNodeHandoffContextSchema = z
|
|
409
|
-
.object({
|
|
410
|
-
summary: z.string().trim().min(1).max(4000),
|
|
411
|
-
keyDecisions: z.array(z.string().trim().min(1).max(1000)).default([]),
|
|
412
|
-
openQuestions: z.array(z.string().trim().min(1).max(1000)).default([]),
|
|
413
|
-
risks: z.array(z.string().trim().min(1).max(1000)).default([]),
|
|
414
|
-
recommendations: z.array(z.string().trim().min(1).max(1000)).default([]),
|
|
415
|
-
references: z.array(z.string().trim().min(1).max(2000)).default([]),
|
|
416
|
-
})
|
|
417
|
-
.strict()
|
|
418
|
-
export type PlanNodeHandoffContext = z.infer<typeof PlanNodeHandoffContextSchema>
|
|
419
|
-
|
|
420
405
|
const planJsonValueSchema: z.ZodType<unknown> = z.lazy(() =>
|
|
421
406
|
z.union([z.string(), z.number(), z.boolean(), z.null(), z.array(planJsonValueSchema), planStructuredObjectSchema]),
|
|
422
407
|
)
|
|
@@ -433,9 +418,7 @@ export const PlanArtifactSubmissionSchema = z
|
|
|
433
418
|
.object({
|
|
434
419
|
name: z.string().trim().min(1).max(200),
|
|
435
420
|
kind: PlanArtifactKindSchema,
|
|
436
|
-
|
|
437
|
-
schemaRef: z.string().trim().min(1).max(200).optional(),
|
|
438
|
-
description: z.string().trim().min(1).max(1000).optional(),
|
|
421
|
+
description: z.string().trim().max(1000).optional(),
|
|
439
422
|
payload: planStructuredPayloadSchema.optional(),
|
|
440
423
|
})
|
|
441
424
|
.strict()
|
|
@@ -443,11 +426,9 @@ export type PlanArtifactSubmission = z.infer<typeof PlanArtifactSubmissionSchema
|
|
|
443
426
|
|
|
444
427
|
export const PlanNodeResultSubmissionSchema = z
|
|
445
428
|
.object({
|
|
429
|
+
notes: z.string().trim().min(1).max(4000),
|
|
446
430
|
structuredOutput: planStructuredObjectSchema.optional(),
|
|
447
431
|
artifacts: z.array(PlanArtifactSubmissionSchema).default([]),
|
|
448
|
-
notes: z.string().trim().min(1).max(2000).optional(),
|
|
449
|
-
handoffContext: PlanNodeHandoffContextSchema.optional(),
|
|
450
|
-
quality: NodeResultQualitySchema.optional(),
|
|
451
432
|
})
|
|
452
433
|
.strict()
|
|
453
434
|
export type PlanNodeResultSubmission = z.infer<typeof PlanNodeResultSubmissionSchema>
|
|
@@ -459,14 +440,14 @@ export const UpstreamHandoffSchema = z
|
|
|
459
440
|
label: z.string().trim().min(1).max(300),
|
|
460
441
|
ownerRef: z.string().trim().min(1).max(200),
|
|
461
442
|
ownerType: PlanNodeExecutorTypeSchema,
|
|
462
|
-
|
|
443
|
+
summary: z.string().optional(),
|
|
463
444
|
})
|
|
464
445
|
.strict()
|
|
465
446
|
export type UpstreamHandoff = z.infer<typeof UpstreamHandoffSchema>
|
|
466
447
|
|
|
467
448
|
export interface OwnershipDispatchContext {
|
|
468
449
|
organizationId: string
|
|
469
|
-
|
|
450
|
+
threadId: string
|
|
470
451
|
planId: string
|
|
471
452
|
nodeId: string
|
|
472
453
|
leadAgentId: string
|
|
@@ -601,7 +582,7 @@ export type ContextEnrichmentEntry = z.infer<typeof ContextEnrichmentEntrySchema
|
|
|
601
582
|
export const PlanSpecSchema = z.object({
|
|
602
583
|
id: recordIdSchema,
|
|
603
584
|
organizationId: recordIdSchema,
|
|
604
|
-
|
|
585
|
+
threadId: recordIdSchema,
|
|
605
586
|
title: z.string(),
|
|
606
587
|
objective: z.string(),
|
|
607
588
|
version: z.number().int().positive(),
|
|
@@ -638,7 +619,7 @@ export const PlanRunSchema = z.object({
|
|
|
638
619
|
id: recordIdSchema,
|
|
639
620
|
planSpecId: recordIdSchema,
|
|
640
621
|
organizationId: recordIdSchema,
|
|
641
|
-
|
|
622
|
+
threadId: recordIdSchema,
|
|
642
623
|
leadAgentId: z.string(),
|
|
643
624
|
status: PlanRunStatusSchema,
|
|
644
625
|
currentNodeId: z.string().optional(),
|
|
@@ -667,7 +648,6 @@ export const PlanNodeRunSchema = z.object({
|
|
|
667
648
|
resolvedInput: z.record(z.string(), z.unknown()).optional(),
|
|
668
649
|
latestStructuredOutput: z.record(z.string(), z.unknown()).optional(),
|
|
669
650
|
latestNotes: z.string().optional(),
|
|
670
|
-
handoffContext: PlanNodeHandoffContextSchema.optional(),
|
|
671
651
|
latestAttemptId: recordIdSchema.optional(),
|
|
672
652
|
blockedReason: z.string().optional(),
|
|
673
653
|
failureClass: PlanFailureClassSchema.optional(),
|
|
@@ -799,7 +779,6 @@ export const SerializablePlanNodeSchema = PlanNodeSpecRecordSchema.omit({
|
|
|
799
779
|
resolvedInput: z.record(z.string(), z.unknown()).nullish(),
|
|
800
780
|
latestStructuredOutput: z.record(z.string(), z.unknown()).nullish(),
|
|
801
781
|
latestNotes: z.string().nullish(),
|
|
802
|
-
handoffContext: PlanNodeHandoffContextSchema.nullish(),
|
|
803
782
|
blockedReason: z.string().nullish(),
|
|
804
783
|
failureClass: PlanFailureClassSchema.nullish(),
|
|
805
784
|
readyAt: z.iso.datetime().nullish(),
|
|
@@ -898,7 +877,7 @@ export type SerializableExecutionPlanProgress = z.infer<typeof SerializableExecu
|
|
|
898
877
|
export const SerializableExecutionPlanSchema = z.object({
|
|
899
878
|
specId: z.string(),
|
|
900
879
|
runId: z.string(),
|
|
901
|
-
|
|
880
|
+
threadId: z.string(),
|
|
902
881
|
organizationId: z.string(),
|
|
903
882
|
title: z.string(),
|
|
904
883
|
objective: z.string(),
|
|
@@ -946,7 +925,7 @@ export type PlanTemplateRecord = z.infer<typeof PlanTemplateRecordSchema>
|
|
|
946
925
|
export const PlanCycleRecordSchema = z.object({
|
|
947
926
|
id: recordIdSchema,
|
|
948
927
|
organizationId: recordIdSchema,
|
|
949
|
-
|
|
928
|
+
threadId: recordIdSchema,
|
|
950
929
|
templateId: recordIdSchema,
|
|
951
930
|
name: z.string(),
|
|
952
931
|
schedule: CycleScheduleSchema,
|
|
@@ -5,8 +5,8 @@ import { recordIdSchema, recordIdStringSchema } from './common'
|
|
|
5
5
|
export const sdkOrganizationSchema = z.object({
|
|
6
6
|
id: recordIdStringSchema,
|
|
7
7
|
name: z.string(),
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
regularChatDigestLastThreadCursorCreatedAt: z.iso.datetime().nullable().optional(),
|
|
9
|
+
regularChatDigestLastThreadCursorId: z.string().nullable().optional(),
|
|
10
10
|
skillExtractionLastCursorId: z.string().nullable().optional(),
|
|
11
11
|
skillExtractionLastCursorCreatedAt: z.iso.datetime().nullable().optional(),
|
|
12
12
|
createdAt: z.iso.datetime(),
|
|
@@ -16,8 +16,8 @@ export const sdkOrganizationSchema = z.object({
|
|
|
16
16
|
export const sdkOrganizationRecordSchema = z.object({
|
|
17
17
|
id: recordIdSchema,
|
|
18
18
|
name: z.string(),
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
regularChatDigestLastThreadCursorCreatedAt: z.coerce.date().optional(),
|
|
20
|
+
regularChatDigestLastThreadCursorId: z.string().optional(),
|
|
21
21
|
skillExtractionLastCursorId: z.string().optional(),
|
|
22
22
|
skillExtractionLastCursorCreatedAt: z.coerce.date().optional(),
|
|
23
23
|
createdAt: z.coerce.date(),
|
|
@@ -10,8 +10,8 @@ export const PlanNodeCardSchema = z
|
|
|
10
10
|
ownerRef: z.string().trim().min(1),
|
|
11
11
|
planRunId: z.string().trim().min(1),
|
|
12
12
|
planTitle: z.string().trim().min(1),
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
threadId: z.string().trim().min(1),
|
|
14
|
+
threadTitle: z.string().trim().min(1),
|
|
15
15
|
nodeType: z.string().trim().min(1),
|
|
16
16
|
artifactCount: z.number().int().nonnegative(),
|
|
17
17
|
hasApproval: z.boolean(),
|
|
@@ -74,8 +74,8 @@ export type MyTasksResponse = z.infer<typeof MyTasksResponseSchema>
|
|
|
74
74
|
|
|
75
75
|
export const AgentProjectEntrySchema = z
|
|
76
76
|
.object({
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
threadId: z.string().trim().min(1),
|
|
78
|
+
threadTitle: z.string().trim().min(1),
|
|
79
79
|
planRunId: z.string().trim().min(1),
|
|
80
80
|
planTitle: z.string().trim().min(1),
|
|
81
81
|
status: z.string().trim().min(1),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
|
|
3
3
|
export const RecentActivityEventKindSchema = z.enum([
|
|
4
|
-
'
|
|
4
|
+
'thread.opened',
|
|
5
5
|
'document.opened',
|
|
6
6
|
'website-intelligence.viewed',
|
|
7
7
|
'chat.turn.completed',
|
|
8
8
|
])
|
|
9
9
|
|
|
10
|
-
export const RecentActivityTargetKindSchema = z.enum(['
|
|
10
|
+
export const RecentActivityTargetKindSchema = z.enum(['thread', 'document', 'website-intelligence', 'chat-turn'])
|
|
11
11
|
|
|
12
12
|
export const RecentActivityTitleSourceSchema = z.enum(['system', 'agent'])
|
|
13
13
|
|
|
@@ -24,9 +24,9 @@ export const RecentActivityMetadataSchema = z
|
|
|
24
24
|
.object({
|
|
25
25
|
agentId: z.string().optional(),
|
|
26
26
|
agentName: z.string().optional(),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
threadId: z.string().optional(),
|
|
28
|
+
threadTitle: z.string().optional(),
|
|
29
|
+
threadType: z.string().optional(),
|
|
30
30
|
coreType: z.string().optional(),
|
|
31
31
|
documentTitle: z.string().optional(),
|
|
32
32
|
documentFolder: z.string().optional(),
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
import { baseChatMessageSchema } from './chat-api'
|
|
4
|
+
import { paginationPageSchema, paginationTakeSchema, recordIdSchema } from './common'
|
|
5
|
+
import { sdkThreadSchema, sdkThreadTypeSchema } from './thread'
|
|
6
|
+
|
|
7
|
+
export const listSdkThreadsRequestSchema = z.object({
|
|
8
|
+
userId: recordIdSchema,
|
|
9
|
+
organizationId: recordIdSchema,
|
|
10
|
+
type: sdkThreadTypeSchema.optional(),
|
|
11
|
+
page: paginationPageSchema.optional(),
|
|
12
|
+
take: paginationTakeSchema.optional(),
|
|
13
|
+
includeArchived: z.boolean().default(false),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const createSdkThreadRequestSchema = z.object({
|
|
17
|
+
userId: recordIdSchema,
|
|
18
|
+
organizationId: recordIdSchema,
|
|
19
|
+
title: z.string().trim().min(1).max(200).optional(),
|
|
20
|
+
type: sdkThreadTypeSchema.default('default'),
|
|
21
|
+
agentId: z.string().trim().min(1).optional(),
|
|
22
|
+
threadType: z.string().trim().min(1).optional(),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const updateSdkThreadRequestSchema = z.object({ title: z.string().trim().min(1).max(200) })
|
|
26
|
+
|
|
27
|
+
export const listSdkThreadsResponseSchema = z.object({
|
|
28
|
+
threads: z.array(sdkThreadSchema),
|
|
29
|
+
hasMore: z.boolean(),
|
|
30
|
+
page: z.number().optional(),
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
export const getSdkThreadResponseSchema = sdkThreadSchema
|
|
34
|
+
|
|
35
|
+
export const listSdkThreadMessagesRequestSchema = z.object({
|
|
36
|
+
before: z.string().trim().min(1).optional(),
|
|
37
|
+
after: z.string().trim().min(1).optional(),
|
|
38
|
+
limit: paginationTakeSchema.optional(),
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
export const listSdkThreadMessagesResponseSchema = z.object({
|
|
42
|
+
messages: z.array(baseChatMessageSchema),
|
|
43
|
+
hasMore: z.boolean(),
|
|
44
|
+
prevCursor: z.string().nullable().optional(),
|
|
45
|
+
nextCursor: z.string().nullable().optional(),
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
export const sdkThreadMessageLookupSchema = z.object({ threadId: recordIdSchema, messageId: z.string().trim().min(1) })
|
|
49
|
+
|
|
50
|
+
export const sdkThreadSendMessageRequestSchema = z.object({
|
|
51
|
+
threadId: recordIdSchema,
|
|
52
|
+
organizationId: recordIdSchema,
|
|
53
|
+
userId: recordIdSchema,
|
|
54
|
+
userName: z.string().trim().min(1),
|
|
55
|
+
messages: z.array(baseChatMessageSchema).min(1),
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
export type ListSdkThreadsRequest = z.infer<typeof listSdkThreadsRequestSchema>
|
|
59
|
+
export type CreateSdkThreadRequest = z.infer<typeof createSdkThreadRequestSchema>
|
|
60
|
+
export type UpdateSdkThreadRequest = z.infer<typeof updateSdkThreadRequestSchema>
|
|
61
|
+
export type ListSdkThreadsResponse = z.infer<typeof listSdkThreadsResponseSchema>
|
|
62
|
+
export type GetSdkThreadResponse = z.infer<typeof getSdkThreadResponseSchema>
|
|
63
|
+
export type ListSdkThreadMessagesRequest = z.infer<typeof listSdkThreadMessagesRequestSchema>
|
|
64
|
+
export type ListSdkThreadMessagesResponse = z.infer<typeof listSdkThreadMessagesResponseSchema>
|
|
65
|
+
export type SdkThreadMessageLookup = z.infer<typeof sdkThreadMessageLookupSchema>
|
|
66
|
+
export type SdkThreadSendMessageRequest = z.infer<typeof sdkThreadSendMessageRequestSchema>
|
|
@@ -2,19 +2,20 @@ import { z } from 'zod'
|
|
|
2
2
|
|
|
3
3
|
import { recordIdSchema, recordIdStringSchema } from './common'
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
export
|
|
5
|
+
export const sdkThreadTypeSchema = z.enum(['default', 'topic', 'thread', 'group'])
|
|
6
|
+
export type SdkThreadType = z.infer<typeof sdkThreadTypeSchema>
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const sdkThreadStatusSchema = z.enum(['active', 'archived'])
|
|
9
|
+
|
|
10
|
+
export const sdkThreadRecordSchema = z.object({
|
|
9
11
|
id: recordIdSchema,
|
|
10
12
|
organizationId: recordIdSchema,
|
|
11
13
|
userId: recordIdSchema,
|
|
12
14
|
agentId: z.string().nullish(),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
coreType: z.string().nullish(),
|
|
15
|
+
type: sdkThreadTypeSchema,
|
|
16
|
+
threadType: z.string().nullish(),
|
|
16
17
|
title: z.string().nullish(),
|
|
17
|
-
status:
|
|
18
|
+
status: sdkThreadStatusSchema,
|
|
18
19
|
members: z.array(z.string()).default([]),
|
|
19
20
|
memoryBlock: z.string().nullish(),
|
|
20
21
|
memoryBlockSummary: z.string().nullish(),
|
|
@@ -29,8 +30,8 @@ export const sdkWorkstreamRecordSchema = z.object({
|
|
|
29
30
|
updatedAt: z.coerce.date(),
|
|
30
31
|
})
|
|
31
32
|
|
|
32
|
-
export const
|
|
33
|
-
.pick({ agentId: true,
|
|
33
|
+
export const sdkThreadSchema = sdkThreadRecordSchema
|
|
34
|
+
.pick({ agentId: true, type: true, threadType: true, status: true, nameGenerated: true, members: true })
|
|
34
35
|
.extend({
|
|
35
36
|
id: recordIdStringSchema,
|
|
36
37
|
organizationId: recordIdStringSchema,
|
|
@@ -43,15 +44,11 @@ export const sdkWorkstreamSchema = sdkWorkstreamRecordSchema
|
|
|
43
44
|
updatedAt: z.iso.datetime(),
|
|
44
45
|
})
|
|
45
46
|
|
|
46
|
-
export const
|
|
47
|
-
organizationId: true,
|
|
48
|
-
userId: true,
|
|
49
|
-
memoryBlock: true,
|
|
50
|
-
})
|
|
47
|
+
export const sdkPublicThreadSchema = sdkThreadSchema.omit({ organizationId: true, userId: true, memoryBlock: true })
|
|
51
48
|
|
|
52
|
-
export const
|
|
49
|
+
export const sdkThreadMessageSchema = z.object({
|
|
53
50
|
id: recordIdStringSchema,
|
|
54
|
-
|
|
51
|
+
threadId: recordIdStringSchema,
|
|
55
52
|
messageId: z.string(),
|
|
56
53
|
role: z.enum(['system', 'user', 'assistant']),
|
|
57
54
|
parts: z.array(z.record(z.string(), z.unknown())),
|
|
@@ -60,7 +57,7 @@ export const sdkWorkstreamMessageSchema = z.object({
|
|
|
60
57
|
updatedAt: z.iso.datetime().optional(),
|
|
61
58
|
})
|
|
62
59
|
|
|
63
|
-
export const
|
|
60
|
+
export const sdkThreadAttachmentSchema = z.object({
|
|
64
61
|
id: recordIdStringSchema,
|
|
65
62
|
attachmentType: z.string(),
|
|
66
63
|
name: z.string(),
|
|
@@ -69,13 +66,13 @@ export const sdkWorkstreamAttachmentSchema = z.object({
|
|
|
69
66
|
sizeBytes: z.number().nullable().optional(),
|
|
70
67
|
url: z.string().nullable().optional(),
|
|
71
68
|
messageId: recordIdStringSchema,
|
|
72
|
-
|
|
69
|
+
threadId: recordIdStringSchema,
|
|
73
70
|
createdAt: z.iso.datetime(),
|
|
74
71
|
updatedAt: z.iso.datetime(),
|
|
75
72
|
})
|
|
76
73
|
|
|
77
|
-
export type
|
|
78
|
-
export type
|
|
79
|
-
export type
|
|
80
|
-
export type
|
|
81
|
-
export type
|
|
74
|
+
export type SdkThreadRecord = z.infer<typeof sdkThreadRecordSchema>
|
|
75
|
+
export type SdkThread = z.infer<typeof sdkThreadSchema>
|
|
76
|
+
export type SdkPublicThread = z.infer<typeof sdkPublicThreadSchema>
|
|
77
|
+
export type SdkThreadMessage = z.infer<typeof sdkThreadMessageSchema>
|
|
78
|
+
export type SdkThreadAttachment = z.infer<typeof sdkThreadAttachmentSchema>
|
package/src/schemas/tools.ts
CHANGED
|
@@ -3,7 +3,12 @@ import { z } from 'zod'
|
|
|
3
3
|
import { AgentPlanDraftSchema } from './agent-plan-draft'
|
|
4
4
|
import { baseChatMessageSchema } from './chat-api'
|
|
5
5
|
import type { AnyChatMessage } from './chat-message'
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
PlanNodeResultSubmissionSchema,
|
|
8
|
+
PlanNodeRunStatusSchema,
|
|
9
|
+
PlanNodeTypeSchema,
|
|
10
|
+
PlanRunStatusSchema,
|
|
11
|
+
} from './execution-plan'
|
|
7
12
|
|
|
8
13
|
export const USER_QUESTIONS_TOOL_NAME = 'userQuestions' as const
|
|
9
14
|
export const CONSULT_SPECIALIST_TOOL_NAME = 'consultSpecialist' as const
|
|
@@ -11,23 +16,7 @@ export const CONSULT_TEAM_TOOL_NAME = 'consultTeam' as const
|
|
|
11
16
|
export const EXECUTION_PLAN_TOOL_NAME = 'executionPlan' as const
|
|
12
17
|
export const EXECUTION_PLAN_QUERY_TOOL_NAME = 'executionPlanQuery' as const
|
|
13
18
|
export const SUBMIT_PLAN_TURN_RESULT_TOOL_NAME = 'submitPlanTurnResult' as const
|
|
14
|
-
|
|
15
|
-
/** @deprecated Use EXECUTION_PLAN_TOOL_NAME */
|
|
16
|
-
export const CREATE_EXECUTION_PLAN_TOOL_NAME = 'createExecutionPlan' as const
|
|
17
|
-
/** @deprecated Use EXECUTION_PLAN_TOOL_NAME */
|
|
18
|
-
export const CREATE_PROJECT_WITH_PLAN_TOOL_NAME = 'createProjectWithPlan' as const
|
|
19
|
-
/** @deprecated Use EXECUTION_PLAN_TOOL_NAME */
|
|
20
|
-
export const REPLACE_EXECUTION_PLAN_TOOL_NAME = 'replaceExecutionPlan' as const
|
|
21
|
-
/** @deprecated Use EXECUTION_PLAN_TOOL_NAME */
|
|
22
19
|
export const SUBMIT_EXECUTION_NODE_RESULT_TOOL_NAME = 'submitExecutionNodeResult' as const
|
|
23
|
-
/** @deprecated Use EXECUTION_PLAN_QUERY_TOOL_NAME */
|
|
24
|
-
export const LIST_EXECUTION_PLANS_TOOL_NAME = 'listExecutionPlans' as const
|
|
25
|
-
/** @deprecated Use EXECUTION_PLAN_QUERY_TOOL_NAME */
|
|
26
|
-
export const GET_EXECUTION_PLAN_DETAILS_TOOL_NAME = 'getExecutionPlanDetails' as const
|
|
27
|
-
/** @deprecated Use EXECUTION_PLAN_QUERY_TOOL_NAME */
|
|
28
|
-
export const GET_ACTIVE_EXECUTION_PLAN_TOOL_NAME = 'getActiveExecutionPlan' as const
|
|
29
|
-
/** @deprecated Use EXECUTION_PLAN_TOOL_NAME */
|
|
30
|
-
export const RESUME_EXECUTION_PLAN_RUN_TOOL_NAME = 'resumeExecutionPlanRun' as const
|
|
31
20
|
|
|
32
21
|
const UserQuestionItemSchema = z
|
|
33
22
|
.object({
|
|
@@ -68,53 +57,17 @@ const ExecutionPlanToolActionSchema = z.enum([
|
|
|
68
57
|
'none',
|
|
69
58
|
])
|
|
70
59
|
|
|
71
|
-
export const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.trim()
|
|
75
|
-
.min(1)
|
|
76
|
-
.optional()
|
|
77
|
-
.describe('Target workstream ID. Defaults to the current workstream.'),
|
|
78
|
-
}).strict()
|
|
79
|
-
|
|
80
|
-
export const CreateProjectWithPlanArgsSchema = AgentPlanDraftSchema.extend({
|
|
81
|
-
projectTitle: z.string().trim().min(1).max(200).optional(),
|
|
82
|
-
targetWorkstreamId: z.string().trim().min(1).optional(),
|
|
83
|
-
}).refine((value) => Boolean(value.projectTitle) !== Boolean(value.targetWorkstreamId), {
|
|
84
|
-
message: 'Provide exactly one of projectTitle or targetWorkstreamId.',
|
|
85
|
-
path: ['projectTitle'],
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
export const ReplaceExecutionPlanArgsSchema = AgentPlanDraftSchema.extend({
|
|
89
|
-
runId: z.string().trim().min(1).describe('ID of the plan run to replace.'),
|
|
90
|
-
reason: z.string().trim().min(1).max(1000).describe('Why the plan is being replaced.'),
|
|
60
|
+
export const SubmitExecutionNodeResultArgsSchema = PlanNodeResultSubmissionSchema.extend({
|
|
61
|
+
runId: z.string().trim().min(1),
|
|
62
|
+
nodeId: z.string().trim().min(1),
|
|
91
63
|
}).strict()
|
|
92
64
|
|
|
93
|
-
export const SubmitExecutionNodeResultArgsSchema = z
|
|
94
|
-
.object({ runId: z.string().trim().min(1), nodeId: z.string().trim().min(1), result: PlanNodeResultSubmissionSchema })
|
|
95
|
-
.strict()
|
|
96
|
-
|
|
97
65
|
export const SubmitPlanTurnResultArgsSchema = PlanNodeResultSubmissionSchema
|
|
98
66
|
|
|
99
|
-
export const ListExecutionPlansArgsSchema = z.object({}).strict()
|
|
100
|
-
|
|
101
|
-
export const GetActiveExecutionPlanArgsSchema = z
|
|
102
|
-
.object({
|
|
103
|
-
runId: z.string().trim().min(1).optional(),
|
|
104
|
-
includeEvents: z.boolean().default(true).describe('Include events'),
|
|
105
|
-
includeArtifacts: z.boolean().default(true).describe('Include artifacts'),
|
|
106
|
-
includeApprovals: z.boolean().default(true).describe('Include approvals'),
|
|
107
|
-
includeCheckpoints: z.boolean().default(false).describe('Include checkpoints'),
|
|
108
|
-
includeValidationIssues: z.boolean().default(true).describe('Include validation issues'),
|
|
109
|
-
})
|
|
110
|
-
.strict()
|
|
111
|
-
|
|
112
|
-
export const ResumeExecutionPlanRunArgsSchema = z.object({ runId: z.string().trim().min(1) }).strict()
|
|
113
|
-
|
|
114
67
|
export const ExecutionPlanActionSchema = z
|
|
115
68
|
.enum(['create', 'create-project', 'replace', 'resume'])
|
|
116
69
|
.describe(
|
|
117
|
-
'create: inline plan (1-2 nodes). create-project: plan in a dedicated project
|
|
70
|
+
'create: inline plan (1-2 nodes). create-project: plan in a dedicated project thread (3+ nodes). replace: replace active plan. resume: resume interrupted plan.',
|
|
118
71
|
)
|
|
119
72
|
export type ExecutionPlanAction = z.infer<typeof ExecutionPlanActionSchema>
|
|
120
73
|
|
|
@@ -126,13 +79,13 @@ export const ExecutionPlanArgsSchema = AgentPlanDraftSchema.extend({
|
|
|
126
79
|
.min(1)
|
|
127
80
|
.max(200)
|
|
128
81
|
.optional()
|
|
129
|
-
.describe('Required for create-project when creating a new
|
|
130
|
-
|
|
82
|
+
.describe('Required for create-project when creating a new thread.'),
|
|
83
|
+
targetThreadId: z
|
|
131
84
|
.string()
|
|
132
85
|
.trim()
|
|
133
86
|
.min(1)
|
|
134
87
|
.optional()
|
|
135
|
-
.describe('Target existing
|
|
88
|
+
.describe('Target existing thread. For create-project, provide either this or projectTitle.'),
|
|
136
89
|
runId: z.string().trim().min(1).optional().describe('Required for replace and resume.'),
|
|
137
90
|
reason: z.string().trim().min(1).max(1000).optional().describe('Required for replace.'),
|
|
138
91
|
}).strict()
|
|
@@ -150,10 +103,6 @@ export const ExecutionPlanQueryArgsSchema = z
|
|
|
150
103
|
.strict()
|
|
151
104
|
export type ExecutionPlanQueryArgs = z.infer<typeof ExecutionPlanQueryArgsSchema>
|
|
152
105
|
|
|
153
|
-
export const PlanSummarySchema = z
|
|
154
|
-
.object({ runId: z.string(), title: z.string(), status: PlanRunStatusSchema })
|
|
155
|
-
.strict()
|
|
156
|
-
|
|
157
106
|
export const ListExecutionPlansSummarySchema = z
|
|
158
107
|
.object({
|
|
159
108
|
runId: z.string(),
|
|
@@ -170,23 +119,44 @@ export const ListExecutionPlansToolResultDataSchema = z
|
|
|
170
119
|
.object({ plans: z.array(ListExecutionPlansSummarySchema), totalCount: z.number().int().nonnegative() })
|
|
171
120
|
.strict()
|
|
172
121
|
|
|
122
|
+
export const ExecutionPlanProgressSchema = z.object({
|
|
123
|
+
completed: z.number().int().nonnegative(),
|
|
124
|
+
total: z.number().int().nonnegative(),
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
export const ExecutionPlanNodeSummarySchema = z.object({
|
|
128
|
+
id: z.string(),
|
|
129
|
+
label: z.string(),
|
|
130
|
+
type: PlanNodeTypeSchema,
|
|
131
|
+
status: PlanNodeRunStatusSchema,
|
|
132
|
+
ownerRef: z.string(),
|
|
133
|
+
})
|
|
134
|
+
|
|
173
135
|
export const ExecutionPlanToolResultDataSchema = z
|
|
174
136
|
.object({
|
|
175
137
|
action: ExecutionPlanToolActionSchema,
|
|
176
|
-
message: z.string().
|
|
177
|
-
changedNodeId: z.string().nullish(),
|
|
178
|
-
plan: SerializableExecutionPlanSchema.nullish(),
|
|
138
|
+
message: z.string().optional(),
|
|
179
139
|
hasPlan: z.boolean(),
|
|
180
140
|
status: PlanRunStatusSchema.nullish(),
|
|
181
|
-
|
|
182
|
-
|
|
141
|
+
plan: z
|
|
142
|
+
.object({
|
|
143
|
+
runId: z.string(),
|
|
144
|
+
title: z.string(),
|
|
145
|
+
objective: z.string(),
|
|
146
|
+
status: PlanRunStatusSchema,
|
|
147
|
+
progress: ExecutionPlanProgressSchema,
|
|
148
|
+
nodes: z.array(ExecutionPlanNodeSummarySchema),
|
|
149
|
+
activeNodeIds: z.array(z.string()),
|
|
150
|
+
readyNodeIds: z.array(z.string()),
|
|
151
|
+
})
|
|
152
|
+
.nullish(),
|
|
183
153
|
})
|
|
184
154
|
.strict()
|
|
185
155
|
|
|
186
156
|
export const CreateProjectWithPlanResultDataSchema = ExecutionPlanToolResultDataSchema.extend({
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
157
|
+
threadId: z.string().trim().min(1),
|
|
158
|
+
threadTitle: z.string().trim().min(1),
|
|
159
|
+
createdThread: z.boolean(),
|
|
190
160
|
}).strict()
|
|
191
161
|
|
|
192
162
|
export const ConsultTeamResultDataSchema = z.object({ responses: z.array(ConsultTeamResponseSchema) }).strict()
|
|
@@ -200,16 +170,12 @@ export type ConsultTeamResponseData = Omit<z.infer<typeof ConsultTeamResponseSch
|
|
|
200
170
|
message?: AnyChatMessage
|
|
201
171
|
}
|
|
202
172
|
export type ConsultTeamResultData = { responses: ConsultTeamResponseData[] }
|
|
203
|
-
export type CreateExecutionPlanArgs = z.infer<typeof CreateExecutionPlanArgsSchema>
|
|
204
|
-
export type CreateProjectWithPlanArgs = z.infer<typeof CreateProjectWithPlanArgsSchema>
|
|
205
|
-
export type ReplaceExecutionPlanArgs = z.infer<typeof ReplaceExecutionPlanArgsSchema>
|
|
206
173
|
export type SubmitExecutionNodeResultArgs = z.infer<typeof SubmitExecutionNodeResultArgsSchema>
|
|
207
174
|
export type SubmitPlanTurnResultArgs = z.infer<typeof SubmitPlanTurnResultArgsSchema>
|
|
208
|
-
export type ListExecutionPlansArgs = z.infer<typeof ListExecutionPlansArgsSchema>
|
|
209
175
|
export type ListExecutionPlansSummary = z.infer<typeof ListExecutionPlansSummarySchema>
|
|
210
176
|
export type ListExecutionPlansToolResultData = z.infer<typeof ListExecutionPlansToolResultDataSchema>
|
|
211
|
-
export type
|
|
212
|
-
export type
|
|
177
|
+
export type ExecutionPlanProgress = z.infer<typeof ExecutionPlanProgressSchema>
|
|
178
|
+
export type ExecutionPlanNodeSummary = z.infer<typeof ExecutionPlanNodeSummarySchema>
|
|
213
179
|
export type ExecutionPlanToolResultData = z.infer<typeof ExecutionPlanToolResultDataSchema>
|
|
214
180
|
export type CreateProjectWithPlanResultData = z.infer<typeof CreateProjectWithPlanResultDataSchema>
|
|
215
181
|
export type CoreChatTools = {
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
import { baseChatMessageSchema } from './chat-api'
|
|
4
|
-
import { paginationPageSchema, paginationTakeSchema, recordIdSchema } from './common'
|
|
5
|
-
import { sdkWorkstreamSchema } from './workstream'
|
|
6
|
-
|
|
7
|
-
export const listSdkWorkstreamsRequestSchema = z.object({
|
|
8
|
-
userId: recordIdSchema,
|
|
9
|
-
organizationId: recordIdSchema,
|
|
10
|
-
mode: z.enum(['direct', 'group']),
|
|
11
|
-
core: z.boolean().optional(),
|
|
12
|
-
page: paginationPageSchema.optional(),
|
|
13
|
-
take: paginationTakeSchema.optional(),
|
|
14
|
-
includeArchived: z.boolean().default(false),
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
export const createSdkWorkstreamRequestSchema = z.object({
|
|
18
|
-
userId: recordIdSchema,
|
|
19
|
-
organizationId: recordIdSchema,
|
|
20
|
-
title: z.string().trim().min(1).max(200).optional(),
|
|
21
|
-
mode: z.enum(['direct', 'group']).default('group'),
|
|
22
|
-
agentId: z.string().trim().min(1).optional(),
|
|
23
|
-
core: z.boolean().optional(),
|
|
24
|
-
coreType: z.string().trim().min(1).optional(),
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
export const updateSdkWorkstreamRequestSchema = z.object({ title: z.string().trim().min(1).max(200) })
|
|
28
|
-
|
|
29
|
-
export const listSdkWorkstreamsResponseSchema = z.object({
|
|
30
|
-
workstreams: z.array(sdkWorkstreamSchema),
|
|
31
|
-
hasMore: z.boolean(),
|
|
32
|
-
page: z.number().optional(),
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
export const getSdkWorkstreamResponseSchema = sdkWorkstreamSchema
|
|
36
|
-
|
|
37
|
-
export const listSdkWorkstreamMessagesRequestSchema = z.object({
|
|
38
|
-
before: z.string().trim().min(1).optional(),
|
|
39
|
-
after: z.string().trim().min(1).optional(),
|
|
40
|
-
limit: paginationTakeSchema.optional(),
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
export const listSdkWorkstreamMessagesResponseSchema = z.object({
|
|
44
|
-
messages: z.array(baseChatMessageSchema),
|
|
45
|
-
hasMore: z.boolean(),
|
|
46
|
-
prevCursor: z.string().nullable().optional(),
|
|
47
|
-
nextCursor: z.string().nullable().optional(),
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
export const sdkWorkstreamMessageLookupSchema = z.object({
|
|
51
|
-
workstreamId: recordIdSchema,
|
|
52
|
-
messageId: z.string().trim().min(1),
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
export const sdkWorkstreamSendMessageRequestSchema = z.object({
|
|
56
|
-
workstreamId: recordIdSchema,
|
|
57
|
-
organizationId: recordIdSchema,
|
|
58
|
-
userId: recordIdSchema,
|
|
59
|
-
userName: z.string().trim().min(1),
|
|
60
|
-
messages: z.array(baseChatMessageSchema).min(1),
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
export type ListSdkWorkstreamsRequest = z.infer<typeof listSdkWorkstreamsRequestSchema>
|
|
64
|
-
export type CreateSdkWorkstreamRequest = z.infer<typeof createSdkWorkstreamRequestSchema>
|
|
65
|
-
export type UpdateSdkWorkstreamRequest = z.infer<typeof updateSdkWorkstreamRequestSchema>
|
|
66
|
-
export type ListSdkWorkstreamsResponse = z.infer<typeof listSdkWorkstreamsResponseSchema>
|
|
67
|
-
export type GetSdkWorkstreamResponse = z.infer<typeof getSdkWorkstreamResponseSchema>
|
|
68
|
-
export type ListSdkWorkstreamMessagesRequest = z.infer<typeof listSdkWorkstreamMessagesRequestSchema>
|
|
69
|
-
export type ListSdkWorkstreamMessagesResponse = z.infer<typeof listSdkWorkstreamMessagesResponseSchema>
|
|
70
|
-
export type SdkWorkstreamMessageLookup = z.infer<typeof sdkWorkstreamMessageLookupSchema>
|
|
71
|
-
export type SdkWorkstreamSendMessageRequest = z.infer<typeof sdkWorkstreamSendMessageRequestSchema>
|