@mjasnikovs/pi-task 0.18.6 → 0.18.7
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/dist/config/register.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SettingsList, visibleWidth } from '@earendil-works/pi-tui';
|
|
2
2
|
import { registerBridgeCommand } from '../remote/bridge.js';
|
|
3
|
-
import { SEARCH_PROVIDERS,
|
|
3
|
+
import { SEARCH_PROVIDERS, SEARCH_PROVIDER_LABELS, providerForLabel } from '../workers/search-types.js';
|
|
4
4
|
import { getConfig, saveConfig } from './config.js';
|
|
5
5
|
const CONFIG_TITLE = 'pi-task settings';
|
|
6
6
|
/**
|
|
@@ -91,10 +91,19 @@ const ITEMS = [
|
|
|
91
91
|
{
|
|
92
92
|
id: 'searchProvider',
|
|
93
93
|
label: 'search provider',
|
|
94
|
-
description: 'Engine behind web search (pi-worker-search + freshness checks).
|
|
95
|
-
|
|
94
|
+
description: 'Engine behind web search (pi-worker-search + freshness checks). Exa and DuckDuckGo need no API key; Brave needs BRAVE_SEARCH_API_KEY',
|
|
95
|
+
// Display full engine names; the stored config value stays the short id.
|
|
96
|
+
values: SEARCH_PROVIDERS.map(p => SEARCH_PROVIDER_LABELS[p])
|
|
96
97
|
}
|
|
97
98
|
];
|
|
99
|
+
/** What /task-config shows for a setting's current value. */
|
|
100
|
+
function displayValue(cfg, id, isEnum) {
|
|
101
|
+
if (id === 'searchProvider')
|
|
102
|
+
return SEARCH_PROVIDER_LABELS[cfg.searchProvider];
|
|
103
|
+
if (isEnum)
|
|
104
|
+
return String(cfg[id]);
|
|
105
|
+
return cfg[id] ? 'on' : 'off';
|
|
106
|
+
}
|
|
98
107
|
function makeTheme(theme) {
|
|
99
108
|
return {
|
|
100
109
|
label: (text, selected) => (selected ? theme.fg('accent', text) : text),
|
|
@@ -107,9 +116,7 @@ function makeTheme(theme) {
|
|
|
107
116
|
async function handleTaskConfig(_args, ctx) {
|
|
108
117
|
const cfg = { ...getConfig() };
|
|
109
118
|
if (ctx.mode !== 'tui') {
|
|
110
|
-
const lines = ITEMS.map(({ id, label, values }) => `${label.padEnd(22)} ${
|
|
111
|
-
: cfg[id] ? 'on'
|
|
112
|
-
: 'off'}`);
|
|
119
|
+
const lines = ITEMS.map(({ id, label, values }) => `${label.padEnd(22)} ${displayValue(cfg, id, Boolean(values))}`);
|
|
113
120
|
ctx.ui.notify(lines.join(' | '), 'info');
|
|
114
121
|
return;
|
|
115
122
|
}
|
|
@@ -119,15 +126,14 @@ async function handleTaskConfig(_args, ctx) {
|
|
|
119
126
|
id,
|
|
120
127
|
label,
|
|
121
128
|
description,
|
|
122
|
-
currentValue:
|
|
123
|
-
: cfg[id] ? 'on'
|
|
124
|
-
: 'off',
|
|
129
|
+
currentValue: displayValue(cfg, id, Boolean(values)),
|
|
125
130
|
values: values ?? ['on', 'off']
|
|
126
131
|
}));
|
|
127
132
|
const list = new SettingsList(items, 10, listTheme, (id, newValue) => {
|
|
128
133
|
if (id === 'searchProvider') {
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
const provider = providerForLabel(newValue);
|
|
135
|
+
if (provider)
|
|
136
|
+
cfg.searchProvider = provider;
|
|
131
137
|
}
|
|
132
138
|
else {
|
|
133
139
|
;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { getConfig } from '../config/config.js';
|
|
8
8
|
const WIDGET_KEY = 'pi-task-brave-warning';
|
|
9
|
-
const WARNING = '⚠ pi-task: search provider is
|
|
9
|
+
const WARNING = '⚠ pi-task: search provider is Brave but BRAVE_SEARCH_API_KEY is not set — web search '
|
|
10
10
|
+ 'is disabled. Get a free key at https://api.search.brave.com/app/keys or switch '
|
|
11
11
|
+ 'provider in /task-config';
|
|
12
12
|
/** Mirrors the lookup in search-core so the hint matches what the worker reads. */
|
|
@@ -12,4 +12,10 @@ export interface SearchResult {
|
|
|
12
12
|
*/
|
|
13
13
|
export type SearchProvider = 'exa' | 'ddg' | 'brave';
|
|
14
14
|
export declare const SEARCH_PROVIDERS: readonly SearchProvider[];
|
|
15
|
+
/**
|
|
16
|
+
* Human-readable engine names for the config UI. The short ids stay the stored
|
|
17
|
+
* value (config-file compat); only the display layer uses these.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SEARCH_PROVIDER_LABELS: Record<SearchProvider, string>;
|
|
20
|
+
export declare function providerForLabel(label: string): SearchProvider | undefined;
|
|
15
21
|
export declare function isSearchProvider(value: unknown): value is SearchProvider;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
export const SEARCH_PROVIDERS = ['exa', 'ddg', 'brave'];
|
|
2
|
+
/**
|
|
3
|
+
* Human-readable engine names for the config UI. The short ids stay the stored
|
|
4
|
+
* value (config-file compat); only the display layer uses these.
|
|
5
|
+
*/
|
|
6
|
+
export const SEARCH_PROVIDER_LABELS = {
|
|
7
|
+
exa: 'Exa',
|
|
8
|
+
ddg: 'DuckDuckGo',
|
|
9
|
+
brave: 'Brave'
|
|
10
|
+
};
|
|
11
|
+
export function providerForLabel(label) {
|
|
12
|
+
return SEARCH_PROVIDERS.find(p => SEARCH_PROVIDER_LABELS[p] === label);
|
|
13
|
+
}
|
|
2
14
|
export function isSearchProvider(value) {
|
|
3
15
|
return typeof value === 'string' && SEARCH_PROVIDERS.includes(value);
|
|
4
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mjasnikovs/pi-task",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.7",
|
|
4
4
|
"description": "Deterministic task planning and spec-orchestration for local models — crash-safe /task pipelines with verify/enforce gates, a real-time remote web view, and web/docs/fetch/worker subagent tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|