mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-01 15:32:11 +08:00
7ea50aac14
* tweak: use theme tokens for debug bar surface * chore: update nix node_modules hashes * feat(tui): add heap snapshot functionality for TUI and server (#19028) * ci * change model for changelog * release: v1.3.2 * fix(opencode): skip typechecking generated models snapshot (#19018) * Revert "fix(app): more startup efficiency (#18985)" This reverts commit98b3340cee. * Revert "fix(app): startup efficiency (#18854)" This reverts commit546748a461. * effectify Worktree service (#18679) * fix: increase operations-per-run to 1000 and pin stale action to v10.2.0 The stale-issues workflow was hitting the default 30 operations limit, preventing it from processing all 2900+ issues/PRs. Increased to 1000 to handle the full backlog. Also pinned to exact v10.2.0 for reproducibility. * Add close-issues script and GitHub Action - Create script/github/close-issues.ts to close stale issues after 60 days - Add GitHub Action workflow to run daily at 2 AM - Remove old stale-issues workflow to avoid conflicts * Fix close-issues workflow permissions - Add contents: read permission for checkout - Use github.token instead of secrets.GITHUB_TOKEN * Process issues sequentially to avoid rate limits * Change issue close reason from not_planned to completed * fix(opencode): avoid snapshotting files over 2MB (#19043) * fix: provide merge context to beta conflict resolver (#19055) * tweak: only spawn lsp servers for files in current instance (or cwd if instance is global) (#19058) * fix: beta resolver typecheck + build smoke check (#19060) * fix: unblock beta conflict recovery (#19068) * electron: add createDirectory to open directory picker (#19071) * electron: remove file extension from electron-store wrapper (#19082) * app: pre-warm project globalSync state when navigate project via keybind (#19088) * fix(app): move message navigation off cmd+arrow (#18728) * Reapply "fix(app): startup efficiency (#18854)" This reverts commita379eb3867. * Reapply "fix(app): more startup efficiency (#18985)" This reverts commitcbe1337f24. * fix(app): hash inline script for csp * Revert "fix(app): startup efficiency" * Reapply "fix(app): startup efficiency" This reverts commit898456a25c. * fix(app): opencode web server url * chore(app): markdown playground in storyboard * chore(app): markdown playground in storyboard * feat(core): initial implementation of syncing (#17814) * chore: generate * chore: bump modelcontextprotocol/sdk to 1.27.1 (#19064) * chore: storybook tweaks * feat: restore git-backed review modes with effectful git service (#18900) * chore: generate * chore: update nix node_modules hashes * chore: cleanup * chore: remove dead code for todoread tool (#19128) * chore: storybook tweaks * fix(opencode): classify ZlibError from Bun fetch as retryable instead of unknown (#19104) Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> * fix(task): respect agent permission config for todowrite tool (#19125) * fix(app): agent normalization (#19169) * fix: Windows e2e stability (CrossSpawnSpawner, snapshot isolation, session race guards) (#19163) * fix+refactor(mcp): lifecycle tests, cancelPending fix, Effect migration (#19042) * effectify Bus service: migrate to Effect PubSub + InstanceState (#18579) * file: use Effect.cached for scan deduplication (#19164) * ignore: update disavowed list (#19184) * skill: use Effect.cached for load deduplication (#19165) * chore: generate * fix: bump gitlab-ai-provider to 5.3.3 for DWS tool approval support (#19185) * test: restore 5 workers on Windows e2e (#19188) * fix(opencode): image paste on Windows Terminal 1.25+ with kitty keyboard (#17674) * chore: update nix node_modules hashes * wip: zen * wip: zen * go: do not respect disabled zen models * fix: ensure enterprise url is set properly during auth flow (#19212) * revert: roll back git-backed review modes (#19295) * chore: generate * tui: bypass local SSE event streaming in worker (#19183) * feat: embed WebUI in binary with proxy flags (#19299) Co-authored-by: BlankParticle <blankparticle@gmail.com> * release: v1.3.3 * refactor: kilo compat for v1.3.3 * fix: Typecheck issues * fix(build): normalize backslashes in web UI bundle import paths Replace backslashes with forward slashes in embedded web UI file import paths to ensure correct module resolution on Windows. * fix: Add mcp reconnect error handling * chore(script): use forward slashes in web UI bundle export keys Ensure embedded file map keys use POSIX-style paths so lookups are consistent across platforms. * chore: regenerate source links --------- Co-authored-by: Jay V <air@live.ca> Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Dax <mail@thdxr.com> Co-authored-by: Dax Raad <d@ironbay.co> Co-authored-by: opencode <opencode@sst.dev> Co-authored-by: Kit Langton <kit.langton@gmail.com> Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com> Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: Brendan Allan <brendonovich@outlook.com> Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com> Co-authored-by: James Long <longster@gmail.com> Co-authored-by: André Cruz <acruz@cloudflare.com> Co-authored-by: Ariane Emory <97994360+ariane-emory@users.noreply.github.com> Co-authored-by: Vladimir Glafirov <vglafirov@gitlab.com> Co-authored-by: Frank <frank@anoma.ly> Co-authored-by: BlankParticle <blankparticle@gmail.com> Co-authored-by: Imanol Maiztegui <imanol.mzd@gmail.com>
123 lines
4.1 KiB
TypeScript
123 lines
4.1 KiB
TypeScript
import path from "path"
|
|
import { Effect, Layer, Record, Result, Schema, ServiceMap } from "effect"
|
|
import { makeRuntime } from "@/effect/run-service"
|
|
import { zod } from "@/util/effect-zod"
|
|
import { Global } from "../global"
|
|
import { Filesystem } from "../util/filesystem"
|
|
import { Telemetry } from "@kilocode/kilo-telemetry" // kilocode_change
|
|
|
|
export const OAUTH_DUMMY_KEY = "opencode-oauth-dummy-key"
|
|
|
|
const file = path.join(Global.Path.data, "auth.json")
|
|
|
|
const fail = (message: string) => (cause: unknown) => new Auth.AuthError({ message, cause })
|
|
|
|
export namespace Auth {
|
|
export class Oauth extends Schema.Class<Oauth>("OAuth")({
|
|
type: Schema.Literal("oauth"),
|
|
refresh: Schema.String,
|
|
access: Schema.String,
|
|
expires: Schema.Number,
|
|
accountId: Schema.optional(Schema.String),
|
|
enterpriseUrl: Schema.optional(Schema.String),
|
|
}) {}
|
|
|
|
export class Api extends Schema.Class<Api>("ApiAuth")({
|
|
type: Schema.Literal("api"),
|
|
key: Schema.String,
|
|
}) {}
|
|
|
|
export class WellKnown extends Schema.Class<WellKnown>("WellKnownAuth")({
|
|
type: Schema.Literal("wellknown"),
|
|
key: Schema.String,
|
|
token: Schema.String,
|
|
}) {}
|
|
|
|
const _Info = Schema.Union([Oauth, Api, WellKnown]).annotate({ discriminator: "type", identifier: "Auth" })
|
|
export const Info = Object.assign(_Info, { zod: zod(_Info) })
|
|
export type Info = Schema.Schema.Type<typeof _Info>
|
|
|
|
export class AuthError extends Schema.TaggedErrorClass<AuthError>()("AuthError", {
|
|
message: Schema.String,
|
|
cause: Schema.optional(Schema.Defect),
|
|
}) {}
|
|
|
|
export interface Interface {
|
|
readonly get: (providerID: string) => Effect.Effect<Info | undefined, AuthError>
|
|
readonly all: () => Effect.Effect<Record<string, Info>, AuthError>
|
|
readonly set: (key: string, info: Info) => Effect.Effect<void, AuthError>
|
|
readonly remove: (key: string) => Effect.Effect<void, AuthError>
|
|
}
|
|
|
|
export class Service extends ServiceMap.Service<Service, Interface>()("@opencode/Auth") {}
|
|
|
|
export const layer = Layer.effect(
|
|
Service,
|
|
Effect.gen(function* () {
|
|
const decode = Schema.decodeUnknownOption(Info)
|
|
|
|
const all = Effect.fn("Auth.all")(() =>
|
|
Effect.tryPromise({
|
|
try: async () => {
|
|
const data = await Filesystem.readJson<Record<string, unknown>>(file).catch(() => ({}))
|
|
return Record.filterMap(data, (value) => Result.fromOption(decode(value), () => undefined))
|
|
},
|
|
catch: fail("Failed to read auth data"),
|
|
}),
|
|
)
|
|
|
|
const get = Effect.fn("Auth.get")(function* (providerID: string) {
|
|
return (yield* all())[providerID]
|
|
})
|
|
|
|
const set = Effect.fn("Auth.set")(function* (key: string, info: Info) {
|
|
const norm = key.replace(/\/+$/, "")
|
|
const data = yield* all()
|
|
if (norm !== key) delete data[key]
|
|
delete data[norm + "/"]
|
|
yield* Effect.tryPromise({
|
|
try: () => Filesystem.writeJson(file, { ...data, [norm]: info }, 0o600),
|
|
catch: fail("Failed to write auth data"),
|
|
})
|
|
})
|
|
|
|
const remove = Effect.fn("Auth.remove")(function* (key: string) {
|
|
const norm = key.replace(/\/+$/, "")
|
|
const data = yield* all()
|
|
delete data[key]
|
|
delete data[norm]
|
|
yield* Effect.tryPromise({
|
|
try: () => Filesystem.writeJson(file, data, 0o600),
|
|
catch: fail("Failed to write auth data"),
|
|
})
|
|
})
|
|
|
|
return Service.of({ get, all, set, remove })
|
|
}),
|
|
)
|
|
|
|
const { runPromise } = makeRuntime(Service, layer)
|
|
|
|
export async function get(providerID: string) {
|
|
return runPromise((service) => service.get(providerID))
|
|
}
|
|
|
|
export async function all(): Promise<Record<string, Info>> {
|
|
return runPromise((service) => service.all())
|
|
}
|
|
|
|
export async function set(key: string, info: Info) {
|
|
return runPromise((service) => service.set(key, info))
|
|
}
|
|
|
|
export async function remove(key: string) {
|
|
await runPromise((service) => service.remove(key))
|
|
// kilocode_change start - Track logout and reset telemetry identity for Kilo
|
|
if (key === "kilo") {
|
|
await Telemetry.updateIdentity(null)
|
|
}
|
|
Telemetry.trackAuthLogout(key)
|
|
// kilocode_change end
|
|
}
|
|
}
|