@namzu/cli 26.0.1 → 26.2.0
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/CHANGELOG.md +126 -0
- package/README.md +5 -1
- package/dist/tui/Picker.d.ts.map +1 -1
- package/dist/tui/Picker.js +171 -46
- package/dist/tui/Picker.js.map +1 -1
- package/dist/tui/agent.d.ts +13 -1
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +25 -0
- package/dist/tui/agent.js.map +1 -1
- package/dist/tui/model-catalogue-view.d.ts.map +1 -1
- package/dist/tui/model-catalogue-view.js +25 -0
- package/dist/tui/model-catalogue-view.js.map +1 -1
- package/dist/tui/model-choices.d.ts.map +1 -1
- package/dist/tui/model-choices.js +22 -0
- package/dist/tui/model-choices.js.map +1 -1
- package/dist/tui/model-search.d.ts +18 -1
- package/dist/tui/model-search.d.ts.map +1 -1
- package/dist/tui/model-search.js +19 -2
- package/dist/tui/model-search.js.map +1 -1
- package/dist/tui/provider-list.d.ts +106 -0
- package/dist/tui/provider-list.d.ts.map +1 -0
- package/dist/tui/provider-list.js +125 -0
- package/dist/tui/provider-list.js.map +1 -0
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-choices.js","sourceRoot":"","sources":["../../src/tui/model-choices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAwBH;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CACxB,YAAoB,EACpB,eAA6B,EAC7B,oBAA6B,EAC7B,UAA6D,EAAE;IAE/D,yEAAyE;IACzE,uEAAuE;IACvE,MAAM,YAAY,GACjB,oBAAoB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,oBAAoB,CAAC,KAAK,KAAK;QAC3E,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,oBAAoB,CAAA;IACxB,MAAM,OAAO,GACZ,eAAe,CAAC,IAAI,KAAK,IAAI,IAA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,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,IAAI,YAAY,CAAA;IAC3C,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAA;IAErD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACnE,CAAC"}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import type { ModelChoice } from './model-choices.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Match every word against IDs, names and notes, retaining catalogue order and
|
|
4
|
+
* identity.
|
|
5
|
+
*
|
|
6
|
+
* The note is searched because it is where the facts a person is looking for
|
|
7
|
+
* are written. `(free)` is one of them, and it is the only place some rows say
|
|
8
|
+
* it: OpenRouter's zero-priced `google/lyria-3-pro-preview` carries the word
|
|
9
|
+
* neither in its ID nor in its display name, so a search over those two fields
|
|
10
|
+
* alone cannot find a free model that the screen is showing as free. Matching
|
|
11
|
+
* what the screen shows is also the only rule an operator can predict by
|
|
12
|
+
* looking at it, which is worth more than any word list this could invent.
|
|
13
|
+
*
|
|
14
|
+
* Nothing else moves. Every word must still appear, matching stays a
|
|
15
|
+
* case-insensitive substring test after NFKC, an empty query still returns the
|
|
16
|
+
* array it was given, and a match still returns the caller's own objects in
|
|
17
|
+
* the order the catalogue produced them — callers hold a cursor against this
|
|
18
|
+
* list and use the identity to keep a selection.
|
|
19
|
+
*/
|
|
3
20
|
export declare function filterModelChoices(choices: readonly ModelChoice[], query: string): readonly ModelChoice[];
|
|
4
21
|
//# sourceMappingURL=model-search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-search.d.ts","sourceRoot":"","sources":["../../src/tui/model-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD
|
|
1
|
+
{"version":3,"file":"model-search.d.ts","sourceRoot":"","sources":["../../src/tui/model-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,KAAK,EAAE,MAAM,GACX,SAAS,WAAW,EAAE,CAOxB"}
|
package/dist/tui/model-search.js
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Match every word against IDs, names and notes, retaining catalogue order and
|
|
3
|
+
* identity.
|
|
4
|
+
*
|
|
5
|
+
* The note is searched because it is where the facts a person is looking for
|
|
6
|
+
* are written. `(free)` is one of them, and it is the only place some rows say
|
|
7
|
+
* it: OpenRouter's zero-priced `google/lyria-3-pro-preview` carries the word
|
|
8
|
+
* neither in its ID nor in its display name, so a search over those two fields
|
|
9
|
+
* alone cannot find a free model that the screen is showing as free. Matching
|
|
10
|
+
* what the screen shows is also the only rule an operator can predict by
|
|
11
|
+
* looking at it, which is worth more than any word list this could invent.
|
|
12
|
+
*
|
|
13
|
+
* Nothing else moves. Every word must still appear, matching stays a
|
|
14
|
+
* case-insensitive substring test after NFKC, an empty query still returns the
|
|
15
|
+
* array it was given, and a match still returns the caller's own objects in
|
|
16
|
+
* the order the catalogue produced them — callers hold a cursor against this
|
|
17
|
+
* list and use the identity to keep a selection.
|
|
18
|
+
*/
|
|
2
19
|
export function filterModelChoices(choices, query) {
|
|
3
20
|
const words = query.normalize('NFKC').toLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
4
21
|
if (words.length === 0)
|
|
5
22
|
return choices;
|
|
6
23
|
return choices.filter((choice) => {
|
|
7
|
-
const text = `${choice.id} ${choice.label}`.normalize('NFKC').toLowerCase();
|
|
24
|
+
const text = `${choice.id} ${choice.label} ${choice.note ?? ''}`.normalize('NFKC').toLowerCase();
|
|
8
25
|
return words.every((word) => text.includes(word));
|
|
9
26
|
});
|
|
10
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-search.js","sourceRoot":"","sources":["../../src/tui/model-search.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"model-search.js","sourceRoot":"","sources":["../../src/tui/model-search.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kBAAkB,CACjC,OAA+B,EAC/B,KAAa;IAEb,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACvF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAA;IACtC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;QAChC,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAA;QAChG,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rows the provider picker lists: what this machine already has, then what
|
|
3
|
+
* it could have if the operator supplied a credential.
|
|
4
|
+
*
|
|
5
|
+
* The second half is the point. The picker used to list only what discovery
|
|
6
|
+
* found, so the one provider an operator had SAVED and held a key for — but had
|
|
7
|
+
* not yet exported as an environment variable — appeared nowhere on a screen
|
|
8
|
+
* that exists to choose a provider. There was no row to select and therefore no
|
|
9
|
+
* way to type its key: a list that showed four providers had no fifth row for
|
|
10
|
+
* the fifth one, and the screen's other exit (a sign-in) is a different kind of
|
|
11
|
+
* credential entirely.
|
|
12
|
+
*
|
|
13
|
+
* ## What is added, and what is deliberately not
|
|
14
|
+
*
|
|
15
|
+
* A provider joins the list only when **this build can construct it** and it
|
|
16
|
+
* **takes a credential the operator can type** — the registry's
|
|
17
|
+
* `constructible` and `acceptsTypedCredential` flags, read together and read
|
|
18
|
+
* from the registry rather than listed here. Entering a key for anything else
|
|
19
|
+
* produces a row that leads nowhere, which is worse than an absent row:
|
|
20
|
+
*
|
|
21
|
+
* - `bedrock` needs an AWS credential CHAIN (an access key, a secret, a
|
|
22
|
+
* region, a session token, or a role the SDK assumes) rather than one
|
|
23
|
+
* string. A single API-key field cannot express it, so the picker does not
|
|
24
|
+
* offer it.
|
|
25
|
+
* - `http` is a generic endpoint whose base URL is half the
|
|
26
|
+
* credential. A key with nowhere to send it is not a setup.
|
|
27
|
+
* - `lmstudio` cannot be constructed by this build at all.
|
|
28
|
+
* - `ollama` needs a local server, not a secret.
|
|
29
|
+
* - `codex` needs a device-code sign-in, which this screen already offers
|
|
30
|
+
* with `l` and names on the sign-in screen. It is skipped here so that one
|
|
31
|
+
* provider is not offered two different ways to be set up.
|
|
32
|
+
*
|
|
33
|
+
* `provider-list.test.ts` asserts that exclusion list by NAME, so a registry
|
|
34
|
+
* flag that flips turns the test red instead of silently adding or dropping a
|
|
35
|
+
* row.
|
|
36
|
+
*/
|
|
37
|
+
import { type DetectedProvider, type ProviderId, type ProviderRegistryEntry } from '../integrations/providers/index.js';
|
|
38
|
+
/**
|
|
39
|
+
* One row of the picker.
|
|
40
|
+
*
|
|
41
|
+
* The two arms are rendered differently and behave differently on Enter, which
|
|
42
|
+
* is why this is a union rather than a `DetectedProvider` with an optional key:
|
|
43
|
+
* the second arm has no `source`, no `apiKey` and no alternatives, and a type
|
|
44
|
+
* that pretended otherwise would let a caller ask a provider with no credential
|
|
45
|
+
* what models it has.
|
|
46
|
+
*/
|
|
47
|
+
export type ProviderListRow = {
|
|
48
|
+
readonly kind: 'detected';
|
|
49
|
+
readonly detected: DetectedProvider;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: 'unconfigured';
|
|
52
|
+
readonly entry: ProviderRegistryEntry;
|
|
53
|
+
};
|
|
54
|
+
/** The provider a row is about, whichever kind of row it is. */
|
|
55
|
+
export declare function rowProviderId(row: ProviderListRow): ProviderId;
|
|
56
|
+
/**
|
|
57
|
+
* Providers this screen can set up by taking a credential from the operator.
|
|
58
|
+
*
|
|
59
|
+
* Derived from the registry, in registry order. Four of the twelve entries have
|
|
60
|
+
* a driver in this repository and are not listed here, for the reasons in the
|
|
61
|
+
* module comment.
|
|
62
|
+
*/
|
|
63
|
+
export declare function settableProviders(): readonly ProviderRegistryEntry[];
|
|
64
|
+
/**
|
|
65
|
+
* The full list, detected first and in the order discovery produced.
|
|
66
|
+
*
|
|
67
|
+
* Detected rows are passed through untouched: same order, same source text,
|
|
68
|
+
* same numbering. Appending is what keeps that promise — anything that sorted,
|
|
69
|
+
* merged or grouped the two together would move a row the operator has already
|
|
70
|
+
* learned the position of.
|
|
71
|
+
*
|
|
72
|
+
* `includeUnconfigured` is false on the signed-in-subscription screen, which
|
|
73
|
+
* offers only sessions that are already usable; a row needing a key contradicts
|
|
74
|
+
* that screen's one sentence.
|
|
75
|
+
*/
|
|
76
|
+
export declare function providerListRows(detected: readonly DetectedProvider[], includeUnconfigured?: boolean): readonly ProviderListRow[];
|
|
77
|
+
/**
|
|
78
|
+
* What an unconfigured row is missing, named as the thing to act on.
|
|
79
|
+
*
|
|
80
|
+
* The environment variable and not "not configured": the variable is the one
|
|
81
|
+
* action that both makes the provider work now and keeps it working after a
|
|
82
|
+
* restart, and a sentence that says only that something is absent leaves the
|
|
83
|
+
* operator to find that name. `requiresApiKey: false` exists for providers
|
|
84
|
+
* whose free catalogue works without one, so those are labelled optional rather
|
|
85
|
+
* than needed.
|
|
86
|
+
*
|
|
87
|
+
* The fallback is unreachable for the current registry (every entry that
|
|
88
|
+
* reaches this screen declares at least one variable) and is kept so that a
|
|
89
|
+
* future entry without one prints a sentence rather than "needs undefined".
|
|
90
|
+
*/
|
|
91
|
+
export declare function credentialNeed(entry: ProviderRegistryEntry): string;
|
|
92
|
+
/**
|
|
93
|
+
* Where the cursor starts.
|
|
94
|
+
*
|
|
95
|
+
* The provider in force, else the one this screen was opened for — the saved
|
|
96
|
+
* provider whose credential is missing — else the top of the list.
|
|
97
|
+
*
|
|
98
|
+
* The middle case is why this is a function rather than one `findIndex`. A
|
|
99
|
+
* saved provider with no credential is not on the machine, so it is not in
|
|
100
|
+
* `detected`, so it used to fall through to row 1: the picker opened saying
|
|
101
|
+
* "no credential found" for the saved provider with the cursor elsewhere. Now the
|
|
102
|
+
* highlighted row IS the row that needs the key, which is also the row `k`
|
|
103
|
+
* targets.
|
|
104
|
+
*/
|
|
105
|
+
export declare function initialProviderRow(rows: readonly ProviderListRow[], currentProvider: string | null | undefined, keyEntryFor: ProviderId | null | undefined): number;
|
|
106
|
+
//# sourceMappingURL=provider-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-list.d.ts","sourceRoot":"","sources":["../../src/tui/provider-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAEN,KAAK,gBAAgB,EAErB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,MAAM,oCAAoC,CAAA;AAE3C;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,GAClE;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAA;CAAE,CAAA;AAE3E,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,GAAG,EAAE,eAAe,GAAG,UAAU,CAE9D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,qBAAqB,EAAE,CAIpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EACrC,mBAAmB,UAAO,GACxB,SAAS,eAAe,EAAE,CAY5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAInE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,SAAS,eAAe,EAAE,EAChC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC1C,WAAW,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GACxC,MAAM,CAUR"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rows the provider picker lists: what this machine already has, then what
|
|
3
|
+
* it could have if the operator supplied a credential.
|
|
4
|
+
*
|
|
5
|
+
* The second half is the point. The picker used to list only what discovery
|
|
6
|
+
* found, so the one provider an operator had SAVED and held a key for — but had
|
|
7
|
+
* not yet exported as an environment variable — appeared nowhere on a screen
|
|
8
|
+
* that exists to choose a provider. There was no row to select and therefore no
|
|
9
|
+
* way to type its key: a list that showed four providers had no fifth row for
|
|
10
|
+
* the fifth one, and the screen's other exit (a sign-in) is a different kind of
|
|
11
|
+
* credential entirely.
|
|
12
|
+
*
|
|
13
|
+
* ## What is added, and what is deliberately not
|
|
14
|
+
*
|
|
15
|
+
* A provider joins the list only when **this build can construct it** and it
|
|
16
|
+
* **takes a credential the operator can type** — the registry's
|
|
17
|
+
* `constructible` and `acceptsTypedCredential` flags, read together and read
|
|
18
|
+
* from the registry rather than listed here. Entering a key for anything else
|
|
19
|
+
* produces a row that leads nowhere, which is worse than an absent row:
|
|
20
|
+
*
|
|
21
|
+
* - `bedrock` needs an AWS credential CHAIN (an access key, a secret, a
|
|
22
|
+
* region, a session token, or a role the SDK assumes) rather than one
|
|
23
|
+
* string. A single API-key field cannot express it, so the picker does not
|
|
24
|
+
* offer it.
|
|
25
|
+
* - `http` is a generic endpoint whose base URL is half the
|
|
26
|
+
* credential. A key with nowhere to send it is not a setup.
|
|
27
|
+
* - `lmstudio` cannot be constructed by this build at all.
|
|
28
|
+
* - `ollama` needs a local server, not a secret.
|
|
29
|
+
* - `codex` needs a device-code sign-in, which this screen already offers
|
|
30
|
+
* with `l` and names on the sign-in screen. It is skipped here so that one
|
|
31
|
+
* provider is not offered two different ways to be set up.
|
|
32
|
+
*
|
|
33
|
+
* `provider-list.test.ts` asserts that exclusion list by NAME, so a registry
|
|
34
|
+
* flag that flips turns the test red instead of silently adding or dropping a
|
|
35
|
+
* row.
|
|
36
|
+
*/
|
|
37
|
+
import { ALL_PROVIDER_IDS, PROVIDER_REGISTRY, } from '../integrations/providers/index.js';
|
|
38
|
+
/** The provider a row is about, whichever kind of row it is. */
|
|
39
|
+
export function rowProviderId(row) {
|
|
40
|
+
return row.kind === 'detected' ? row.detected.entry.id : row.entry.id;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Providers this screen can set up by taking a credential from the operator.
|
|
44
|
+
*
|
|
45
|
+
* Derived from the registry, in registry order. Four of the twelve entries have
|
|
46
|
+
* a driver in this repository and are not listed here, for the reasons in the
|
|
47
|
+
* module comment.
|
|
48
|
+
*/
|
|
49
|
+
export function settableProviders() {
|
|
50
|
+
return ALL_PROVIDER_IDS.map((id) => PROVIDER_REGISTRY[id]).filter((entry) => entry.constructible && entry.acceptsTypedCredential);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The full list, detected first and in the order discovery produced.
|
|
54
|
+
*
|
|
55
|
+
* Detected rows are passed through untouched: same order, same source text,
|
|
56
|
+
* same numbering. Appending is what keeps that promise — anything that sorted,
|
|
57
|
+
* merged or grouped the two together would move a row the operator has already
|
|
58
|
+
* learned the position of.
|
|
59
|
+
*
|
|
60
|
+
* `includeUnconfigured` is false on the signed-in-subscription screen, which
|
|
61
|
+
* offers only sessions that are already usable; a row needing a key contradicts
|
|
62
|
+
* that screen's one sentence.
|
|
63
|
+
*/
|
|
64
|
+
export function providerListRows(detected, includeUnconfigured = true) {
|
|
65
|
+
const rows = detected.map((provider) => ({
|
|
66
|
+
kind: 'detected',
|
|
67
|
+
detected: provider,
|
|
68
|
+
}));
|
|
69
|
+
if (!includeUnconfigured)
|
|
70
|
+
return rows;
|
|
71
|
+
const known = new Set(detected.map((provider) => provider.entry.id));
|
|
72
|
+
for (const entry of settableProviders()) {
|
|
73
|
+
if (known.has(entry.id))
|
|
74
|
+
continue;
|
|
75
|
+
rows.push({ kind: 'unconfigured', entry });
|
|
76
|
+
}
|
|
77
|
+
return rows;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* What an unconfigured row is missing, named as the thing to act on.
|
|
81
|
+
*
|
|
82
|
+
* The environment variable and not "not configured": the variable is the one
|
|
83
|
+
* action that both makes the provider work now and keeps it working after a
|
|
84
|
+
* restart, and a sentence that says only that something is absent leaves the
|
|
85
|
+
* operator to find that name. `requiresApiKey: false` exists for providers
|
|
86
|
+
* whose free catalogue works without one, so those are labelled optional rather
|
|
87
|
+
* than needed.
|
|
88
|
+
*
|
|
89
|
+
* The fallback is unreachable for the current registry (every entry that
|
|
90
|
+
* reaches this screen declares at least one variable) and is kept so that a
|
|
91
|
+
* future entry without one prints a sentence rather than "needs undefined".
|
|
92
|
+
*/
|
|
93
|
+
export function credentialNeed(entry) {
|
|
94
|
+
const envName = entry.envVars[0];
|
|
95
|
+
if (!envName)
|
|
96
|
+
return 'needs a credential';
|
|
97
|
+
return entry.requiresApiKey ? `needs ${envName}` : `${envName} optional`;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Where the cursor starts.
|
|
101
|
+
*
|
|
102
|
+
* The provider in force, else the one this screen was opened for — the saved
|
|
103
|
+
* provider whose credential is missing — else the top of the list.
|
|
104
|
+
*
|
|
105
|
+
* The middle case is why this is a function rather than one `findIndex`. A
|
|
106
|
+
* saved provider with no credential is not on the machine, so it is not in
|
|
107
|
+
* `detected`, so it used to fall through to row 1: the picker opened saying
|
|
108
|
+
* "no credential found" for the saved provider with the cursor elsewhere. Now the
|
|
109
|
+
* highlighted row IS the row that needs the key, which is also the row `k`
|
|
110
|
+
* targets.
|
|
111
|
+
*/
|
|
112
|
+
export function initialProviderRow(rows, currentProvider, keyEntryFor) {
|
|
113
|
+
if (currentProvider !== null && currentProvider !== undefined) {
|
|
114
|
+
const at = rows.findIndex((row) => rowProviderId(row) === currentProvider);
|
|
115
|
+
if (at >= 0)
|
|
116
|
+
return at;
|
|
117
|
+
}
|
|
118
|
+
if (keyEntryFor !== null && keyEntryFor !== undefined) {
|
|
119
|
+
const at = rows.findIndex((row) => rowProviderId(row) === keyEntryFor);
|
|
120
|
+
if (at >= 0)
|
|
121
|
+
return at;
|
|
122
|
+
}
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=provider-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-list.js","sourceRoot":"","sources":["../../src/tui/provider-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EACN,gBAAgB,EAEhB,iBAAiB,GAGjB,MAAM,oCAAoC,CAAA;AAe3C,gEAAgE;AAChE,MAAM,UAAU,aAAa,CAAC,GAAoB;IACjD,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,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AAK,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,WAAW,CAAA;AACzE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CACjC,IAAgC,EAChC,eAA0C,EAC1C,WAA0C;IAE1C,IAAI,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAC/D,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,eAAe,CAAC,CAAA;QAC1E,IAAI,EAAE,IAAI,CAAC;YAAE,OAAO,EAAE,CAAA;IACvB,CAAC;IACD,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QACvD,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,CAAA;QACtE,IAAI,EAAE,IAAI,CAAC;YAAE,OAAO,EAAE,CAAA;IACvB,CAAC;IACD,OAAO,CAAC,CAAA;AACT,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namzu/cli",
|
|
3
|
-
"version": "26.0
|
|
3
|
+
"version": "26.2.0",
|
|
4
4
|
"description": "Interactive and headless terminal agent for Namzu, with provider discovery, durable sessions, tools and diagnostics.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"namzu",
|
|
@@ -46,16 +46,16 @@
|
|
|
46
46
|
"react": "19.2.6",
|
|
47
47
|
"string-width": "8.2.1",
|
|
48
48
|
"yaml": "^2.9.0",
|
|
49
|
-
"@namzu/anthropic": "
|
|
49
|
+
"@namzu/anthropic": "6.0.0",
|
|
50
50
|
"@namzu/computer-use": "1.4.3",
|
|
51
|
-
"@namzu/deepseek": "^
|
|
51
|
+
"@namzu/deepseek": "^2.0.0",
|
|
52
|
+
"@namzu/ollama": "2.2.4",
|
|
52
53
|
"@namzu/files": "1.1.1",
|
|
53
|
-
"@namzu/
|
|
54
|
-
"@namzu/
|
|
55
|
-
"@namzu/
|
|
56
|
-
"@namzu/
|
|
57
|
-
"@namzu/google": "^0.
|
|
58
|
-
"@namzu/zen": "^2.1.1"
|
|
54
|
+
"@namzu/openai": "4.0.0",
|
|
55
|
+
"@namzu/openrouter": "3.0.0",
|
|
56
|
+
"@namzu/sdk": "^43.0.0",
|
|
57
|
+
"@namzu/zen": "^2.1.1",
|
|
58
|
+
"@namzu/google": "^1.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@biomejs/biome": "^1.9.4",
|