惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
博客园 - 司徒正美
C
Check Point Blog
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
P
Proofpoint News Feed
IT之家
IT之家
B
Blog
博客园_首页
量子位
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
J
Java Code Geeks
H
Help Net Security
A
About on SuperTechFans
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
D
DataBreaches.Net
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
refactor(oc-path): share JSONL line selection · openclaw/...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -11,6 +11,7 @@ import { isMap, isScalar, isSeq, type Node, type Pair } from "yaml";

1111

import type { MdAst } from "./ast.js";

1212

import type { JsoncValue } from "./jsonc/ast.js";

1313

import type { JsonlAst, JsonlLine } from "./jsonl/ast.js";

14+

import { pickJsonlLine } from "./jsonl/line.js";

1415

import type { OcPath } from "./oc-path.js";

1516

import {

1617

MAX_TRAVERSAL_DEPTH,

@@ -364,7 +365,7 @@ const jsonlOps: WalkOps<JsonlAst> = {

364365

}

365366

},

366367

lookup(ast, key) {

367-

const line = pickLine(ast, key);

368+

const line = pickJsonlLine(ast, key);

368369

if (line === null) {

369370

return null;

370371

}

@@ -440,37 +441,6 @@ function topLevelLeafText(value: JsoncValue, key: string): string | null {

440441

return null;

441442

}

442443
443-

function pickLine(ast: JsonlAst, addr: string): JsonlLine | null {

444-

if (addr === "$first") {

445-

for (const l of ast.lines) {

446-

if (l.kind === "value") {

447-

return l;

448-

}

449-

}

450-

return null;

451-

}

452-

if (addr === "$last") {

453-

for (let i = ast.lines.length - 1; i >= 0; i--) {

454-

const l = ast.lines[i];

455-

if (l !== undefined && l.kind === "value") {

456-

return l;

457-

}

458-

}

459-

return null;

460-

}

461-

const m = /^L(\d+)$/.exec(addr);

462-

if (m === null || m[1] === undefined) {

463-

return null;

464-

}

465-

const target = Number(m[1]);

466-

for (const l of ast.lines) {

467-

if (l.line === target) {

468-

return l;

469-

}

470-

}

471-

return null;

472-

}

473-
474444

// ---------- YAML walker ----------------------------------------------------

475445
476446

function walkYaml(

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,33 @@

1+

import { POS_FIRST, POS_LAST } from "../oc-path.js";

2+

import type { JsonlAst, JsonlLine } from "./ast.js";

3+
4+

export function pickJsonlLine(ast: JsonlAst, addr: string): JsonlLine | null {

5+

if (addr === POS_FIRST) {

6+

for (const line of ast.lines) {

7+

if (line.kind === "value") {

8+

return line;

9+

}

10+

}

11+

return null;

12+

}

13+

if (addr === POS_LAST) {

14+

for (let index = ast.lines.length - 1; index >= 0; index -= 1) {

15+

const line = ast.lines[index];

16+

if (line !== undefined && line.kind === "value") {

17+

return line;

18+

}

19+

}

20+

return null;

21+

}

22+

const match = /^L(\d+)$/.exec(addr);

23+

if (match === null || match[1] === undefined) {

24+

return null;

25+

}

26+

const target = Number(match[1]);

27+

for (const line of ast.lines) {

28+

if (line.line === target) {

29+

return line;

30+

}

31+

}

32+

return null;

33+

}

Original file line numberDiff line numberDiff line change

@@ -18,14 +18,9 @@

1818

import type { JsoncEntry, JsoncValue } from "../jsonc/ast.js";

1919

import { resolveJsoncValueOcPath } from "../jsonc/resolve-value.js";

2020

import type { OcPath } from "../oc-path.js";

21-

import {

22-

POS_FIRST,

23-

POS_LAST,

24-

isQuotedSeg,

25-

splitRespectingBrackets,

26-

unquoteSeg,

27-

} from "../oc-path.js";

21+

import { isQuotedSeg, splitRespectingBrackets, unquoteSeg } from "../oc-path.js";

2822

import type { JsonlAst, JsonlLine } from "./ast.js";

23+

import { pickJsonlLine } from "./line.js";

2924
3025

export type JsonlOcPathMatch =

3126

| { readonly kind: "root"; readonly node: JsonlAst }

@@ -50,7 +45,7 @@ export function resolveJsonlOcPath(ast: JsonlAst, path: OcPath): JsonlOcPathMatc

5045

return { kind: "root", node: ast };

5146

}

5247
53-

const lineEntry = pickLine(ast, head);

48+

const lineEntry = pickJsonlLine(ast, head);

5449

if (lineEntry === null) {

5550

return null;

5651

}

@@ -90,34 +85,3 @@ export function resolveJsonlOcPath(ast: JsonlAst, path: OcPath): JsonlOcPathMatc

9085

}

9186

return { kind: "value", node: match.node, line: lineEntry.line, path: match.path };

9287

}

93-
94-

function pickLine(ast: JsonlAst, addr: string): JsonlLine | null {

95-

if (addr === POS_FIRST) {

96-

for (const l of ast.lines) {

97-

if (l.kind === "value") {

98-

return l;

99-

}

100-

}

101-

return null;

102-

}

103-

if (addr === POS_LAST) {

104-

for (let i = ast.lines.length - 1; i >= 0; i--) {

105-

const l = ast.lines[i];

106-

if (l !== undefined && l.kind === "value") {

107-

return l;

108-

}

109-

}

110-

return null;

111-

}

112-

const m = /^L(\d+)$/.exec(addr);

113-

if (m === null || m[1] === undefined) {

114-

return null;

115-

}

116-

const target = Number(m[1]);

117-

for (const l of ast.lines) {

118-

if (l.line === target) {

119-

return l;

120-

}

121-

}

122-

return null;

123-

}