mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
docs: document scoped extension sources
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover index plugin behavior.
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { createTestPluginApi } from "openclaw/plugin-sdk/plugin-test-api";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover register plugin behavior.
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const { runtimeRegistry } = vi.hoisted(() => ({
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover claude agent acp completion plugin behavior.
|
||||
import { ClaudeAcpAgent } from "@agentclientprotocol/claude-agent-acp";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover codex auth bridge plugin behavior.
|
||||
import { execFile } from "node:child_process";
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover config plugin behavior.
|
||||
import fs from "node:fs";
|
||||
import { createRequire } from "node:module";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover manifest plugin behavior.
|
||||
import fs from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover process lease plugin behavior.
|
||||
import { mkdtemp, rm } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover process reaper plugin behavior.
|
||||
import path from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { OPENCLAW_ACPX_LEASE_ID_ARG, OPENCLAW_GATEWAY_INSTANCE_ID_ARG } from "./process-lease.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover mcp command line plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
type SplitCommandLine = (
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover mcp proxy plugin behavior.
|
||||
import { spawn } from "node:child_process";
|
||||
import { chmod, mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover runtime plugin behavior.
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// ACPX tests cover service plugin behavior.
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path module implements cli metadata behavior.
|
||||
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { registerOcPathCli } from "./cli-registration.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path module implements cli registration behavior.
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry";
|
||||
|
||||
export function registerOcPathCli(api: OpenClawPluginApi): void {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path plugin entrypoint registers its OpenClaw integration.
|
||||
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { registerOcPathCli } from "./cli-registration.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path module implements edit behavior.
|
||||
import { applyEdits, modify } from "jsonc-parser/lib/esm/main.js";
|
||||
import type { OcPath } from "../oc-path.js";
|
||||
import {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path module implements parse behavior.
|
||||
import { type ParseError, parseTree, printParseErrorCode } from "jsonc-parser/lib/esm/main.js";
|
||||
import type { Diagnostic } from "../ast.js";
|
||||
import type { JsoncAst, JsoncEntry, JsoncValue } from "./ast.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path module implements resolve value behavior.
|
||||
import { isPositionalSeg, parseArrayIndexSegment, resolvePositionalSeg } from "../oc-path.js";
|
||||
import type { JsoncEntry, JsoncValue } from "./ast.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover edit plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { setMdOcPath as setOcPath } from "../edit.js";
|
||||
import { parseOcPath } from "../oc-path.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover emit plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitMd } from "../emit.js";
|
||||
import { parseMd } from "../parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover find plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { findOcPaths } from "../find.js";
|
||||
import { parseJsonc } from "../jsonc/parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover edit plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { setJsoncOcPath } from "../../jsonc/edit.js";
|
||||
import { emitJsonc } from "../../jsonc/emit.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover emit plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitJsonc } from "../../jsonc/emit.js";
|
||||
import { parseJsonc } from "../../jsonc/parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover parse plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { MAX_JSONC_INPUT_BYTES, parseJsonc } from "../../jsonc/parse.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover resolve plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseJsonc } from "../../jsonc/parse.js";
|
||||
import { resolveJsoncOcPath } from "../../jsonc/resolve.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover edit plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { appendJsonlOcPath, setJsonlOcPath } from "../../jsonl/edit.js";
|
||||
import { emitJsonl } from "../../jsonl/emit.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover emit plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitJsonl } from "../../jsonl/emit.js";
|
||||
import { parseJsonl } from "../../jsonl/parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover parse plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseJsonl } from "../../jsonl/parse.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover resolve plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { findOcPaths } from "../../find.js";
|
||||
import { parseJsonl } from "../../jsonl/parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover oc path plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { OcPathError, formatOcPath, isValidOcPath, parseOcPath } from "../oc-path.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover parse plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseMd } from "../parse.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover resolve plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseMd } from "../parse.js";
|
||||
import { resolveMdOcPath as resolveOcPath } from "../resolve.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover append multi agent plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { JsoncValue } from "../../jsonc/ast.js";
|
||||
import { appendJsonlOcPath } from "../../jsonl/edit.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover byte fidelity plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitMd } from "../../emit.js";
|
||||
import { parseMd } from "../../parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover cross cutting plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitMd } from "../../emit.js";
|
||||
import { formatOcPath, parseOcPath } from "../../oc-path.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover cross kind properties plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { inferKind } from "../../dispatch.js";
|
||||
import { setMdOcPath } from "../../edit.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover edit emit roundtrip plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { setMdOcPath } from "../../edit.js";
|
||||
import { emitMd } from "../../emit.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover frontmatter edges plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseMd } from "../../parse.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover h2 block split plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseMd } from "../../parse.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover items plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseMd } from "../../parse.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover jsonc byte fidelity plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { JsoncValue } from "../../jsonc/ast.js";
|
||||
import { emitJsonc } from "../../jsonc/emit.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover jsonc resolver edges plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseJsonc } from "../../jsonc/parse.js";
|
||||
import { resolveJsoncOcPath } from "../../jsonc/resolve.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover jsonl byte fidelity plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitJsonl } from "../../jsonl/emit.js";
|
||||
import { parseJsonl } from "../../jsonl/parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover jsonl resolver edges plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { JsoncValue } from "../../jsonc/ast.js";
|
||||
import { parseJsonl } from "../../jsonl/parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover malformed input plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseMd } from "../../parse.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover oc path parse edges plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
OcPathError,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover oc path resolver edges plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseMd } from "../../parse.js";
|
||||
import { resolveMdOcPath as resolveOcPath } from "../../resolve.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover perf determinism plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitMd } from "../../emit.js";
|
||||
import { parseMd } from "../../parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover real world fixtures plugin behavior.
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover roundtrip property plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitMd } from "../../emit.js";
|
||||
import { parseMd } from "../../parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover security and limits plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
MAX_PATH_LENGTH,
|
||||
@@ -12,7 +13,6 @@ import {
|
||||
import { parseJsonc } from "../../jsonc/parse.js";
|
||||
import { parseJsonl } from "../../jsonl/parse.js";
|
||||
|
||||
|
||||
describe("encoding edges", () => {
|
||||
it("strips leading UTF-8 BOM from path string", () => {
|
||||
expect(parseOcPath("oc://X/Y").file).toBe("X");
|
||||
@@ -37,7 +37,6 @@ describe("encoding edges", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("file-slot containment", () => {
|
||||
it("rejects absolute POSIX file slot", () => {
|
||||
expect(() => parseOcPath("oc:///etc/passwd")).toThrow(/Empty segment/);
|
||||
@@ -73,7 +72,6 @@ describe("file-slot containment", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("path-string and traversal caps", () => {
|
||||
it("parseOcPath rejects strings longer than MAX_PATH_LENGTH", () => {
|
||||
expect(() => parseOcPath("oc://X/" + "a".repeat(MAX_PATH_LENGTH))).toThrow(/exceeds .* bytes/);
|
||||
@@ -123,7 +121,6 @@ describe("path-string and traversal caps", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("sentinel literal at format boundary", () => {
|
||||
it("formatOcPath rejects a struct carrying the redaction sentinel", () => {
|
||||
expect(() => formatOcPath({ file: "AGENTS.md", section: "__OPENCLAW_REDACTED__" })).toThrow(
|
||||
@@ -132,7 +129,6 @@ describe("sentinel literal at format boundary", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("numeric segments dispatch by node kind", () => {
|
||||
it("negative numeric key on object resolves as literal key (openclaw#59934)", () => {
|
||||
// Telegram supergroup IDs are negative numbers used as map keys.
|
||||
@@ -153,7 +149,6 @@ describe("numeric segments dispatch by node kind", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("setOcPath value coercion is locale-independent and exact-match", () => {
|
||||
it("number coercion accepts `1.5`, refuses `1,5`", () => {
|
||||
const ast = parseJsonc('{"x":1.0}').ast;
|
||||
@@ -174,7 +169,6 @@ describe("setOcPath value coercion is locale-independent and exact-match", () =>
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("predicate-value injection is contained", () => {
|
||||
it("regex metacharacters in predicate value match literally, not as regex", () => {
|
||||
const ast = parseJsonc('{"items":[{"name":"a.*"},{"name":"abc"}]}').ast;
|
||||
@@ -213,7 +207,6 @@ describe("predicate-value injection is contained", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("structural rejection", () => {
|
||||
it("rejects mismatched brackets and braces", () => {
|
||||
expect(() => parseOcPath("oc://X/[unclosed")).toThrow(OcPathError);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover sentinel cross kind plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitMd } from "../../emit.js";
|
||||
import { setJsoncOcPath } from "../../jsonc/edit.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover sentinel guard plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitMd } from "../../emit.js";
|
||||
import { parseMd } from "../../parse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover sentinel plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { OcEmitSentinelError, REDACTED_SENTINEL, guardSentinel } from "../sentinel.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover slug plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { slugify } from "../slug.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover universal plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emitMd } from "../emit.js";
|
||||
import { emitJsonc } from "../jsonc/emit.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path tests cover yaml kind plugin behavior.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { inferKind } from "../../dispatch.js";
|
||||
import { parseOcPath } from "../../oc-path.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path module implements ast behavior.
|
||||
import type { Document, LineCounter } from "yaml";
|
||||
|
||||
export interface YamlAst {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path module implements edit behavior.
|
||||
import {
|
||||
Document,
|
||||
isMap,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path module implements emit behavior.
|
||||
import { OcEmitSentinelError, REDACTED_SENTINEL } from "../sentinel.js";
|
||||
import type { YamlAst } from "./ast.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path module implements parse behavior.
|
||||
import { LineCounter, parseDocument } from "yaml";
|
||||
import type { Diagnostic } from "../ast.js";
|
||||
import type { YamlAst } from "./ast.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// OC Path module implements resolve behavior.
|
||||
import { isMap, isScalar, isSeq, type Node, type Pair } from "yaml";
|
||||
import type { OcPath } from "../oc-path.js";
|
||||
import {
|
||||
|
||||
Reference in New Issue
Block a user