diff --git a/extensions/oc-path/src/oc-path/oc-path.ts b/extensions/oc-path/src/oc-path/oc-path.ts index 0c19b62946b4..00544458eac7 100644 --- a/extensions/oc-path/src/oc-path/oc-path.ts +++ b/extensions/oc-path/src/oc-path/oc-path.ts @@ -397,7 +397,7 @@ export function resolvePositionalSeg(seg: string, container: PositionalContainer /** * Wildcard tokens permitted in `findOcPaths` patterns. * `*` matches one sub-segment; `**` matches zero or more (recursive). - * Reject in resolve/set via `hasWildcard`. + * Reject in resolve/set via `isPattern`. */ export const WILDCARD_SINGLE = "*"; export const WILDCARD_RECURSIVE = "**"; @@ -407,7 +407,7 @@ export const WILDCARD_RECURSIVE = "**"; * union `{a,b,c}`, or predicate `[k=v]`). Single-match verbs reject * these; only `findOcPaths` consumes them. */ -function isPattern(path: OcPath): boolean { +export function isPattern(path: OcPath): boolean { for (const slot of [path.section, path.item, path.field]) { if (slot === undefined) { continue; @@ -429,9 +429,6 @@ function isPattern(path: OcPath): boolean { return false; } -/** @deprecated v1 — use {@link isPattern}. Behaviorally identical. */ -export const hasWildcard = isPattern; - /** Union segment `{a,b,c}` matches each comma-separated alternative. */ export function isUnionSeg(seg: string): boolean { return seg.length >= 2 && seg.startsWith("{") && seg.endsWith("}"); diff --git a/extensions/oc-path/src/oc-path/tests/find.test.ts b/extensions/oc-path/src/oc-path/tests/find.test.ts index 76828facebc6..6948915093e4 100644 --- a/extensions/oc-path/src/oc-path/tests/find.test.ts +++ b/extensions/oc-path/src/oc-path/tests/find.test.ts @@ -4,7 +4,7 @@ import { describe, expect, it } from "vitest"; import { findOcPaths } from "../find.js"; import { parseJsonc } from "../jsonc/parse.js"; import { parseJsonl } from "../jsonl/parse.js"; -import { formatOcPath, hasWildcard, OcPathError, parseOcPath } from "../oc-path.js"; +import { formatOcPath, isPattern, OcPathError, parseOcPath } from "../oc-path.js"; import { parseMd } from "../parse.js"; import { resolveOcPath, setOcPath } from "../universal.js"; @@ -12,31 +12,31 @@ function requireFirstResult(results: readonly T[]): T { return expectDefined(results[0], "first OC path match"); } -describe("hasWildcard", () => { +describe("isPattern", () => { it("detects single-segment * in any slot", () => { - expect(hasWildcard(parseOcPath("oc://X/*/y"))).toBe(true); - expect(hasWildcard(parseOcPath("oc://X/a/*"))).toBe(true); - expect(hasWildcard(parseOcPath("oc://X/a/b/*"))).toBe(true); + expect(isPattern(parseOcPath("oc://X/*/y"))).toBe(true); + expect(isPattern(parseOcPath("oc://X/a/*"))).toBe(true); + expect(isPattern(parseOcPath("oc://X/a/b/*"))).toBe(true); }); it("detects ** in any slot", () => { - expect(hasWildcard(parseOcPath("oc://X/**"))).toBe(true); - expect(hasWildcard(parseOcPath("oc://X/a/**/c"))).toBe(true); + expect(isPattern(parseOcPath("oc://X/**"))).toBe(true); + expect(isPattern(parseOcPath("oc://X/a/**/c"))).toBe(true); }); it("detects wildcards inside dotted sub-segments", () => { - expect(hasWildcard(parseOcPath("oc://X/a.*.c"))).toBe(true); - expect(hasWildcard(parseOcPath("oc://X/a.**.c"))).toBe(true); + expect(isPattern(parseOcPath("oc://X/a.*.c"))).toBe(true); + expect(isPattern(parseOcPath("oc://X/a.**.c"))).toBe(true); }); it("returns false for plain paths", () => { - expect(hasWildcard(parseOcPath("oc://X/a/b/c"))).toBe(false); - expect(hasWildcard(parseOcPath("oc://X/a.b.c"))).toBe(false); + expect(isPattern(parseOcPath("oc://X/a/b/c"))).toBe(false); + expect(isPattern(parseOcPath("oc://X/a.b.c"))).toBe(false); }); it("treats `*` inside an identifier as literal", () => { - expect(hasWildcard(parseOcPath("oc://X/foo*bar"))).toBe(false); - expect(hasWildcard(parseOcPath("oc://X/a*"))).toBe(false); + expect(isPattern(parseOcPath("oc://X/foo*bar"))).toBe(false); + expect(isPattern(parseOcPath("oc://X/a*"))).toBe(false); }); }); @@ -253,9 +253,9 @@ describe("positional primitives — $first / $last", () => { expect(m?.kind === "leaf" && m.valueText).toBe("end"); }); - it("hasWildcard returns false for positional tokens", () => { - expect(hasWildcard(parseOcPath("oc://X/$first/id"))).toBe(false); - expect(hasWildcard(parseOcPath("oc://X/$last/id"))).toBe(false); + it("isPattern returns false for positional tokens", () => { + expect(isPattern(parseOcPath("oc://X/$first/id"))).toBe(false); + expect(isPattern(parseOcPath("oc://X/$last/id"))).toBe(false); }); }); diff --git a/extensions/oc-path/src/oc-path/tests/scenarios/oc-path-parse-edges.test.ts b/extensions/oc-path/src/oc-path/tests/scenarios/oc-path-parse-edges.test.ts index 869d0d54d387..1d3d8d2314d1 100644 --- a/extensions/oc-path/src/oc-path/tests/scenarios/oc-path-parse-edges.test.ts +++ b/extensions/oc-path/src/oc-path/tests/scenarios/oc-path-parse-edges.test.ts @@ -1,6 +1,6 @@ // OC Path tests cover oc path parse edges plugin behavior. import { describe, expect, it } from "vitest"; -import { OcPathError, formatOcPath, hasWildcard, parseOcPath } from "../../oc-path.js"; +import { OcPathError, formatOcPath, isPattern, parseOcPath } from "../../oc-path.js"; function expectErr(fn: () => unknown, code: string): void { try { @@ -176,8 +176,8 @@ describe("oc-path-parse-edges", () => { it("wildcard detection is quote-aware (literal `*` inside quoted segment)", () => { const concrete = parseOcPath('oc://config.jsonc/"items.*.glob"'); - expect(hasWildcard(concrete)).toBe(false); + expect(isPattern(concrete)).toBe(false); const wildcard = parseOcPath("oc://config.jsonc/items/*"); - expect(hasWildcard(wildcard)).toBe(true); + expect(isPattern(wildcard)).toBe(true); }); }); diff --git a/extensions/oc-path/src/oc-path/universal.ts b/extensions/oc-path/src/oc-path/universal.ts index a6d033cb8ddf..c54053d510a6 100644 --- a/extensions/oc-path/src/oc-path/universal.ts +++ b/extensions/oc-path/src/oc-path/universal.ts @@ -27,7 +27,7 @@ import { appendJsonlOcPath as appendJsonlLine, setJsonlOcPath } from "./jsonl/ed import { emitJsonl } from "./jsonl/emit.js"; import { resolveJsonlOcPath } from "./jsonl/resolve.js"; import type { OcPath } from "./oc-path.js"; -import { formatOcPath, hasWildcard, OcPathError, parseArrayIndexSegment } from "./oc-path.js"; +import { formatOcPath, isPattern, OcPathError, parseArrayIndexSegment } from "./oc-path.js"; import { resolveMdOcPath } from "./resolve.js"; import type { YamlAst } from "./yaml/ast.js"; import { insertYamlOcPath, setYamlOcPath } from "./yaml/edit.js"; @@ -146,7 +146,7 @@ function detectInsertion(path: OcPath): InsertionInfo | null { export function resolveOcPath(ast: OcAst, path: OcPath): OcMatch | null { // Single-match verb: wildcards belong to findOcPaths. Throw with a // structured code so consumers can route to the right verb. - if (hasWildcard(path)) { + if (isPattern(path)) { throw new OcPathError( `resolveOcPath received a wildcard pattern; use findOcPaths instead: ${formatOcPath(path)}`, formatOcPath(path), @@ -426,7 +426,7 @@ export function setOcPath( value: string, options: SetOcPathOptions = {}, ): SetResult { - if (hasWildcard(path)) { + if (isPattern(path)) { return { ok: false, reason: "wildcard-not-allowed", diff --git a/extensions/openai/api.ts b/extensions/openai/api.ts index b3dd4093cc04..729f97280acb 100644 --- a/extensions/openai/api.ts +++ b/extensions/openai/api.ts @@ -11,7 +11,6 @@ export { OPENAI_DEFAULT_TTS_VOICE, } from "./default-models.js"; export { openaiMediaUnderstandingProvider } from "./media-understanding-provider.js"; -export { buildOpenAICodexProvider } from "./openai-chatgpt-catalog.js"; export { loginOpenAICodexOAuth } from "./openai-chatgpt-oauth.runtime.js"; export { refreshOpenAICodexToken } from "./openai-chatgpt-provider.runtime.js"; export { buildOpenAIProvider } from "./openai-provider.js"; diff --git a/extensions/openai/openai-chatgpt-catalog.ts b/extensions/openai/openai-chatgpt-catalog.ts deleted file mode 100644 index c95d00093f5c..000000000000 --- a/extensions/openai/openai-chatgpt-catalog.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Openai plugin module implements openai chatgpt catalog behavior. -import type { ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-shared"; -import { OPENAI_CODEX_RESPONSES_BASE_URL } from "./base-url.js"; - -const OPENAI_CODEX_BASE_URL = OPENAI_CODEX_RESPONSES_BASE_URL; - -export function buildOpenAICodexProvider(): ModelProviderConfig { - return { - baseUrl: OPENAI_CODEX_BASE_URL, - api: "openai-chatgpt-responses", - models: [], - }; -} diff --git a/src/plugin-sdk/test-helpers/public-artifacts.ts b/src/plugin-sdk/test-helpers/public-artifacts.ts index 6bc458097926..42cfa0556288 100644 --- a/src/plugin-sdk/test-helpers/public-artifacts.ts +++ b/src/plugin-sdk/test-helpers/public-artifacts.ts @@ -22,7 +22,6 @@ const EXTRA_GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES = assertUniqueValues( "index.js", "login-qr-api.js", "onboard.js", - "openai-chatgpt-catalog.js", "provider-catalog.js", "session-key-api.js", "setup-api.js", diff --git a/src/plugins/contracts/plugin-sdk-subpaths.test.ts b/src/plugins/contracts/plugin-sdk-subpaths.test.ts index bfcb4d06f6e4..800a02ffaa3c 100644 --- a/src/plugins/contracts/plugin-sdk-subpaths.test.ts +++ b/src/plugins/contracts/plugin-sdk-subpaths.test.ts @@ -1272,7 +1272,7 @@ describe("plugin-sdk subpath exports", () => { }); expectSourceContract("provider-catalog-shared", { mentions: ["buildSingleProviderApiKeyCatalog", "buildPairedProviderApiKeyCatalog"], - omits: ["buildDeepSeekProvider", "buildOpenAICodexProvider", "buildVeniceProvider"], + omits: ["buildDeepSeekProvider", "buildVeniceProvider"], }); expectSourceMentions("setup", [