feat(core): add integration-backed search
This commit is contained in:
parent
41d11a8a89
commit
129012c3ee
50 changed files with 1745 additions and 478 deletions
|
|
@ -6,7 +6,12 @@ export type { AISDKHooks } from "./aisdk.js"
|
|||
export type { CatalogDraft, CatalogHooks, CatalogProviderRecord } from "./catalog.js"
|
||||
export type { CommandDraft, CommandHooks } from "./command.js"
|
||||
export type { EventHooks } from "./event.js"
|
||||
export type { IntegrationDraft, IntegrationHooks, IntegrationMethodRegistration } from "./integration.js"
|
||||
export type {
|
||||
IntegrationDraft,
|
||||
IntegrationHooks,
|
||||
IntegrationMethodRegistration,
|
||||
IntegrationSearchCapabilityRegistration,
|
||||
} from "./integration.js"
|
||||
export type { ReferenceDraft, ReferenceHooks } from "./reference.js"
|
||||
export type { SkillDraft, SkillHooks } from "./skill.js"
|
||||
export * as Tool from "./tool.js"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import type {
|
|||
IntegrationRef,
|
||||
} from "@opencode-ai/sdk/v2/types"
|
||||
import type { IntegrationApi } from "@opencode-ai/client/effect/api"
|
||||
import type { Search } from "@opencode-ai/schema/search"
|
||||
import type { Effect, Scope } from "effect"
|
||||
import type { TransformHook } from "./registration.js"
|
||||
|
||||
|
|
@ -44,6 +45,18 @@ export type IntegrationMethodRegistration =
|
|||
readonly method: IntegrationEnvMethod
|
||||
}
|
||||
|
||||
export interface IntegrationSearchCapabilityRegistration {
|
||||
readonly integrationID: string
|
||||
readonly capability: {
|
||||
readonly type: "search"
|
||||
readonly connection: "optional" | "required"
|
||||
}
|
||||
readonly execute: (
|
||||
input: Search.Input,
|
||||
context: { readonly credential?: CredentialValue; readonly sessionID?: string },
|
||||
) => Effect.Effect<Search.ProviderOutput, unknown>
|
||||
}
|
||||
|
||||
export interface IntegrationDraft {
|
||||
list(): readonly IntegrationRef[]
|
||||
get(id: string): IntegrationRef | undefined
|
||||
|
|
@ -54,6 +67,13 @@ export interface IntegrationDraft {
|
|||
update(input: IntegrationMethodRegistration): void
|
||||
remove(integrationID: string, method: IntegrationMethod): void
|
||||
}
|
||||
readonly capability: {
|
||||
readonly search: {
|
||||
list(): readonly IntegrationSearchCapabilityRegistration[]
|
||||
update(input: IntegrationSearchCapabilityRegistration): void
|
||||
remove(integrationID: string): void
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface IntegrationHooks extends IntegrationApi<unknown> {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,12 @@ export type { AISDKHooks } from "./aisdk.js"
|
|||
export type { CatalogDraft, CatalogHooks, CatalogProviderRecord } from "./catalog.js"
|
||||
export type { CommandDraft, CommandHooks } from "./command.js"
|
||||
export type { EventHooks } from "./event.js"
|
||||
export type { IntegrationDraft, IntegrationHooks, IntegrationMethodRegistration } from "./integration.js"
|
||||
export type {
|
||||
IntegrationDraft,
|
||||
IntegrationHooks,
|
||||
IntegrationMethodRegistration,
|
||||
IntegrationSearchCapabilityRegistration,
|
||||
} from "./integration.js"
|
||||
export type { ReferenceDraft, ReferenceHooks } from "./reference.js"
|
||||
export type { SessionHooks } from "./runtime.js"
|
||||
export type { SkillDraft, SkillHooks } from "./skill.js"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,32 @@
|
|||
import type { IntegrationApi } from "@opencode-ai/client/promise/api"
|
||||
import type { IntegrationDraft, IntegrationMethodRegistration } from "../effect/integration.js"
|
||||
import type { IntegrationMethodRegistration } from "../effect/integration.js"
|
||||
import type { CredentialValue } from "@opencode-ai/sdk/v2/types"
|
||||
import type { Search } from "@opencode-ai/schema/search"
|
||||
import type { TransformHook } from "./registration.js"
|
||||
|
||||
export type { IntegrationDraft, IntegrationMethodRegistration }
|
||||
export type { IntegrationMethodRegistration }
|
||||
|
||||
export interface IntegrationSearchCapabilityRegistration {
|
||||
readonly integrationID: string
|
||||
readonly capability: {
|
||||
readonly type: "search"
|
||||
readonly connection: "optional" | "required"
|
||||
}
|
||||
readonly execute: (
|
||||
input: Search.Input,
|
||||
context: { readonly credential?: CredentialValue; readonly sessionID?: string; readonly signal: AbortSignal },
|
||||
) => Promise<Search.ProviderOutput>
|
||||
}
|
||||
|
||||
export interface IntegrationDraft extends Omit<import("../effect/integration.js").IntegrationDraft, "capability"> {
|
||||
readonly capability: {
|
||||
readonly search: {
|
||||
list(): readonly IntegrationSearchCapabilityRegistration[]
|
||||
update(input: IntegrationSearchCapabilityRegistration): void
|
||||
remove(integrationID: string): void
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface IntegrationHooks extends IntegrationApi {
|
||||
readonly transform: TransformHook<IntegrationDraft>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue