@herbertgao/pi-extensions 2026.9.7 → 2026.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/node_modules/@herbertgao/pi-bark/package.json +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
- package/node_modules/@herbertgao/resume-from/package.json +2 -2
- package/node_modules/@narumitw/pi-btw/README.md +6 -1
- package/node_modules/@narumitw/pi-btw/dist/index.ts +209 -23
- package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
- package/node_modules/@narumitw/pi-btw/package.json +1 -1
- package/node_modules/@narumitw/pi-btw/src/btw.ts +1 -12
- package/node_modules/@narumitw/pi-btw/src/menu.ts +244 -15
- package/node_modules/@narumitw/pi-btw/src/settings.ts +5 -0
- package/node_modules/grok-mermaid/CHANGELOG.md +46 -0
- package/node_modules/grok-mermaid/LICENSE +205 -0
- package/node_modules/grok-mermaid/README.md +191 -0
- package/node_modules/grok-mermaid/dist/ansi.d.ts +16 -0
- package/node_modules/grok-mermaid/dist/ansi.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/ansi.js +23 -0
- package/node_modules/grok-mermaid/dist/ansi.js.map +1 -0
- package/node_modules/grok-mermaid/dist/canvas.d.ts +87 -0
- package/node_modules/grok-mermaid/dist/canvas.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/canvas.js +366 -0
- package/node_modules/grok-mermaid/dist/canvas.js.map +1 -0
- package/node_modules/grok-mermaid/dist/graph.d.ts +74 -0
- package/node_modules/grok-mermaid/dist/graph.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/graph.js +91 -0
- package/node_modules/grok-mermaid/dist/graph.js.map +1 -0
- package/node_modules/grok-mermaid/dist/index.d.ts +32 -0
- package/node_modules/grok-mermaid/dist/index.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/index.js +100 -0
- package/node_modules/grok-mermaid/dist/index.js.map +1 -0
- package/node_modules/grok-mermaid/dist/labels.d.ts +62 -0
- package/node_modules/grok-mermaid/dist/labels.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/labels.js +324 -0
- package/node_modules/grok-mermaid/dist/labels.js.map +1 -0
- package/node_modules/grok-mermaid/dist/layout-seq.d.ts +12 -0
- package/node_modules/grok-mermaid/dist/layout-seq.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/layout-seq.js +194 -0
- package/node_modules/grok-mermaid/dist/layout-seq.js.map +1 -0
- package/node_modules/grok-mermaid/dist/layout.d.ts +87 -0
- package/node_modules/grok-mermaid/dist/layout.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/layout.js +881 -0
- package/node_modules/grok-mermaid/dist/layout.js.map +1 -0
- package/node_modules/grok-mermaid/dist/parse.d.ts +83 -0
- package/node_modules/grok-mermaid/dist/parse.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/parse.js +1151 -0
- package/node_modules/grok-mermaid/dist/parse.js.map +1 -0
- package/node_modules/grok-mermaid/dist/source-box.d.ts +18 -0
- package/node_modules/grok-mermaid/dist/source-box.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/source-box.js +78 -0
- package/node_modules/grok-mermaid/dist/source-box.js.map +1 -0
- package/node_modules/grok-mermaid/dist/types.d.ts +42 -0
- package/node_modules/grok-mermaid/dist/types.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/types.js +1 -0
- package/node_modules/grok-mermaid/dist/types.js.map +1 -0
- package/node_modules/grok-mermaid/dist/width-data.d.ts +2 -0
- package/node_modules/grok-mermaid/dist/width-data.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/width-data.js +994 -0
- package/node_modules/grok-mermaid/dist/width-data.js.map +1 -0
- package/node_modules/grok-mermaid/dist/width.d.ts +18 -0
- package/node_modules/grok-mermaid/dist/width.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/width.js +76 -0
- package/node_modules/grok-mermaid/dist/width.js.map +1 -0
- package/node_modules/grok-mermaid/package.json +49 -0
- package/node_modules/grok-mermaid/src/ansi.ts +34 -0
- package/node_modules/grok-mermaid/src/canvas.ts +373 -0
- package/node_modules/grok-mermaid/src/graph.ts +142 -0
- package/node_modules/grok-mermaid/src/index.ts +104 -0
- package/node_modules/grok-mermaid/src/labels.ts +326 -0
- package/node_modules/grok-mermaid/src/layout-seq.ts +203 -0
- package/node_modules/grok-mermaid/src/layout.ts +1015 -0
- package/node_modules/grok-mermaid/src/parse.ts +1189 -0
- package/node_modules/grok-mermaid/src/source-box.ts +89 -0
- package/node_modules/grok-mermaid/src/types.ts +43 -0
- package/node_modules/grok-mermaid/src/width-data.ts +993 -0
- package/node_modules/grok-mermaid/src/width.ts +74 -0
- package/node_modules/pi-jev-auto-mode/CHANGELOG.md +110 -0
- package/node_modules/pi-jev-auto-mode/LICENSE +21 -0
- package/node_modules/pi-jev-auto-mode/README.md +285 -0
- package/node_modules/pi-jev-auto-mode/SECURITY.md +32 -0
- package/node_modules/pi-jev-auto-mode/docs/calibration.md +154 -0
- package/node_modules/pi-jev-auto-mode/docs/design.md +164 -0
- package/node_modules/pi-jev-auto-mode/docs/security.md +124 -0
- package/node_modules/pi-jev-auto-mode/index.ts +1 -0
- package/node_modules/pi-jev-auto-mode/package.json +72 -0
- package/node_modules/pi-jev-auto-mode/src/call.ts +180 -0
- package/node_modules/pi-jev-auto-mode/src/decide.ts +86 -0
- package/node_modules/pi-jev-auto-mode/src/extension.ts +862 -0
- package/node_modules/pi-jev-auto-mode/src/intent.ts +71 -0
- package/node_modules/pi-jev-auto-mode/src/jev/availability.ts +53 -0
- package/node_modules/pi-jev-auto-mode/src/jev/criteria.ts +19 -0
- package/node_modules/pi-jev-auto-mode/src/jev/decide.ts +187 -0
- package/node_modules/pi-jev-auto-mode/src/jev/engine.ts +165 -0
- package/node_modules/pi-jev-auto-mode/src/jev/index.ts +20 -0
- package/node_modules/pi-jev-auto-mode/src/jev/questions.ts +273 -0
- package/node_modules/pi-jev-auto-mode/src/jev/response.ts +64 -0
- package/node_modules/pi-jev-auto-mode/src/jev/state.ts +20 -0
- package/node_modules/pi-jev-auto-mode/src/jev/transport.ts +117 -0
- package/node_modules/pi-jev-auto-mode/src/jev/types.ts +46 -0
- package/node_modules/pi-jev-auto-mode/src/policy.ts +558 -0
- package/node_modules/pi-jev-auto-mode/src/records.ts +118 -0
- package/node_modules/pi-jev-auto-mode/src/settings.ts +327 -0
- package/node_modules/pi-jev-auto-mode/src/ui.ts +233 -0
- package/node_modules/pi-lens/CHANGELOG.md +45 -0
- package/node_modules/pi-lens/dist/clients/actionable-warnings.js +21 -9
- package/node_modules/pi-lens/dist/clients/cascade-format.js +24 -0
- package/node_modules/pi-lens/dist/clients/extension-log.js +48 -1
- package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +11 -12
- package/node_modules/pi-lens/dist/clients/lsp/cascade-tier.js +3 -0
- package/node_modules/pi-lens/dist/clients/lsp/index.js +41 -7
- package/node_modules/pi-lens/dist/clients/mcp/analyze.js +9 -2
- package/node_modules/pi-lens/dist/clients/path-utils.js +51 -9
- package/node_modules/pi-lens/dist/clients/persistent-reverify.js +271 -0
- package/node_modules/pi-lens/dist/clients/pipeline.js +15 -1
- package/node_modules/pi-lens/dist/clients/runtime-turn.js +124 -7
- package/node_modules/pi-lens/dist/clients/skills-resolver.js +38 -2
- package/node_modules/pi-lens/dist/clients/widget-state.js +152 -6
- package/node_modules/pi-lens/dist/index.js +729 -344
- package/node_modules/pi-lens/dist/tools/lens-diagnostic-mark.js +14 -2
- package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +84 -17
- package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +32 -5
- package/node_modules/pi-lens/package.json +1 -1
- package/node_modules/pi-typesafe/LICENSE +21 -0
- package/node_modules/pi-typesafe/README.md +153 -0
- package/node_modules/pi-typesafe/dist/ask.d.ts +32 -0
- package/node_modules/pi-typesafe/dist/ask.js +25 -0
- package/node_modules/pi-typesafe/dist/auth.d.ts +56 -0
- package/node_modules/pi-typesafe/dist/auth.js +114 -0
- package/node_modules/pi-typesafe/dist/batch.d.ts +74 -0
- package/node_modules/pi-typesafe/dist/batch.js +116 -0
- package/node_modules/pi-typesafe/dist/calibrate.d.ts +106 -0
- package/node_modules/pi-typesafe/dist/calibrate.js +157 -0
- package/node_modules/pi-typesafe/dist/client.d.ts +69 -0
- package/node_modules/pi-typesafe/dist/client.js +188 -0
- package/node_modules/pi-typesafe/dist/credentials.d.ts +46 -0
- package/node_modules/pi-typesafe/dist/credentials.js +112 -0
- package/node_modules/pi-typesafe/dist/errors.d.ts +9 -0
- package/node_modules/pi-typesafe/dist/errors.js +31 -0
- package/node_modules/pi-typesafe/dist/extension.d.ts +3 -0
- package/node_modules/pi-typesafe/dist/extension.js +222 -0
- package/node_modules/pi-typesafe/dist/index.d.ts +18 -0
- package/node_modules/pi-typesafe/dist/index.js +9 -0
- package/node_modules/pi-typesafe/dist/key-prompt.d.ts +3 -0
- package/node_modules/pi-typesafe/dist/key-prompt.js +43 -0
- package/node_modules/pi-typesafe/dist/login.d.ts +27 -0
- package/node_modules/pi-typesafe/dist/login.js +38 -0
- package/node_modules/pi-typesafe/dist/schema.d.ts +43 -0
- package/node_modules/pi-typesafe/dist/schema.js +152 -0
- package/node_modules/pi-typesafe/dist/ui.d.ts +3 -0
- package/node_modules/pi-typesafe/dist/ui.js +3 -0
- package/node_modules/pi-typesafe/dist/usage.d.ts +73 -0
- package/node_modules/pi-typesafe/dist/usage.js +182 -0
- package/node_modules/pi-typesafe/examples/decision-extension.ts +41 -0
- package/node_modules/pi-typesafe/extensions/index.js +2 -0
- package/node_modules/pi-typesafe/package.json +89 -0
- package/package.json +16 -8
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The raw source in a framed box.
|
|
3
|
+
*
|
|
4
|
+
* What to show when `render` returns `null`, or returns art too wide for the
|
|
5
|
+
* space at hand. Both are the caller's call, so this is theirs to invoke — and
|
|
6
|
+
* theirs to caption, since only they know whether some other view of the
|
|
7
|
+
* diagram exists to point the reader at.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { srcLines, stripControls } from './labels.ts'
|
|
11
|
+
import type { MermaidArt, Span } from './types.ts'
|
|
12
|
+
import { measured, stringWidth } from './width.ts'
|
|
13
|
+
|
|
14
|
+
const sat = (a: number, b: number): number => Math.max(0, a - b)
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Frame `src` in a titled box, hard-wrapping its lines to `maxWidth` columns.
|
|
18
|
+
*
|
|
19
|
+
* The result can still exceed `maxWidth`: the body wraps to
|
|
20
|
+
* `max(8, maxWidth - 4)` and the ` mermaid: <kind> ` title is never truncated,
|
|
21
|
+
* so a long first token sets a floor. Check `width` if it matters.
|
|
22
|
+
*/
|
|
23
|
+
export function sourceBox(src: string, maxWidth?: number): MermaidArt {
|
|
24
|
+
src = stripControls(src)
|
|
25
|
+
const header = src.split(/\s+/).filter((w) => w !== '')[0] ?? 'diagram'
|
|
26
|
+
const title = ` mermaid: ${header} `
|
|
27
|
+
const limit = maxWidth === undefined ? undefined : Math.max(8, sat(maxWidth, 4))
|
|
28
|
+
|
|
29
|
+
const body = srcLines(src)
|
|
30
|
+
.map((l) => l.replace(/\s+$/, ''))
|
|
31
|
+
.reduce<{ started: boolean; lines: string[] }>(
|
|
32
|
+
(acc, l) => {
|
|
33
|
+
if (!acc.started && l === '') return acc
|
|
34
|
+
acc.started = true
|
|
35
|
+
acc.lines.push(...chunkLine(l, limit))
|
|
36
|
+
return acc
|
|
37
|
+
},
|
|
38
|
+
{ started: false, lines: [] },
|
|
39
|
+
).lines
|
|
40
|
+
|
|
41
|
+
const contentW = Math.max(stringWidth(title), ...body.map(stringWidth), 0)
|
|
42
|
+
const inner = contentW + 2
|
|
43
|
+
|
|
44
|
+
const plain: string[] = []
|
|
45
|
+
const styled: Span[][] = []
|
|
46
|
+
|
|
47
|
+
const rule = '─'.repeat(sat(inner, stringWidth(title)))
|
|
48
|
+
plain.push(`╭${title}${rule}╮`)
|
|
49
|
+
styled.push([
|
|
50
|
+
{ text: '╭', cls: 'border' },
|
|
51
|
+
{ text: title, cls: 'title' },
|
|
52
|
+
{ text: `${rule}╮`, cls: 'border' },
|
|
53
|
+
])
|
|
54
|
+
|
|
55
|
+
for (const line of body) {
|
|
56
|
+
const pad = ' '.repeat(sat(contentW, stringWidth(line)))
|
|
57
|
+
plain.push(`│ ${line}${pad} │`)
|
|
58
|
+
styled.push([
|
|
59
|
+
{ text: '│ ', cls: 'border' },
|
|
60
|
+
{ text: line, cls: 'text' },
|
|
61
|
+
{ text: `${pad} │`, cls: 'border' },
|
|
62
|
+
])
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const bottom = `╰${'─'.repeat(inner)}╯`
|
|
66
|
+
plain.push(bottom)
|
|
67
|
+
styled.push([{ text: bottom, cls: 'border' }])
|
|
68
|
+
|
|
69
|
+
return { plain, styled, width: inner + 2, warnings: [] }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Hard-break a line at `limit` columns, never splitting a wide glyph. */
|
|
73
|
+
function chunkLine(line: string, limit: number | undefined): string[] {
|
|
74
|
+
if (limit === undefined || stringWidth(line) <= limit) return [line]
|
|
75
|
+
const out: string[] = []
|
|
76
|
+
let cur = ''
|
|
77
|
+
let curW = 0
|
|
78
|
+
for (const [c, cw] of measured(line)) {
|
|
79
|
+
if (curW + cw > limit && cur !== '') {
|
|
80
|
+
out.push(cur)
|
|
81
|
+
cur = ''
|
|
82
|
+
curW = 0
|
|
83
|
+
}
|
|
84
|
+
cur += c
|
|
85
|
+
curW += cw
|
|
86
|
+
}
|
|
87
|
+
if (cur !== '') out.push(cur)
|
|
88
|
+
return out
|
|
89
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic class of a run of cells. The renderer never knows about colour;
|
|
3
|
+
* consumers map these to their own theme (see `toAnsi` for the common case).
|
|
4
|
+
*
|
|
5
|
+
* - `border` box outlines, subgraph frames, compartment rules
|
|
6
|
+
* - `text` node / participant / compartment labels
|
|
7
|
+
* - `edge` connector lines and arrowheads
|
|
8
|
+
* - `edgeLabel` text sitting on an edge
|
|
9
|
+
* - `title` the `mermaid: <kind>` header of a source box
|
|
10
|
+
* - `none` blank filler
|
|
11
|
+
*/
|
|
12
|
+
export type Cls = 'border' | 'text' | 'edge' | 'edgeLabel' | 'title' | 'none'
|
|
13
|
+
|
|
14
|
+
/** A run of adjacent cells sharing one semantic class. */
|
|
15
|
+
export interface Span {
|
|
16
|
+
text: string
|
|
17
|
+
cls: Cls
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A rendered diagram. `plain[i]` and `styled[i]` describe the same row:
|
|
22
|
+
* `plain` is right-trimmed for display width and copy/paste, `styled` keeps
|
|
23
|
+
* the run structure needed to colour it.
|
|
24
|
+
*
|
|
25
|
+
* `width` is the display columns the widest row needs — the number to compare
|
|
26
|
+
* against the space you have. It cannot be recovered from `plain`, whose rows
|
|
27
|
+
* are strings of code points, not columns.
|
|
28
|
+
*
|
|
29
|
+
* `warnings` lists source the flowchart grammar could not read and dropped.
|
|
30
|
+
* Non-empty means the art is real but incomplete — some of what was written is
|
|
31
|
+
* not in it. Only flowcharts warn; the other grammars refuse the whole diagram
|
|
32
|
+
* instead, and `render` returns `null`.
|
|
33
|
+
*
|
|
34
|
+
* They are advisory. Do not gate rendering on them: the art is the best drawing
|
|
35
|
+
* of the source either way, and a diagram being typed or streamed warns at
|
|
36
|
+
* nearly every intermediate state. Show them alongside, or once it settles.
|
|
37
|
+
*/
|
|
38
|
+
export interface MermaidArt {
|
|
39
|
+
plain: string[]
|
|
40
|
+
styled: Span[][]
|
|
41
|
+
width: number
|
|
42
|
+
warnings: string[]
|
|
43
|
+
}
|