@collective-intelligence/ai 0.9.0 → 0.9.2

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.
@@ -226,7 +226,7 @@ Your server invokes an Agent with `agents.invoke({ agentId, input })`, which ret
226
226
 
227
227
  For a multi-turn chat, use the shared chat. Start a Conversation with the Agent with `ci.chat.createConversation({ organizationId, payload: { agentId } })`, send each message with `createChatClient(ci, { organizationId }).send({ conversationId, message })` from `@collective-intelligence/external-apps-server-sdk/chat`, and read earlier turns with `ci.chat.getTranscript`. Each turn is an ordinary Agent run, and the earlier successful turns, with their saved Agent Output, become the model's conversation history. A message sent while a turn still runs steers that turn and starts no second turn, and a resend with the same message `id` adds nothing.
228
228
 
229
- `send` resolves `{ ok: true, value, runId }`: `runId` is the id of the turn's run, which the answer message also carries as `metadata.invocationId`, and `turnRunId(message)` reads it from any answer message. `runs.get`, `runs.sources` and `runs.feedback` accept that id like the `runId` of `agents.invoke`. They answer only the caller that owns the Conversation (the member, the app server or the visitor) through the application where the Conversation started, and answer `not_found` to every other caller. As for any run, only a signed-in member reads `runs.sources` and gives `runs.feedback`. `runs.get` gives the status and `result: { message, output? }`, where `output` is the Agent Output that the turn saved. `runs.sources` gives the searched Document Versions with their pages and a download link. `runs.stream` and `runs.cancel` read only runs that `agents.invoke` started: follow a turn with `GET /runs/:runId/stream` of the chat mount, and stop it with `ci.chat.cancelTurn`.
229
+ `send` resolves `{ ok: true, value, runId }`: `runId` is the id of the turn's run, which the answer message also carries as `metadata.invocationId`, and `turnRunId(message)` reads it from any answer message. `runs.get`, `runs.sources` and `runs.feedback` accept that id like the `runId` of `agents.invoke`. They answer only the caller that owns the Conversation (the member, the app server or the visitor) through the application where the Conversation started, and answer `not_found` to every other caller. As for any run, only a signed-in member reads `runs.sources` and gives `runs.feedback`. `runs.get` gives the status and `result: { message, output? }`, where `output` is the Agent Output that the turn saved. `runs.feedback` also rates a succeeded turn whose answer is only its Agent Output, with the Output's JSON text as the rated answer; a turn with neither text nor Output has no answer to rate and gets `not_found`. `runs.sources` gives the searched Document Versions with their pages and a download link. `runs.stream` and `runs.cancel` read only runs that `agents.invoke` started: follow a turn with `GET /runs/:runId/stream` of the chat mount, and stop it with `ci.chat.cancelTurn`.
230
230
 
231
231
  Anonymous visitors can chat with an Agent only when its audience has `anonymous: [app]` for that application and the call passes `caller: { kind: "anonymous_visitor", visitor: { issuer, subjectId } }`. Their turns run with the Agent's own bindings, never with the application's grants, and visitors never see each other's conversations.
232
232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collective-intelligence/ai",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "The Collective Intelligence AI package: the CI message domain, the chat contract, the chat transports, the headless chat session and the chat views, one subpath per layer.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -58,8 +58,8 @@
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@ai-sdk/react": "^4.0.177",
61
- "@collective-intelligence/effect-xstate": "0.9.0",
62
- "@collective-intelligence/ui-react": "0.9.0",
61
+ "@collective-intelligence/effect-xstate": "0.9.2",
62
+ "@collective-intelligence/ui-react": "0.9.2",
63
63
  "@tanstack/react-query": "^5.101.4",
64
64
  "@xstate/react": "^6.1.0",
65
65
  "ai": ">=7.0.173 <8",
@@ -95,8 +95,8 @@
95
95
  },
96
96
  "devDependencies": {
97
97
  "@ai-sdk/react": "4.0.177",
98
- "@collective-intelligence/effect-xstate": "0.9.0",
99
- "@collective-intelligence/ui-react": "0.9.0",
98
+ "@collective-intelligence/effect-xstate": "0.9.2",
99
+ "@collective-intelligence/ui-react": "0.9.2",
100
100
  "@effect/eslint-plugin": "0.3.2",
101
101
  "@oxlint/plugins": "1.94.0",
102
102
  "@punks/lints": "0.2.0",
@@ -121,5 +121,5 @@
121
121
  "vitest": "5.0.2",
122
122
  "xstate": "5.33.3"
123
123
  },
124
- "gitHead": "8268eaf826360188a1df4fda18f7bffd75d1575a"
124
+ "gitHead": "f2c8453ab95578ca84aaf1032db4370153a76ceb"
125
125
  }
