@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
|
@@ -357,19 +357,8 @@ async function showCommandMenuForBtw(
|
|
|
357
357
|
ctx: ExtensionCommandContext,
|
|
358
358
|
resumeThreads: readonly BtwResumeThreadSummary[],
|
|
359
359
|
): Promise<BtwCommandMenuResult> {
|
|
360
|
-
const currentModel = ctx.model;
|
|
361
|
-
const availableModels = ctx.modelRegistry.getAll();
|
|
362
|
-
const currentThinkingLevel = pi.getThinkingLevel();
|
|
363
|
-
const loaded = await readBtwSettings();
|
|
364
|
-
const settings = loaded.kind === "loaded" ? loaded.settings : {};
|
|
365
|
-
const configured = settings.model ? parseBtwModelReference(settings.model) : undefined;
|
|
366
|
-
const configuredModel = configured
|
|
367
|
-
? availableModels.find((model) => model.provider === configured.provider && model.id === configured.modelId)
|
|
368
|
-
: undefined;
|
|
369
|
-
const model = configuredModel ?? currentModel;
|
|
370
360
|
return showBtwCommandMenu(ctx, {
|
|
371
|
-
currentThinkingLevel,
|
|
372
|
-
availableThinkingLevels: model ? getSupportedThinkingLevels(model) : BTW_THINKING_LEVELS,
|
|
361
|
+
currentThinkingLevel: pi.getThinkingLevel(),
|
|
373
362
|
resumeThreads,
|
|
374
363
|
});
|
|
375
364
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Api, getSupportedThinkingLevels, type Model } from "@earendil-works/pi-ai";
|
|
2
|
+
import {
|
|
3
|
+
BorderedLoader,
|
|
4
|
+
type ExtensionCommandContext,
|
|
5
|
+
type KeybindingsManager,
|
|
6
|
+
type Theme,
|
|
7
|
+
} from "@earendil-works/pi-coding-agent";
|
|
2
8
|
import type { Component, TUI } from "@earendil-works/pi-tui";
|
|
3
9
|
import type { MenuContext, RunMenuResult } from "@narumitw/pi-tui-kit";
|
|
4
10
|
import {
|
|
@@ -14,6 +20,7 @@ import {
|
|
|
14
20
|
btwSettingsPath,
|
|
15
21
|
effectiveFullscreenCopyOnSelect,
|
|
16
22
|
effectiveRememberThinkingLevelChanges,
|
|
23
|
+
parseBtwModelReference,
|
|
17
24
|
readBtwSettings,
|
|
18
25
|
type UpdateBtwSettingsOptions,
|
|
19
26
|
updateBtwSettings,
|
|
@@ -35,7 +42,11 @@ export interface BtwResumeThreadSummary {
|
|
|
35
42
|
|
|
36
43
|
export interface ShowBtwCommandMenuOptions {
|
|
37
44
|
currentThinkingLevel: BtwThinkingLevel;
|
|
38
|
-
|
|
45
|
+
/** Deterministic test override; production derives levels from each selected model. */
|
|
46
|
+
availableThinkingLevels?: readonly BtwThinkingLevel[];
|
|
47
|
+
availableModels?: readonly Model<Api>[];
|
|
48
|
+
currentModel?: Model<Api>;
|
|
49
|
+
scopedModels?: ExtensionCommandContext["scopedModels"];
|
|
39
50
|
resumeThreads?: readonly BtwResumeThreadSummary[];
|
|
40
51
|
settingsPath?: string;
|
|
41
52
|
readSettings?: typeof readBtwSettings;
|
|
@@ -44,11 +55,13 @@ export interface ShowBtwCommandMenuOptions {
|
|
|
44
55
|
|
|
45
56
|
export type BtwCommandMenuResult = "start" | "tree" | "closed" | { kind: "resume"; threadId: string };
|
|
46
57
|
|
|
47
|
-
type BtwMenuScreen = "main" | "resume" | "settings" | "invalid" | "shortcut" | "shortcut-input";
|
|
58
|
+
type BtwMenuScreen = "main" | "resume" | "settings" | "model" | "invalid" | "shortcut" | "shortcut-input";
|
|
48
59
|
type BtwMenuAction =
|
|
49
60
|
| "start"
|
|
50
61
|
| "start-tree"
|
|
51
62
|
| "resume"
|
|
63
|
+
| "open-model"
|
|
64
|
+
| "set-model"
|
|
52
65
|
| "set-thinking"
|
|
53
66
|
| "set-remember"
|
|
54
67
|
| "set-fullscreen-copy"
|
|
@@ -70,15 +83,32 @@ export async function showBtwCommandMenu(
|
|
|
70
83
|
options: ShowBtwCommandMenuOptions,
|
|
71
84
|
): Promise<BtwCommandMenuResult> {
|
|
72
85
|
if (ctx.mode !== "tui") return "closed";
|
|
73
|
-
const { defineMenu, runMenu } = await import("@narumitw/pi-tui-kit");
|
|
86
|
+
const { defineMenu, runMenu, sanitizeTerminalText } = await import("@narumitw/pi-tui-kit");
|
|
74
87
|
if (ctx.signal?.aborted) return "closed";
|
|
75
88
|
const settingsPath = options.settingsPath ?? btwSettingsPath();
|
|
76
89
|
const readSettings = options.readSettings ?? readBtwSettings;
|
|
77
90
|
const updateSettings = options.updateSettings ?? updateBtwSettings;
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
const getAvailable = ctx.modelRegistry.getAvailable;
|
|
92
|
+
const allAvailableModels = deduplicateModels(
|
|
93
|
+
options.availableModels ??
|
|
94
|
+
(typeof getAvailable === "function" ? getAvailable.call(ctx.modelRegistry) : ctx.modelRegistry.getAll()),
|
|
95
|
+
);
|
|
96
|
+
const currentModel = options.currentModel ?? ctx.model;
|
|
97
|
+
const scopedModels = options.scopedModels ?? ctx.scopedModels ?? [];
|
|
98
|
+
const selectableModels = availableModelsInScope(allAvailableModels, scopedModels);
|
|
99
|
+
const modelItemIds = new Map(selectableModels.map((model, index) => [model, `btw-settings-model:${index}`]));
|
|
100
|
+
const modelsByItemId = new Map(selectableModels.map((model) => [modelItemIds.get(model) as string, model]));
|
|
101
|
+
const safeModelMetadata = (value: string, fallback: string): string => {
|
|
102
|
+
const safe = sanitizeTerminalText(value).trim() || fallback;
|
|
103
|
+
return [...safe].slice(0, 512).join("");
|
|
104
|
+
};
|
|
105
|
+
const displayModelReference = (model: Pick<Model<Api>, "provider" | "id">): string =>
|
|
106
|
+
`${safeModelMetadata(model.id, "unknown model")} [${safeModelMetadata(model.provider, "unknown provider")}]`;
|
|
107
|
+
const rawModelReference = (model: Pick<Model<Api>, "provider" | "id">): string | undefined => {
|
|
108
|
+
const reference = `${model.provider}/${model.id}`;
|
|
109
|
+
const parsed = parseBtwModelReference(reference);
|
|
110
|
+
return parsed?.provider === model.provider && parsed.modelId === model.id ? reference : undefined;
|
|
111
|
+
};
|
|
82
112
|
const displaySettingsPath = sanitizeSingleLine(settingsPath);
|
|
83
113
|
const resumeThreads = options.resumeThreads ?? [];
|
|
84
114
|
let startSelected = false;
|
|
@@ -139,6 +169,53 @@ export async function showBtwCommandMenu(
|
|
|
139
169
|
}
|
|
140
170
|
};
|
|
141
171
|
|
|
172
|
+
const saveModel = async (
|
|
173
|
+
model: Model<Api> | undefined,
|
|
174
|
+
signal: AbortSignal,
|
|
175
|
+
): Promise<{ kind: "saved" } | { kind: "cancelled" } | { kind: "failed"; error: unknown }> => {
|
|
176
|
+
const modelReference = model ? rawModelReference(model) : undefined;
|
|
177
|
+
if (model && !modelReference) return { kind: "cancelled" };
|
|
178
|
+
const result = await ctx.ui.custom<{ kind: "saved" } | { kind: "cancelled" } | { kind: "failed"; error: unknown }>(
|
|
179
|
+
(tui, theme, _keybindings, done) => {
|
|
180
|
+
const loader = new BorderedLoader(tui, theme, "Saving Pi BTW model...");
|
|
181
|
+
const ownerController = new AbortController();
|
|
182
|
+
const saveSignal = AbortSignal.any([signal, loader.signal, ownerController.signal]);
|
|
183
|
+
let settled = false;
|
|
184
|
+
const finish = (value: { kind: "saved" } | { kind: "cancelled" } | { kind: "failed"; error: unknown }) => {
|
|
185
|
+
if (settled) return;
|
|
186
|
+
settled = true;
|
|
187
|
+
done(value);
|
|
188
|
+
};
|
|
189
|
+
const cancel = () => finish({ kind: "cancelled" });
|
|
190
|
+
loader.onAbort = cancel;
|
|
191
|
+
saveSignal.addEventListener("abort", cancel, { once: true });
|
|
192
|
+
queueMicrotask(() => {
|
|
193
|
+
void (async () => {
|
|
194
|
+
// Let the host mount the loader before a synchronous test double or cached write can settle it.
|
|
195
|
+
await Promise.resolve();
|
|
196
|
+
if (saveSignal.aborted) return;
|
|
197
|
+
try {
|
|
198
|
+
await updateSettings({ model: modelReference }, { settingsPath, signal: saveSignal });
|
|
199
|
+
finish({ kind: "saved" });
|
|
200
|
+
} catch (error) {
|
|
201
|
+
finish(saveSignal.aborted ? { kind: "cancelled" } : { kind: "failed", error });
|
|
202
|
+
}
|
|
203
|
+
})();
|
|
204
|
+
});
|
|
205
|
+
return {
|
|
206
|
+
render: (width: number) => loader.render(width),
|
|
207
|
+
invalidate: () => loader.invalidate(),
|
|
208
|
+
handleInput: (data: string) => loader.handleInput(data),
|
|
209
|
+
dispose() {
|
|
210
|
+
ownerController.abort(new DOMException("Pi BTW model save disposed", "AbortError"));
|
|
211
|
+
loader.dispose();
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
},
|
|
215
|
+
);
|
|
216
|
+
return result ?? { kind: "cancelled" };
|
|
217
|
+
};
|
|
218
|
+
|
|
142
219
|
const loadState = async (): Promise<BtwMenuState> => {
|
|
143
220
|
const loaded = await readSettings(settingsPath);
|
|
144
221
|
if (loaded.kind === "invalid") {
|
|
@@ -146,19 +223,104 @@ export async function showBtwCommandMenu(
|
|
|
146
223
|
}
|
|
147
224
|
return { kind: "valid", settings: loaded.kind === "loaded" ? loaded.settings : {} };
|
|
148
225
|
};
|
|
149
|
-
const
|
|
226
|
+
const configuredModel = (settings: BtwSettings): Model<Api> | undefined => {
|
|
227
|
+
if (!settings.model) return undefined;
|
|
228
|
+
const reference = parseBtwModelReference(settings.model);
|
|
229
|
+
return reference
|
|
230
|
+
? allAvailableModels.find((model) => model.provider === reference.provider && model.id === reference.modelId)
|
|
231
|
+
: undefined;
|
|
232
|
+
};
|
|
233
|
+
const selectableConfiguredModel = (settings: BtwSettings): Model<Api> | undefined => {
|
|
234
|
+
const configured = configuredModel(settings);
|
|
235
|
+
return configured ? selectableModels.find((model) => sameModel(model, configured)) : undefined;
|
|
236
|
+
};
|
|
237
|
+
const thinkingLevels = (settings: BtwSettings): BtwThinkingLevel[] => {
|
|
238
|
+
const overridden = options.availableThinkingLevels;
|
|
239
|
+
const effectiveModel = configuredModel(settings) ?? currentModel;
|
|
240
|
+
const available =
|
|
241
|
+
overridden && overridden.length > 0
|
|
242
|
+
? overridden
|
|
243
|
+
: effectiveModel
|
|
244
|
+
? getSupportedThinkingLevels(effectiveModel)
|
|
245
|
+
: BTW_THINKING_LEVELS;
|
|
246
|
+
return available.length > 0 ? [...available] : ["off"];
|
|
247
|
+
};
|
|
248
|
+
const currentMainThinkingLevel = (settings: BtwSettings): BtwThinkingLevel =>
|
|
249
|
+
clampToAvailableThinkingLevel(options.currentThinkingLevel, thinkingLevels(settings));
|
|
150
250
|
const displayThinkingLevel = (settings: BtwSettings): string =>
|
|
151
251
|
settings.thinkingLevel === undefined
|
|
152
252
|
? SAME_AS_MAIN_THREAD
|
|
153
|
-
: clampToAvailableThinkingLevel(settings.thinkingLevel,
|
|
253
|
+
: clampToAvailableThinkingLevel(settings.thinkingLevel, thinkingLevels(settings));
|
|
154
254
|
const displayThinkingSummary = (settings: BtwSettings): string =>
|
|
155
255
|
settings.thinkingLevel === undefined
|
|
156
|
-
? `${SAME_AS_MAIN_THREAD} (currently ${currentMainThinkingLevel})`
|
|
256
|
+
? `${SAME_AS_MAIN_THREAD} (currently ${currentMainThinkingLevel(settings)})`
|
|
157
257
|
: displayThinkingLevel(settings);
|
|
158
258
|
const displayRememberSummary = (settings: BtwSettings): string => {
|
|
159
259
|
const value = effectiveRememberThinkingLevelChanges(settings) ? "On" : "Off";
|
|
160
260
|
return settings.thinkingLevel === undefined ? `${value} (fixed levels only)` : value;
|
|
161
261
|
};
|
|
262
|
+
const displayModelValue = (settings: BtwSettings): string => {
|
|
263
|
+
if (!settings.model) {
|
|
264
|
+
return currentModel ? `${SAME_AS_MAIN_THREAD} (${displayModelReference(currentModel)})` : SAME_AS_MAIN_THREAD;
|
|
265
|
+
}
|
|
266
|
+
const available = configuredModel(settings);
|
|
267
|
+
if (!available) return `${SAME_AS_MAIN_THREAD} · ${safeModelMetadata(settings.model, "unknown model")} unavailable`;
|
|
268
|
+
const reference = displayModelReference(available);
|
|
269
|
+
return selectableConfiguredModel(settings) ? reference : `${reference} · outside current scope`;
|
|
270
|
+
};
|
|
271
|
+
const modelItems = (settings: BtwSettings) => {
|
|
272
|
+
const configured = configuredModel(settings);
|
|
273
|
+
const selectable = selectableConfiguredModel(settings);
|
|
274
|
+
const retained = settings.model && !selectable;
|
|
275
|
+
return [
|
|
276
|
+
{
|
|
277
|
+
id: "same-as-main",
|
|
278
|
+
label: SAME_AS_MAIN_THREAD,
|
|
279
|
+
description: currentModel
|
|
280
|
+
? `Currently ${displayModelReference(currentModel)}`
|
|
281
|
+
: "Use the main thread model when /btw starts.",
|
|
282
|
+
},
|
|
283
|
+
...selectableModels.map((model) => {
|
|
284
|
+
const reference = displayModelReference(model);
|
|
285
|
+
const name = safeModelMetadata(model.name ?? "", "");
|
|
286
|
+
const validReference = rawModelReference(model);
|
|
287
|
+
return {
|
|
288
|
+
id: modelItemIds.get(model) as string,
|
|
289
|
+
label: reference,
|
|
290
|
+
...(name ? { details: [`Model Name: ${name}`] } : {}),
|
|
291
|
+
searchText: [reference, name].filter(Boolean).join(" "),
|
|
292
|
+
...(!validReference
|
|
293
|
+
? {
|
|
294
|
+
disabled: true,
|
|
295
|
+
disabledReason: "This model identity cannot be stored in pi-btw.json.",
|
|
296
|
+
}
|
|
297
|
+
: {}),
|
|
298
|
+
};
|
|
299
|
+
}),
|
|
300
|
+
...(retained
|
|
301
|
+
? [
|
|
302
|
+
{
|
|
303
|
+
id: "configured-model",
|
|
304
|
+
label: configured
|
|
305
|
+
? displayModelReference(configured)
|
|
306
|
+
: safeModelMetadata(settings.model as string, "unknown model"),
|
|
307
|
+
...(configured
|
|
308
|
+
? { description: "Configured outside the current model scope; retained until changed." }
|
|
309
|
+
: {
|
|
310
|
+
disabled: true,
|
|
311
|
+
disabledReason: "Configured model is unavailable; /btw falls back to the main model.",
|
|
312
|
+
}),
|
|
313
|
+
},
|
|
314
|
+
]
|
|
315
|
+
: []),
|
|
316
|
+
];
|
|
317
|
+
};
|
|
318
|
+
const selectedModelItemId = (settings: BtwSettings): string => {
|
|
319
|
+
const selected = selectableConfiguredModel(settings);
|
|
320
|
+
return selected ? (modelItemIds.get(selected) as string) : settings.model ? "configured-model" : "same-as-main";
|
|
321
|
+
};
|
|
322
|
+
const currentModelItemId = (settings: BtwSettings): string =>
|
|
323
|
+
settings.model && configuredModel(settings) ? selectedModelItemId(settings) : "same-as-main";
|
|
162
324
|
|
|
163
325
|
const menu = defineMenu<BtwMenuState, BtwMenuScreen, BtwMenuAction, MenuContext>({
|
|
164
326
|
start: "main",
|
|
@@ -167,6 +329,7 @@ export async function showBtwCommandMenu(
|
|
|
167
329
|
kind: "actions",
|
|
168
330
|
title: "Pi BTW",
|
|
169
331
|
lines: [
|
|
332
|
+
`Model: ${displayModelValue(state.settings)}`,
|
|
170
333
|
`Thinking: ${displayThinkingSummary(state.settings)} · Remember changes: ${displayRememberSummary(state.settings)}`,
|
|
171
334
|
`Copy on select: ${effectiveFullscreenCopyOnSelect(state.settings) ? "On" : "Off"}`,
|
|
172
335
|
],
|
|
@@ -196,7 +359,7 @@ export async function showBtwCommandMenu(
|
|
|
196
359
|
{
|
|
197
360
|
id: "settings",
|
|
198
361
|
label: "Settings",
|
|
199
|
-
description: "Choose thinking, keybindings, and selection copying",
|
|
362
|
+
description: "Choose model, thinking, keybindings, and selection copying",
|
|
200
363
|
to: state.kind === "invalid" ? "invalid" : "settings",
|
|
201
364
|
},
|
|
202
365
|
],
|
|
@@ -220,12 +383,19 @@ export async function showBtwCommandMenu(
|
|
|
220
383
|
title: "Pi BTW Settings",
|
|
221
384
|
lines: [`User settings · ${displaySettingsPath}`],
|
|
222
385
|
items: [
|
|
386
|
+
{
|
|
387
|
+
id: "model",
|
|
388
|
+
label: "Model",
|
|
389
|
+
description: "Choose the model for future pi-btw side threads without changing the main session.",
|
|
390
|
+
currentValue: displayModelValue(state.settings),
|
|
391
|
+
action: "open-model",
|
|
392
|
+
},
|
|
223
393
|
{
|
|
224
394
|
id: "thinkingLevel",
|
|
225
395
|
label: "Thinking level",
|
|
226
|
-
description: `Set the starting level for future pi-btw side threads. Currently ${currentMainThinkingLevel}.`,
|
|
396
|
+
description: `Set the starting level for future pi-btw side threads. Currently ${currentMainThinkingLevel(state.settings)}.`,
|
|
227
397
|
currentValue: displayThinkingLevel(state.settings),
|
|
228
|
-
values: [SAME_AS_MAIN_THREAD, ...
|
|
398
|
+
values: [SAME_AS_MAIN_THREAD, ...thinkingLevels(state.settings)],
|
|
229
399
|
action: "set-thinking",
|
|
230
400
|
},
|
|
231
401
|
{
|
|
@@ -253,6 +423,23 @@ export async function showBtwCommandMenu(
|
|
|
253
423
|
})),
|
|
254
424
|
],
|
|
255
425
|
}),
|
|
426
|
+
model: ({ state }) => ({
|
|
427
|
+
kind: "choice",
|
|
428
|
+
title: "Pi BTW Model",
|
|
429
|
+
lines: [
|
|
430
|
+
"Same as main thread is the default and fallback when a configured model is unavailable.",
|
|
431
|
+
...(state.settings.model && !selectableConfiguredModel(state.settings)
|
|
432
|
+
? [`Configured: ${displayModelValue(state.settings)}`]
|
|
433
|
+
: []),
|
|
434
|
+
],
|
|
435
|
+
items: modelItems(state.settings),
|
|
436
|
+
action: "set-model",
|
|
437
|
+
currentItemId: currentModelItemId(state.settings),
|
|
438
|
+
initialItemId: selectedModelItemId(state.settings),
|
|
439
|
+
enableSearch: true,
|
|
440
|
+
viewportSize: 10,
|
|
441
|
+
hint: "back",
|
|
442
|
+
}),
|
|
256
443
|
shortcut: ({ state }) => ({
|
|
257
444
|
kind: "actions",
|
|
258
445
|
title: shortcutLabels[shortcut],
|
|
@@ -289,6 +476,26 @@ export async function showBtwCommandMenu(
|
|
|
289
476
|
},
|
|
290
477
|
"save-shortcut": ({ state, value, signal }) => saveShortcut(state, value?.trim() ?? "", signal),
|
|
291
478
|
"reset-shortcut": ({ state, signal }) => saveShortcut(state, undefined, signal),
|
|
479
|
+
"open-model": async () => ({ kind: "to", screen: "model" }),
|
|
480
|
+
"set-model": async ({ state, itemId, signal }) => {
|
|
481
|
+
if (itemId === "configured-model" && configuredModel(state.settings)) {
|
|
482
|
+
return { kind: "back" };
|
|
483
|
+
}
|
|
484
|
+
const model = itemId ? modelsByItemId.get(itemId) : undefined;
|
|
485
|
+
if (itemId !== "same-as-main" && (!model || !rawModelReference(model))) return { kind: "rejected" };
|
|
486
|
+
const result = await saveModel(model, signal);
|
|
487
|
+
if (result.kind === "failed") {
|
|
488
|
+
notifySaveFailure(ctx, result.error);
|
|
489
|
+
return { kind: "rejected" };
|
|
490
|
+
}
|
|
491
|
+
if (result.kind === "cancelled" || signal.aborted) return { kind: "close" };
|
|
492
|
+
notifySafely(
|
|
493
|
+
ctx,
|
|
494
|
+
model ? `Pi BTW model: ${displayModelReference(model)}.` : `Pi BTW model: ${SAME_AS_MAIN_THREAD}.`,
|
|
495
|
+
"info",
|
|
496
|
+
);
|
|
497
|
+
return { kind: "back" };
|
|
498
|
+
},
|
|
292
499
|
start: async () => {
|
|
293
500
|
startSelected = true;
|
|
294
501
|
return { kind: "close" };
|
|
@@ -304,8 +511,9 @@ export async function showBtwCommandMenu(
|
|
|
304
511
|
resumedThreadId = itemId;
|
|
305
512
|
return { kind: "close" } as const;
|
|
306
513
|
},
|
|
307
|
-
"set-thinking": async ({ value, signal }) => {
|
|
514
|
+
"set-thinking": async ({ state, value, signal }) => {
|
|
308
515
|
if (!value) return { kind: "rejected" };
|
|
516
|
+
const levels = thinkingLevels(state.settings);
|
|
309
517
|
const patch =
|
|
310
518
|
value === SAME_AS_MAIN_THREAD
|
|
311
519
|
? ({ thinkingLevel: undefined } satisfies BtwSettingsPatch)
|
|
@@ -429,6 +637,27 @@ export async function runBtwMenuPreservingEditor(
|
|
|
429
637
|
return result;
|
|
430
638
|
}
|
|
431
639
|
|
|
640
|
+
function deduplicateModels(models: readonly Model<Api>[]): Model<Api>[] {
|
|
641
|
+
return models.filter((model, index) => models.findIndex((candidate) => sameModel(candidate, model)) === index);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
function availableModelsInScope(
|
|
645
|
+
availableModels: readonly Model<Api>[],
|
|
646
|
+
scopedModels: ExtensionCommandContext["scopedModels"],
|
|
647
|
+
): Model<Api>[] {
|
|
648
|
+
if (scopedModels.length === 0) return [...availableModels];
|
|
649
|
+
return deduplicateModels(
|
|
650
|
+
scopedModels.flatMap((entry) => {
|
|
651
|
+
const available = availableModels.find((model) => sameModel(model, entry.model));
|
|
652
|
+
return available ? [available] : [];
|
|
653
|
+
}),
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
function sameModel(left: Pick<Model<Api>, "provider" | "id">, right: Pick<Model<Api>, "provider" | "id">): boolean {
|
|
658
|
+
return left.provider === right.provider && left.id === right.id;
|
|
659
|
+
}
|
|
660
|
+
|
|
432
661
|
function clampToAvailableThinkingLevel(
|
|
433
662
|
requested: BtwThinkingLevel,
|
|
434
663
|
available: readonly BtwThinkingLevel[],
|
|
@@ -26,6 +26,7 @@ export type BtwSettingsLoadResult =
|
|
|
26
26
|
|
|
27
27
|
export interface BtwSettingsPatch {
|
|
28
28
|
keybindings?: BtwKeybindingOverrides;
|
|
29
|
+
model?: string;
|
|
29
30
|
thinkingLevel?: BtwThinkingLevel;
|
|
30
31
|
rememberThinkingLevelChanges?: boolean;
|
|
31
32
|
fullscreenCopyOnSelect?: boolean;
|
|
@@ -254,6 +255,10 @@ function applyBtwSettingsPatch(current: SettingsDocument, patch: BtwSettingsPatc
|
|
|
254
255
|
if (Object.keys(keys).length) updated.keybindings = keys;
|
|
255
256
|
else delete updated.keybindings;
|
|
256
257
|
}
|
|
258
|
+
if (Object.hasOwn(patch, "model")) {
|
|
259
|
+
if (patch.model === undefined) delete updated.model;
|
|
260
|
+
else updated.model = patch.model;
|
|
261
|
+
}
|
|
257
262
|
if (Object.hasOwn(patch, "thinkingLevel")) {
|
|
258
263
|
if (patch.thinkingLevel === undefined) delete updated.thinkingLevel;
|
|
259
264
|
else updated.thinkingLevel = patch.thinkingLevel;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.2.3] - 2026-08-11
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Parse and discard `:::class` for flowcharts, state and class diagrams.
|
|
10
|
+
|
|
11
|
+
## [0.2.2] - 2026-08-04
|
|
12
|
+
|
|
13
|
+
### Removed
|
|
14
|
+
|
|
15
|
+
- Removed the `NOTICE` file. Upstream ships none, so Apache-2.0 §4(d) never applied; keeping one only pushed a propagation obligation onto redistributors. Attribution now lives in `README.md` and `LICENSE`.
|
|
16
|
+
|
|
17
|
+
## [0.2.1] - 2026-08-01
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Added npm trusted publishing with build provenance. Releases are now built, signed and published by CI from a matching `v*` tag.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Fixed leading and trailing empty rows around rendered diagrams.
|
|
26
|
+
|
|
27
|
+
## [0.2.0] - 2026-07-28
|
|
28
|
+
|
|
29
|
+
### Breaking Changes
|
|
30
|
+
|
|
31
|
+
- Changed `render()` to return natural-width art with a reported `width`; removed `maxWidth` and automatic source fallback. Callers can use `sourceBox()` when needed.
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- Added `diagramKind()` and advisory parse warnings so callers can distinguish unsupported diagrams from malformed or partially rendered input.
|
|
36
|
+
- Added best-effort recovery for strict grammars by dropping and reporting one unreadable final line.
|
|
37
|
+
|
|
38
|
+
## [0.1.1] - 2026-07-28
|
|
39
|
+
|
|
40
|
+
## [0.1.0] - 2026-07-28
|
|
41
|
+
|
|
42
|
+
Initial public release.
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
|
|
46
|
+
- Added Unicode terminal rendering for flowchart, state, class, ER, and sequence diagrams with semantic styled spans and ANSI themes.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
Copyright 2023-2026 SpaceXAI
|
|
2
|
+
Copyright 2026 Alexey Zaytsev
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Apache License
|
|
6
|
+
Version 2.0, January 2004
|
|
7
|
+
http://www.apache.org/licenses/
|
|
8
|
+
|
|
9
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
10
|
+
|
|
11
|
+
1. Definitions.
|
|
12
|
+
|
|
13
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
14
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
15
|
+
|
|
16
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
17
|
+
the copyright owner that is granting the License.
|
|
18
|
+
|
|
19
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
20
|
+
other entities that control, are controlled by, or are under common
|
|
21
|
+
control with that entity. For the purposes of this definition,
|
|
22
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
23
|
+
direction or management of such entity, whether by contract or
|
|
24
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
25
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
26
|
+
|
|
27
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
28
|
+
exercising permissions granted by this License.
|
|
29
|
+
|
|
30
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
31
|
+
including but not limited to software source code, documentation
|
|
32
|
+
source, and configuration files.
|
|
33
|
+
|
|
34
|
+
"Object" form shall mean any form resulting from mechanical
|
|
35
|
+
transformation or translation of a Source form, including but
|
|
36
|
+
not limited to compiled object code, generated documentation,
|
|
37
|
+
and conversions to other media types.
|
|
38
|
+
|
|
39
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
40
|
+
Object form, made available under the License, as indicated by a
|
|
41
|
+
copyright notice that is included in or attached to the work
|
|
42
|
+
(an example is provided in the Appendix below).
|
|
43
|
+
|
|
44
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
45
|
+
form, that is based on (or derived from) the Work and for which the
|
|
46
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
47
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
48
|
+
of this License, Derivative Works shall not include works that remain
|
|
49
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
50
|
+
the Work and Derivative Works thereof.
|
|
51
|
+
|
|
52
|
+
"Contribution" shall mean any work of authorship, including
|
|
53
|
+
the original version of the Work and any modifications or additions
|
|
54
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
55
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
56
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
57
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
58
|
+
means any form of electronic, verbal, or written communication sent
|
|
59
|
+
to the Licensor or its representatives, including but not limited to
|
|
60
|
+
communication on electronic mailing lists, source code control systems,
|
|
61
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
62
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
63
|
+
excluding communication that is conspicuously marked or otherwise
|
|
64
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
65
|
+
|
|
66
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
67
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
68
|
+
subsequently incorporated within the Work.
|
|
69
|
+
|
|
70
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
74
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
75
|
+
Work and such Derivative Works in Source or Object form.
|
|
76
|
+
|
|
77
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
78
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
79
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
80
|
+
(except as stated in this section) patent license to make, have made,
|
|
81
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
82
|
+
where such license applies only to those patent claims licensable
|
|
83
|
+
by such Contributor that are necessarily infringed by their
|
|
84
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
85
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
86
|
+
institute patent litigation against any entity (including a
|
|
87
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
88
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
89
|
+
or contributory patent infringement, then any patent licenses
|
|
90
|
+
granted to You under this License for that Work shall terminate
|
|
91
|
+
as of the date such litigation is filed.
|
|
92
|
+
|
|
93
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
94
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
95
|
+
modifications, and in Source or Object form, provided that You
|
|
96
|
+
meet the following conditions:
|
|
97
|
+
|
|
98
|
+
(a) You must give any other recipients of the Work or
|
|
99
|
+
Derivative Works a copy of this License; and
|
|
100
|
+
|
|
101
|
+
(b) You must cause any modified files to carry prominent notices
|
|
102
|
+
stating that You changed the files; and
|
|
103
|
+
|
|
104
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
105
|
+
that You distribute, all copyright, patent, trademark, and
|
|
106
|
+
attribution notices from the Source form of the Work,
|
|
107
|
+
excluding those notices that do not pertain to any part of
|
|
108
|
+
the Derivative Works; and
|
|
109
|
+
|
|
110
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
111
|
+
distribution, then any Derivative Works that You distribute must
|
|
112
|
+
include a readable copy of the attribution notices contained
|
|
113
|
+
within such NOTICE file, excluding those notices that do not
|
|
114
|
+
pertain to any part of the Derivative Works, in at least one
|
|
115
|
+
of the following places: within a NOTICE text file distributed
|
|
116
|
+
as part of the Derivative Works; within the Source form or
|
|
117
|
+
documentation, if provided along with the Derivative Works; or,
|
|
118
|
+
within a display generated by the Derivative Works, if and
|
|
119
|
+
wherever such third-party notices normally appear. The contents
|
|
120
|
+
of the NOTICE file are for informational purposes only and
|
|
121
|
+
do not modify the License. You may add Your own attribution
|
|
122
|
+
notices within Derivative Works that You distribute, alongside
|
|
123
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
124
|
+
that such additional attribution notices cannot be construed
|
|
125
|
+
as modifying the License.
|
|
126
|
+
|
|
127
|
+
You may add Your own copyright statement to Your modifications and
|
|
128
|
+
may provide additional or different license terms and conditions
|
|
129
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
130
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
131
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
132
|
+
the conditions stated in this License.
|
|
133
|
+
|
|
134
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
135
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
136
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
137
|
+
this License, without any additional terms or conditions.
|
|
138
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
139
|
+
the terms of any separate license agreement you may have executed
|
|
140
|
+
with Licensor regarding such Contributions.
|
|
141
|
+
|
|
142
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
143
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
144
|
+
except as required for reasonable and customary use in describing the
|
|
145
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
146
|
+
|
|
147
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
148
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
149
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
150
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
151
|
+
implied, including, without limitation, any warranties or conditions
|
|
152
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
153
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
154
|
+
appropriateness of using or redistributing the Work and assume any
|
|
155
|
+
risks associated with Your exercise of permissions under this License.
|
|
156
|
+
|
|
157
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
158
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
159
|
+
unless required by applicable law (such as deliberate and grossly
|
|
160
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
161
|
+
liable to You for damages, including any direct, indirect, special,
|
|
162
|
+
incidental, or consequential damages of any character arising as a
|
|
163
|
+
result of this License or out of the use or inability to use the
|
|
164
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
165
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
166
|
+
other commercial damages or losses), even if such Contributor
|
|
167
|
+
has been advised of the possibility of such damages.
|
|
168
|
+
|
|
169
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
170
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
171
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
172
|
+
or other liability obligations and/or rights consistent with this
|
|
173
|
+
License. However, in accepting such obligations, You may act only
|
|
174
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
175
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
176
|
+
defend, and hold each Contributor harmless for any liability
|
|
177
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
178
|
+
of your accepting any such warranty or additional liability.
|
|
179
|
+
|
|
180
|
+
END OF TERMS AND CONDITIONS
|
|
181
|
+
|
|
182
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
183
|
+
|
|
184
|
+
To apply the Apache License to your work, attach the following
|
|
185
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
186
|
+
replaced with your own identifying information. (Don't include
|
|
187
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
188
|
+
comment syntax for the file format. We also recommend that a
|
|
189
|
+
file or class name and description of purpose be included on the
|
|
190
|
+
same "printed page" as the copyright notice for easier
|
|
191
|
+
identification within third-party archives.
|
|
192
|
+
|
|
193
|
+
Copyright [yyyy] [name of copyright owner]
|
|
194
|
+
|
|
195
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
196
|
+
you may not use this file except in compliance with the License.
|
|
197
|
+
You may obtain a copy of the License at
|
|
198
|
+
|
|
199
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
200
|
+
|
|
201
|
+
Unless required by applicable law or agreed to in writing, software
|
|
202
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
203
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
204
|
+
See the License for the specific language governing permissions and
|
|
205
|
+
limitations under the License.
|