@@ -1,2 +0,0 @@
1
- import{Uuid,ConversationId2,InvocationId2,AgentId2,ProjectId2,ProjectFileId2,AttachmentId2,QueuedMessageId2,SteeringMessageId2,SpeechClipId2}from"./domain-5fpd4fte.js";import{draftSubjectKinds2,ciDataPartSchemas2,contextTrailEntrySchema2,placeKinds2}from"./domain-50vzrrp9.js";import{Multipart}from"effect/http";import{HttpApiEndpoint,HttpApiGroup,HttpApiSchema as HttpApiSchema2}from"effect/http-api";import*as Schema3 from"effect/Schema";import{HttpApiSchema}from"effect/http-api";import*as Schema from"effect/Schema";var chatRefusalReasons2=["capability_missing","app_disabled","principal_not_allowed","not_available_here","approval_not_allowed"];var chatConflictReasons2=["turn_ended","intent_turn_busy","intent_turn_agent"];var uploadRejectionReasons2=["unsupported","oversized","malformed","too_many_files"];var statusOf={conflict:409,forbidden:403,internal:500,invalid_request:400,not_found:404,rate_limited:429,unauthenticated:401,unavailable:503};var failure=(code,fields)=>Schema.Struct({correlationId:Schema.String,error:Schema.Struct({...fields,code:Schema.Literal(code),message:Schema.String,retryable:Schema.Boolean}),ok:Schema.Literal(false)}).pipe(HttpApiSchema.status(statusOf[code]));var chatFailures=[failure("invalid_request",{details:Schema.optionalKey(Schema.Struct({filename:Schema.optionalKey(Schema.String),reason:Schema.Literals(uploadRejectionReasons2)}))}),failure("unauthenticated",{}),failure("forbidden",{details:Schema.Struct({reason:Schema.Literals(chatRefusalReasons2)})}),failure("not_found",{}),failure("conflict",{details:Schema.optionalKey(Schema.Struct({reason:Schema.Literals(chatConflictReasons2)}))}),failure("rate_limited",{}),failure("internal",{}),failure("unavailable",{})];import*as Schema2 from"effect/Schema";var partHeaderBytes=32*1024;var maxFileBytes=10*1024*1024;var maxUploadPartBytes=maxFileBytes+partHeaderBytes;var maxAttachmentsPerUpload=10;var DownloadUrl=Schema2.Struct({expiresIn:Schema2.Int,url:Schema2.String});var storedAttachmentFields={characterCount:Schema2.Int,contentType:Schema2.NullOr(Schema2.String),extension:Schema2.NullOr(Schema2.String),extractionStatus:Schema2.String,filename:Schema2.String,id:AttachmentId2,sizeBytes:Schema2.Int,truncated:Schema2.Boolean,unavailableReason:Schema2.NullOr(Schema2.String)};var UploadAttachmentsPath=Schema3.Struct({conversationId:ConversationId2});var AttachmentsUpload=Schema3.Struct({files:Multipart.FilesSchema}).pipe(HttpApiSchema2.asMultipart({maxFileSize:maxUploadPartBytes,maxParts:maxAttachmentsPerUpload}));var UploadedAttachment=Schema3.Struct(storedAttachmentFields);var UploadAttachmentsResponse=Schema3.Struct({attachments:Schema3.Array(UploadedAttachment)});var AttachmentPath=Schema3.Struct({attachmentId:AttachmentId2,conversationId:ConversationId2});var error=chatFailures;class ChatAttachmentsApi2 extends HttpApiGroup.make("chatAttachments").add(HttpApiEndpoint.post("uploadAttachments","/chat/conversations/:conversationId/attachments",{error,params:UploadAttachmentsPath,payload:AttachmentsUpload,success:UploadAttachmentsResponse.pipe(HttpApiSchema2.status(201))})).add(HttpApiEndpoint.get("getAttachmentDownloadUrl","/chat/conversations/:conversationId/attachments/:attachmentId/download-url",{error,params:AttachmentPath,success:DownloadUrl})){}import{HttpApiEndpoint as HttpApiEndpoint2,HttpApiGroup as HttpApiGroup2}from"effect/http-api";import*as Schema4 from"effect/Schema";var AgentDirectoryEntry=Schema4.Struct({agentType:Schema4.Literals(["organization","personal"]),degraded:Schema4.Boolean,displayName:Schema4.String,fqn:Schema4.String,id:AgentId2,paused:Schema4.Boolean,responsibility:Schema4.String});var ListAgentsResponse=Schema4.Struct({data:Schema4.Array(AgentDirectoryEntry)});var SkillSourceMode=Schema4.Literals(["user","skill"]);var SkillDirectoryEntry=Schema4.Struct({dataAccess:Schema4.NullOr(Schema4.Struct({datasets:Schema4.optionalKey(SkillSourceMode),documents:Schema4.optionalKey(SkillSourceMode),knowledge:Schema4.optionalKey(SkillSourceMode)})),description:Schema4.NullOr(Schema4.String),fqn:Schema4.String,id:Schema4.String,name:Schema4.String,slug:Schema4.String});var ListSkillsResponse=Schema4.Struct({data:Schema4.Array(SkillDirectoryEntry)});var ListToolsQuery=Schema4.Struct({conversationId:Schema4.optionalKey(ConversationId2),usageScope:Schema4.optionalKey(Schema4.Literals(["chat","skill","automation"]))});var ToolCatalogEntry=Schema4.Struct({collectionId:Schema4.NullOr(Schema4.String),description:Schema4.String,displayName:Schema4.String,fqn:Schema4.String,id:Schema4.String,inputSchema:Schema4.Record(Schema4.String,Schema4.Json)});var ListToolsResponse=Schema4.Struct({data:Schema4.Array(ToolCatalogEntry)});var AttachmentFileType=Schema4.Struct({extension:Schema4.String,mediaTypes:Schema4.Array(Schema4.String)});var AttachmentCapabilities=Schema4.Struct({fileTypes:Schema4.Array(AttachmentFileType),projectFileTypes:Schema4.Array(AttachmentFileType)});var error2=chatFailures;class ChatCatalogApi2 extends HttpApiGroup2.make("chatCatalog").add(HttpApiEndpoint2.get("listAgents","/chat/agents",{error:error2,success:ListAgentsResponse})).add(HttpApiEndpoint2.get("listSkills","/chat/skills",{error:error2,success:ListSkillsResponse})).add(HttpApiEndpoint2.get("listTools","/chat/tools",{error:error2,query:ListToolsQuery,success:ListToolsResponse})).add(HttpApiEndpoint2.get("getAttachmentCapabilities","/chat/attachment-capabilities",{error:error2,success:AttachmentCapabilities})){}import{HttpApiEndpoint as HttpApiEndpoint4,HttpApiGroup as HttpApiGroup4,HttpApiSchema as HttpApiSchema4}from"effect/http-api";import*as Schema5 from"effect/Schema";var EvidenceNavigationPath=Schema5.Struct({invocationId:InvocationId2});var EvidenceNavigation=Schema5.Union([Schema5.Struct({entityId:Uuid,kind:Schema5.Literal("entity")}),Schema5.Struct({fileId:Uuid,kind:Schema5.Literal("file")}),Schema5.Struct({kind:Schema5.Literal("external_url"),url:Schema5.String})]);var EvidenceNavigationRequest=Schema5.Struct({evidenceId:Schema5.NonEmptyString,navigation:EvidenceNavigation});var EvidenceNavigationTarget=Schema5.Union([Schema5.Struct({entityId:Uuid,kind:Schema5.Literal("entity")}),Schema5.Struct({fileId:Uuid,kind:Schema5.Literal("file"),mediaUrl:Schema5.optionalKey(Schema5.String)}),Schema5.Struct({kind:Schema5.Literal("external_url"),url:Schema5.String})]);var EvidenceNavigationResponse=Schema5.Struct({target:Schema5.NullOr(EvidenceNavigationTarget)});var ArtifactProgress=Schema5.Struct({currentArtifact:Schema5.NullOr(Schema5.Struct({artifactId:Uuid,contentType:Schema5.NullOr(Schema5.String),filename:Schema5.String,role:Schema5.String,sourceKind:Schema5.String})),failed:Schema5.Int,leased:Schema5.Int,pending:Schema5.Int,processed:Schema5.Int,skipped:Schema5.Int});import*as Schema7 from"effect/Schema";import*as Schema6 from"effect/Schema";import*as SchemaTransformation from"effect/SchemaTransformation";var PlaceKind=Schema6.Literals(placeKinds2);var PlaceSchema=Schema6.Union([Schema6.Struct({id:Schema6.String,kind:Schema6.Literal("studio_app")}),Schema6.Struct({id:Schema6.String,kind:Schema6.Literal("external_app")}),Schema6.Struct({id:Schema6.String,kind:Schema6.Literal("dashboard")})]);var ConversationSubjectSchema=Schema6.Struct({id:Schema6.String,kind:Schema6.Literals(draftSubjectKinds2)});var ConversationPath=Schema6.Struct({conversationId:ConversationId2});var ConversationSchema=Schema6.Struct({agentId:Schema6.NullOr(AgentId2),createdAt:Schema6.NullOr(Schema6.Date),id:ConversationId2,lastActivityAt:Schema6.NullOr(Schema6.Date),lastActivityInvocationId:Schema6.NullOr(Schema6.String),memoryEnabled:Schema6.Boolean,organizationId:Schema6.String,origin:PlaceSchema,projectId:Schema6.NullOr(ProjectId2),subject:Schema6.NullOr(ConversationSubjectSchema),title:Schema6.String,updatedAt:Schema6.NullOr(Schema6.Date),userId:Schema6.NullOr(Schema6.String)});var PlaceParam=Schema6.TemplateLiteralParser([PlaceKind,":",Schema6.String]).pipe(Schema6.decodeTo(PlaceSchema,SchemaTransformation.transform({decode:([kind,,id])=>({id,kind}),encode:(place)=>[place.kind,":",place.id]})));var SubjectParam=Schema6.TemplateLiteralParser([Schema6.Literals(draftSubjectKinds2),":",Schema6.String]).pipe(Schema6.decodeTo(ConversationSubjectSchema,SchemaTransformation.transform({decode:([kind,,id])=>({id,kind}),encode:(subject)=>[subject.kind,":",subject.id]})));var ListConversationsQuery=Schema6.Struct({historyScope:Schema6.optionalKey(Schema6.Array(PlaceParam)),subject:Schema6.optionalKey(SubjectParam)});var ListConversationsResponse=Schema6.Struct({data:Schema6.Array(ConversationSchema)});var CreateConversationRequest=Schema6.Struct({agentId:Schema6.optionalKey(AgentId2),projectId:Schema6.optionalKey(ProjectId2),title:Schema6.optionalKey(Schema6.String)});var UpdateConversationRequest=Schema6.Struct({memoryEnabled:Schema6.optionalKey(Schema6.Boolean),projectId:Schema6.optionalKey(Schema6.NullOr(ProjectId2)),title:Schema6.optionalKey(Schema6.String)});var CompactionState=Schema7.Struct({active:Schema7.Boolean,activeSummary:Schema7.NullOr(Schema7.Struct({id:Uuid,status:Schema7.String,summary:Schema7.String,trigger:Schema7.String})),boundary:Schema7.NullOr(Schema7.Struct({compactedThroughInvocationId:Schema7.NullOr(InvocationId2),coveredInvocationCount:Schema7.Int,coveredMessageCount:Schema7.Int}))});var CompactionResponse=Schema7.Struct({compaction:CompactionState,conversation:ConversationSchema});import*as Effect from"effect/Effect";import*as Schema8 from"effect/Schema";var NamedPlace=Schema8.Struct({id:Schema8.String,kind:PlaceKind,name:Schema8.NullOr(Schema8.String)});var PlaceContextSchema=Schema8.Struct({contextTrailEnabled:Schema8.Boolean.pipe(Schema8.withDecodingDefaultKey(Effect.succeed(false))),contextTrailVisible:Schema8.Boolean.pipe(Schema8.withDecodingDefaultKey(Effect.succeed(false))),places:Schema8.Array(NamedPlace),readAloud:Schema8.Boolean,voiceInputMode:Schema8.optionalKey(Schema8.Literals(["local","remote"]))});import*as Schema10 from"effect/Schema";import{HttpApiEndpoint as HttpApiEndpoint3,HttpApiGroup as HttpApiGroup3}from"effect/http-api";import*as Schema9 from"effect/Schema";var AnswerSentiment=Schema9.Literals(["positive","negative"]);var CurrentUserFeedback=Schema9.Struct({sentiment:Schema9.NullOr(AnswerSentiment),submitterNote:Schema9.NullOr(Schema9.String)});var AnswerFeedbackPath=Schema9.Struct({invocationId:InvocationId2});var AnswerFeedbackRequest=Schema9.Struct({sentiment:AnswerSentiment,submitterNote:Schema9.optionalKey(Schema9.String)});var AnswerFeedbackResponse=Schema9.Struct({currentUserFeedback:CurrentUserFeedback,feedbackTargetId:Uuid});var error3=chatFailures;class ChatFeedbackApi2 extends HttpApiGroup3.make("chatFeedback").add(HttpApiEndpoint3.put("putAnswerFeedback","/chat/answers/:invocationId/feedback",{error:error3,params:AnswerFeedbackPath,payload:AnswerFeedbackRequest,success:AnswerFeedbackResponse})).add(HttpApiEndpoint3.delete("clearAnswerFeedback","/chat/answers/:invocationId/feedback",{error:error3,params:AnswerFeedbackPath,success:AnswerFeedbackResponse})){}var TranscriptToolDisplay=Schema10.Union([Schema10.Struct({kind:Schema10.Literal("text"),text:Schema10.String}),Schema10.Struct({kind:Schema10.Literal("unavailable")})]);var TranscriptAttachment=Schema10.Struct({...storedAttachmentFields,mediaUrl:Schema10.NullOr(Schema10.String)});var ToolDisplayPart=Schema10.Struct({data:Schema10.Unknown,description:Schema10.NullOr(Schema10.String),metadata:Schema10.Record(Schema10.String,Schema10.Unknown),title:Schema10.NullOr(Schema10.String),type:Schema10.String});var ToolTrace=Schema10.Struct({displayName:Schema10.NullOr(Schema10.String),displayParts:Schema10.Array(ToolDisplayPart),durationMs:Schema10.NullOr(Schema10.Finite),error:Schema10.NullOr(Schema10.String),fqn:Schema10.NullOr(Schema10.String),toolCallId:Schema10.optionalKey(Schema10.NullOr(Schema10.String)),toolId:Schema10.NullOr(Schema10.String)});var InteractionOption=Schema10.Struct({description:Schema10.NullOr(Schema10.String),id:Schema10.String,label:Schema10.String});var InteractionOperation=Schema10.Union([Schema10.Struct({displayName:Schema10.String,kind:Schema10.Literal("tool"),toolFqn:Schema10.String,toolId:Uuid}),Schema10.Struct({displayName:Schema10.String,fqn:Schema10.String,inputs:Schema10.Record(Schema10.String,Schema10.Json),kind:Schema10.Literal("intent")})]);var UserInteraction=Schema10.Struct({allowFreeText:Schema10.Boolean,id:Uuid,kind:Schema10.Literals(["approval","question"]),mode:Schema10.NullOr(Schema10.Literals(["open","single_choice"])),operation:Schema10.NullOr(InteractionOperation),options:Schema10.Array(InteractionOption),preview:Schema10.NullOr(Schema10.String),prompt:Schema10.String,safePreview:Schema10.NullOr(Schema10.String),status:Schema10.Literals(["pending","responding","completed","cancelled","failed"]),summary:Schema10.NullOr(Schema10.String)});var ProcessingEvent=Schema10.Struct({data:Schema10.Record(Schema10.String,Schema10.Unknown),event:Schema10.String});var MemoryEvidenceEvent=Schema10.Struct({category:Schema10.NullOr(Schema10.String),conversationId:Schema10.NullOr(ConversationId2),invocationId:Schema10.NullOr(InvocationId2),kind:Schema10.String,lifecycleStatus:Schema10.NullOr(Schema10.String),memoryId:Schema10.NullOr(Uuid),reason:Schema10.NullOr(Schema10.String),scope:Schema10.NullOr(Schema10.String)});var TranscriptIntentCards=Schema10.optionalKey(Schema10.Array(ciDataPartSchemas2["intent-card"]));var TranscriptRun=Schema10.Struct({approvalRequestId:Schema10.NullOr(Uuid),conversationId:ConversationId2,durationMs:Schema10.Finite,inputTokens:Schema10.Int,intentCards:TranscriptIntentCards,invocationId:InvocationId2,memoryEvidence:Schema10.NullOr(Schema10.Struct({events:Schema10.Array(MemoryEvidenceEvent)})),model:Schema10.NullOr(Schema10.String),output:Schema10.String,outputTokens:Schema10.Int,permissionWait:Schema10.NullOr(Schema10.Struct({capabilityKind:Schema10.Literals(["skill","tool"]),invocationId:InvocationId2,subjectId:Uuid})),processingEvents:Schema10.Array(ProcessingEvent),skillOutcome:Schema10.NullOr(Schema10.String),status:Schema10.String,toolTrace:Schema10.Array(ToolTrace),traceLink:Schema10.optionalKey(Schema10.String),userInteraction:Schema10.NullOr(UserInteraction)});var TranscriptMessage=Schema10.Struct({approvalRequestId:Schema10.NullOr(Uuid),attachments:Schema10.Array(TranscriptAttachment),content:Schema10.String,contextTrail:Schema10.optionalKey(Schema10.Array(contextTrailEntrySchema2)),conversationId:ConversationId2,currentUserFeedback:Schema10.optionalKey(CurrentUserFeedback),feedbackTargetId:Schema10.optionalKey(Uuid),invocationId:InvocationId2,processingEvents:Schema10.Array(ProcessingEvent),role:Schema10.Literals(["assistant","user"]),run:Schema10.optionalKey(TranscriptRun),status:Schema10.String,toolDisplay:TranscriptToolDisplay});var TranscriptSteeringMessage=Schema10.Struct({attachments:Schema10.Array(TranscriptAttachment),claimedAt:Schema10.NullOr(Schema10.Date),content:Schema10.String,id:SteeringMessageId2,invocationId:InvocationId2});var TranscriptAgentTurn=Schema10.Struct({completedAt:Schema10.NullOr(Schema10.Date),createdAt:Schema10.Date,input:Schema10.String,intentCards:TranscriptIntentCards,message:Schema10.NullOr(Schema10.String),sequence:Schema10.Int,status:Schema10.Literals(["pending","completed","failed","cancelled"]),turnId:Uuid});var TranscriptSchema2=Schema10.Struct({agentTurns:Schema10.Array(TranscriptAgentTurn),conversation:Schema10.Struct({agent:Schema10.NullOr(Schema10.Struct({displayName:Schema10.String,id:AgentId2})),compaction:CompactionState,contextUsage:Schema10.Struct({estimatedCharacters:Schema10.Int,fillRatio:Schema10.Finite,thresholdCharacters:Schema10.Int}),id:ConversationId2,title:Schema10.String}),messages:Schema10.Array(TranscriptMessage),steeringMessages:Schema10.Array(TranscriptSteeringMessage)});import{HttpApiSchema as HttpApiSchema3}from"effect/http-api";import*as Schema11 from"effect/Schema";var UIMessageEventStream=Schema11.String.pipe(HttpApiSchema3.asText({contentType:"text/event-stream"}));var UIMessagePart=Schema11.StructWithRest(Schema11.Struct({type:Schema11.String}),[Schema11.Record(Schema11.String,Schema11.Unknown)]);var ChatSendMessage=Schema11.Struct({id:Schema11.NonEmptyString,metadata:Schema11.optionalKey(Schema11.Unknown),parts:Schema11.Array(UIMessagePart),role:Schema11.Literals(["system","user","assistant"])});var ChatSendRequestSchema=Schema11.Struct({message:ChatSendMessage,messageId:Schema11.optionalKey(Schema11.String),trigger:Schema11.Literals(["submit-message","regenerate-message"])});var RunPath=Schema11.Struct({runId:InvocationId2});var TurnStatus=Schema11.Literals(["cancelled","completed","error","running","waiting_for_approval"]);var TurnPath=Schema11.Struct({invocationId:InvocationId2});var ConversationTurnPath=Schema11.Struct({conversationId:ConversationId2,invocationId:InvocationId2});var TurnWaitResponse=Schema11.Struct({waiting:Schema11.Boolean});var CancelTurnResponse=Schema11.Struct({invocationId:InvocationId2,status:TurnStatus});var QueuedMessageRevision=Schema11.Int.check(Schema11.isGreaterThanOrEqualTo(1));var ClientMessageId=Uuid;var QueuedMessageSchema=Schema11.Struct({content:Schema11.String,createdAt:Schema11.Date,id:QueuedMessageId2,invocationId:Schema11.NullOr(InvocationId2),position:Schema11.Int,revision:QueuedMessageRevision,status:Schema11.Literals(["waiting","claimed","removed"])});var SendSteeringMessageRequest=Schema11.Struct({clientMessageId:ClientMessageId,content:Schema11.String,invocationId:InvocationId2});var SendSteeringMessageResponseSchema=Schema11.Union([Schema11.Struct({conversationId:ConversationId2,invocationId:InvocationId2,outcome:Schema11.Literal("started"),status:TurnStatus}),Schema11.Struct({conversationId:ConversationId2,invocationId:InvocationId2,outcome:Schema11.Literal("saved"),status:TurnStatus,steeringMessageId:SteeringMessageId2}),Schema11.Struct({conversationId:ConversationId2,outcome:Schema11.Literal("queued"),queuedMessageId:QueuedMessageId2,revision:QueuedMessageRevision})]);var QueueMessageRequest=Schema11.Struct({clientMessageId:ClientMessageId,content:Schema11.String});var QueueMessageResponseSchema=Schema11.Union([Schema11.Struct({conversationId:ConversationId2,outcome:Schema11.Literal("queued"),queuedMessage:QueuedMessageSchema}),Schema11.Struct({conversationId:ConversationId2,invocationId:Schema11.optionalKey(InvocationId2),outcome:Schema11.Literal("started"),queuedMessageId:Schema11.optionalKey(QueuedMessageId2)}),Schema11.Struct({conversationId:ConversationId2,invocationId:InvocationId2,outcome:Schema11.Literal("saved"),steeringMessageId:SteeringMessageId2})]);var ListQueuedMessagesResponse=Schema11.Struct({data:Schema11.Array(QueuedMessageSchema)});var QueuedMessagePath=Schema11.Struct({conversationId:ConversationId2,queuedMessageId:QueuedMessageId2});var UpdateQueuedMessageRequest=Schema11.Struct({content:Schema11.String,revision:QueuedMessageRevision});var RemoveQueuedMessageQuery=Schema11.Struct({revision:Schema11.NumberFromString.pipe(Schema11.check(Schema11.isInt(),Schema11.isGreaterThanOrEqualTo(1)))});var error4=chatFailures;class ChatApi2 extends HttpApiGroup4.make("chat").add(HttpApiEndpoint4.get("listConversations","/chat/conversations",{error:error4,query:ListConversationsQuery,success:ListConversationsResponse})).add(HttpApiEndpoint4.post("createConversation","/chat/conversations",{error:error4,payload:CreateConversationRequest,success:ConversationSchema.pipe(HttpApiSchema4.status(201))})).add(HttpApiEndpoint4.get("getConversation","/chat/conversations/:conversationId",{error:error4,params:ConversationPath,success:ConversationSchema})).add(HttpApiEndpoint4.patch("updateConversation","/chat/conversations/:conversationId",{error:error4,params:ConversationPath,payload:UpdateConversationRequest,success:ConversationSchema})).add(HttpApiEndpoint4.delete("deleteConversation","/chat/conversations/:conversationId",{error:error4,params:ConversationPath,success:HttpApiSchema4.NoContent})).add(HttpApiEndpoint4.get("getTranscript","/chat/conversations/:conversationId/transcript",{error:error4,params:ConversationPath,success:TranscriptSchema2})).add(HttpApiEndpoint4.post("send","/chat/:conversationId",{error:error4,params:ConversationPath,payload:ChatSendRequestSchema,success:UIMessageEventStream})).add(HttpApiEndpoint4.get("resumeStream","/chat/:conversationId/stream",{error:error4,params:ConversationPath,success:[UIMessageEventStream,HttpApiSchema4.NoContent]})).add(HttpApiEndpoint4.get("streamRun","/runs/:runId/stream",{error:error4,params:RunPath,success:UIMessageEventStream})).add(HttpApiEndpoint4.get("watchTurnWait","/chat/conversations/:conversationId/turns/:invocationId/wait",{error:error4,params:ConversationTurnPath,success:TurnWaitResponse})).add(HttpApiEndpoint4.post("cancelTurn","/chat/turns/:invocationId/cancel",{error:error4,params:TurnPath,success:CancelTurnResponse})).add(HttpApiEndpoint4.post("sendSteeringMessage","/chat/conversations/:conversationId/steering-messages",{error:error4,params:ConversationPath,payload:SendSteeringMessageRequest,success:SendSteeringMessageResponseSchema})).add(HttpApiEndpoint4.post("queueMessage","/chat/conversations/:conversationId/queued-messages",{error:error4,params:ConversationPath,payload:QueueMessageRequest,success:QueueMessageResponseSchema})).add(HttpApiEndpoint4.get("listQueuedMessages","/chat/conversations/:conversationId/queued-messages",{error:error4,params:ConversationPath,success:ListQueuedMessagesResponse})).add(HttpApiEndpoint4.patch("updateQueuedMessage","/chat/conversations/:conversationId/queued-messages/:queuedMessageId",{error:error4,params:QueuedMessagePath,payload:UpdateQueuedMessageRequest,success:QueuedMessageSchema})).add(HttpApiEndpoint4.delete("removeQueuedMessage","/chat/conversations/:conversationId/queued-messages/:queuedMessageId",{error:error4,params:QueuedMessagePath,query:RemoveQueuedMessageQuery,success:HttpApiSchema4.NoContent})).add(HttpApiEndpoint4.get("getPlaceContext","/chat/place-context",{error:error4,success:PlaceContextSchema})).add(HttpApiEndpoint4.get("getCompaction","/chat/conversations/:conversationId/compaction",{error:error4,params:ConversationPath,success:CompactionResponse})).add(HttpApiEndpoint4.post("compact","/chat/conversations/:conversationId/compactions",{error:error4,params:ConversationPath,success:CompactionResponse})).add(HttpApiEndpoint4.post("regenerateCompaction","/chat/conversations/:conversationId/compactions/regenerate",{error:error4,params:ConversationPath,success:CompactionResponse})).add(HttpApiEndpoint4.delete("resetCompaction","/chat/conversations/:conversationId/compactions/active",{error:error4,params:ConversationPath,success:CompactionResponse})).add(HttpApiEndpoint4.post("resolveEvidenceNavigation","/chat/invocations/:invocationId/evidence-navigation",{error:error4,params:EvidenceNavigationPath,payload:EvidenceNavigationRequest,success:EvidenceNavigationResponse})).add(HttpApiEndpoint4.get("getArtifactProgress","/chat/conversations/:conversationId/artifact-progress",{error:error4,params:ConversationPath,success:ArtifactProgress})){}import*as Effect2 from"effect/Effect";import*as Equal from"effect/Equal";import{HttpClient,HttpClientResponse}from"effect/http";import{HttpApi,HttpApiClient}from"effect/http-api";import*as Option from"effect/Option";import{Multipart as Multipart2}from"effect/http";import{HttpApiEndpoint as HttpApiEndpoint5,HttpApiGroup as HttpApiGroup5,HttpApiSchema as HttpApiSchema5}from"effect/http-api";import*as Schema12 from"effect/Schema";var ProjectName=Schema12.Trim.check(Schema12.isMinLength(1),Schema12.isMaxLength(200));var ProjectInstructions=Schema12.String.check(Schema12.isMaxLength(8000));var ProjectPath=Schema12.Struct({projectId:ProjectId2});var ProjectCreateRequest=Schema12.Struct({name:ProjectName});var ProjectUpdateRequest=Schema12.Struct({instructions:Schema12.optionalKey(Schema12.NullOr(ProjectInstructions)),name:Schema12.optionalKey(ProjectName)});var ProjectSchema=Schema12.Struct({createdAt:Schema12.Date,id:ProjectId2,instructions:Schema12.NullOr(Schema12.String),name:Schema12.String,updatedAt:Schema12.Date});var ProjectList=Schema12.Struct({data:Schema12.Array(ProjectSchema)});var ProjectFilePath=Schema12.Struct({fileId:ProjectFileId2,projectId:ProjectId2});var ProjectFileSchema=Schema12.Struct({contentType:Schema12.NullOr(Schema12.String),createdAt:Schema12.Date,extractionState:Schema12.Literals(["available","truncated","failed"]),filename:Schema12.String,id:ProjectFileId2,inContext:Schema12.Boolean,sizeBytes:Schema12.Int});var ProjectFileList=Schema12.Struct({files:Schema12.Array(ProjectFileSchema),maxCharacters:Schema12.Int,usedCharacters:Schema12.Int});var ProjectFileUpload=Schema12.Struct({file:Multipart2.SingleFileSchema}).pipe(HttpApiSchema5.asMultipart({maxFileSize:maxUploadPartBytes,maxParts:1}));var error5=chatFailures;class ChatProjectsApi2 extends HttpApiGroup5.make("chatProjects").add(HttpApiEndpoint5.get("listProjects","/chat/projects",{error:error5,success:ProjectList})).add(HttpApiEndpoint5.post("createProject","/chat/projects",{error:error5,payload:ProjectCreateRequest,success:ProjectSchema.pipe(HttpApiSchema5.status(201))})).add(HttpApiEndpoint5.patch("updateProject","/chat/projects/:projectId",{error:error5,params:ProjectPath,payload:ProjectUpdateRequest,success:ProjectSchema})).add(HttpApiEndpoint5.delete("deleteProject","/chat/projects/:projectId",{error:error5,params:ProjectPath,success:HttpApiSchema5.NoContent})).add(HttpApiEndpoint5.get("listProjectFiles","/chat/projects/:projectId/files",{error:error5,params:ProjectPath,success:ProjectFileList})).add(HttpApiEndpoint5.post("uploadProjectFile","/chat/projects/:projectId/files",{error:error5,params:ProjectPath,payload:ProjectFileUpload,success:ProjectFileSchema.pipe(HttpApiSchema5.status(201))})).add(HttpApiEndpoint5.delete("deleteProjectFile","/chat/projects/:projectId/files/:fileId",{error:error5,params:ProjectFilePath,success:HttpApiSchema5.NoContent})).add(HttpApiEndpoint5.get("getProjectFileDownloadUrl","/chat/projects/:projectId/files/:fileId/download-url",{error:error5,params:ProjectFilePath,success:DownloadUrl})){}import{HttpApiEndpoint as HttpApiEndpoint6,HttpApiGroup as HttpApiGroup6}from"effect/http-api";import*as Schema13 from"effect/Schema";var maxClipBytes=25*1024*1024;var ClipContentType=Schema13.String.check(Schema13.isMaxLength(255),Schema13.isPattern(/^audio\/[a-z0-9][a-z0-9!#$&^_.+-]*(?:\s*;.*)?$/iu));var CreateSpeechClipRequest=Schema13.Struct({contentType:ClipContentType,size:Schema13.Int.check(Schema13.isBetween({maximum:maxClipBytes,minimum:1}))});var SpeechClipUpload=Schema13.Struct({clipId:SpeechClipId2,headers:Schema13.Record(Schema13.String,Schema13.String),method:Schema13.Literal("PUT"),url:Schema13.String});var TranscribeSpeechClipRequest=Schema13.Struct({clipId:SpeechClipId2});var SpeechTranscription=Schema13.Struct({text:Schema13.String});var ReadAloudPartPath=Schema13.Struct({invocationId:InvocationId2,partIndex:Schema13.NumberFromString.pipe(Schema13.check(Schema13.isInt(),Schema13.isGreaterThanOrEqualTo(0),Schema13.isLessThanOrEqualTo(1e4)))});var ReadAloudPart=Schema13.Struct({partCount:Schema13.Int,url:Schema13.String});var SpeechAvailability=Schema13.Struct({readAloud:Schema13.Boolean,remoteTranscription:Schema13.Boolean});var error6=chatFailures;class ChatSpeechApi2 extends HttpApiGroup6.make("chatSpeech").add(HttpApiEndpoint6.post("createSpeechClip","/chat/speech/clips",{error:error6,payload:CreateSpeechClipRequest,success:SpeechClipUpload})).add(HttpApiEndpoint6.post("transcribeSpeechClip","/chat/speech/transcriptions",{error:error6,payload:TranscribeSpeechClipRequest,success:SpeechTranscription})).add(HttpApiEndpoint6.get("getReadAloudPart","/chat/speech/read-aloud/:invocationId/parts/:partIndex",{error:error6,params:ReadAloudPartPath,success:ReadAloudPart})).add(HttpApiEndpoint6.get("getSpeechAvailability","/chat/speech/availability",{error:error6,success:SpeechAvailability})){}class ChatSurfaceApi2 extends HttpApi.make("chat-surface").add(ChatApi2).add(ChatProjectsApi2).add(ChatAttachmentsApi2).add(ChatSpeechApi2).add(ChatFeedbackApi2).add(ChatCatalogApi2){}var responsesByReference=(client)=>HttpClient.tap(client,(response)=>Effect2.sync(()=>{Equal.byReferenceUnsafe(response);const source=HttpClientResponse.toWeb(response);if(Option.isSome(source)){Equal.byReferenceUnsafe(source.value)}}));var makeChatSurfaceClient2=({transformClient,...options})=>HttpApiClient.make(ChatSurfaceApi2,{...options,transformClient:(client)=>responsesByReference(transformClient?.(client)??client)});
2
- export{chatRefusalReasons2,chatConflictReasons2,uploadRejectionReasons2,ChatAttachmentsApi2,ChatCatalogApi2,ChatFeedbackApi2,TranscriptSchema2,ChatApi2,ChatProjectsApi2,ChatSpeechApi2,ChatSurfaceApi2,makeChatSurfaceClient2};
File without changes