@addai/node 0.30.16-msp.2 → 0.30.16-msp.3
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/model-selector.d.ts +10 -6
- package/dist/model-selector.js +22 -14
- package/package.json +1 -1
package/dist/model-selector.d.ts
CHANGED
|
@@ -67,6 +67,8 @@ export interface MspDecision {
|
|
|
67
67
|
confidence: number | null;
|
|
68
68
|
/** Jev says this message leans on earlier chat it can't see. */
|
|
69
69
|
continues: boolean;
|
|
70
|
+
/** Jev says it approves or restarts work, so it stays on the chat's tier. */
|
|
71
|
+
go_ahead: boolean;
|
|
70
72
|
max_run: MspConfig['max_run'];
|
|
71
73
|
fan_out: boolean;
|
|
72
74
|
}
|
|
@@ -152,6 +154,7 @@ export interface JevResult {
|
|
|
152
154
|
tier: TierName | null;
|
|
153
155
|
confidence: number | null;
|
|
154
156
|
continues: boolean;
|
|
157
|
+
goAhead: boolean;
|
|
155
158
|
ms: number;
|
|
156
159
|
inputTokens: number | null;
|
|
157
160
|
error: string | null;
|
|
@@ -161,13 +164,14 @@ export type JevRunner = (call: JevCall) => Promise<JevResult>;
|
|
|
161
164
|
export declare const askJev: (token: string, requestId: string) => JevRunner;
|
|
162
165
|
export declare const JEV_CONFIDENCE_FLOOR = 0.6;
|
|
163
166
|
/**
|
|
164
|
-
* Jev
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
167
|
+
* Jev only sees one message, so it mustn't mean a weak model. "yes do that" reads
|
|
168
|
+
* as quick and can be the go-ahead for an hour's work, so a go-ahead can't go
|
|
169
|
+
* lighter than where the chat already is. A follow-up question, or a pick Jev is
|
|
170
|
+
* unsure of, needs less: at least standard. settle() keeps a heavy model for its
|
|
171
|
+
* cache, so only the effort comes down. Holding max effort for "and the fix for
|
|
172
|
+
* number one?" took 3 minutes where medium took 15 s.
|
|
169
173
|
*/
|
|
170
|
-
export declare function steadyJevPick(pick: TierName, confidence: number | null, current: TierName | null, continues?: boolean): TierName;
|
|
174
|
+
export declare function steadyJevPick(pick: TierName, confidence: number | null, current: TierName | null, continues?: boolean, goAhead?: boolean): TierName;
|
|
171
175
|
/** The last decision, unless it is too old to be worth staying steady for. */
|
|
172
176
|
export declare function freshLast(last: MspLast | null | undefined, now: number): MspLast | null;
|
|
173
177
|
/**
|
package/dist/model-selector.js
CHANGED
|
@@ -427,7 +427,7 @@ const JEV_TIMEOUT_MS = 3000;
|
|
|
427
427
|
/** Asks the server, which holds the key. Never rejects. */
|
|
428
428
|
const askJev = (token, requestId) => async (call) => {
|
|
429
429
|
const started = Date.now();
|
|
430
|
-
const failed = (error) => ({ ok: false, tier: null, confidence: null, continues: false, ms: Date.now() - started, inputTokens: null, error });
|
|
430
|
+
const failed = (error) => ({ ok: false, tier: null, confidence: null, continues: false, goAhead: false, ms: Date.now() - started, inputTokens: null, error });
|
|
431
431
|
try {
|
|
432
432
|
const res = await fetch(`${config_1.SUPABASE_URL}/functions/v1/entity-msp-select`, {
|
|
433
433
|
method: 'POST',
|
|
@@ -445,6 +445,7 @@ const askJev = (token, requestId) => async (call) => {
|
|
|
445
445
|
tier: out.tier,
|
|
446
446
|
confidence: typeof out.confidence === 'number' ? out.confidence : null,
|
|
447
447
|
continues: out.continues === true,
|
|
448
|
+
goAhead: out.go_ahead === true,
|
|
448
449
|
ms: Date.now() - started,
|
|
449
450
|
inputTokens: typeof out.input_tokens === 'number' ? out.input_tokens : null,
|
|
450
451
|
error: null,
|
|
@@ -459,17 +460,20 @@ exports.askJev = askJev;
|
|
|
459
460
|
// TypeSafe's own guidance for acting on an answer automatically.
|
|
460
461
|
exports.JEV_CONFIDENCE_FLOOR = 0.6;
|
|
461
462
|
/**
|
|
462
|
-
* Jev
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
463
|
+
* Jev only sees one message, so it mustn't mean a weak model. "yes do that" reads
|
|
464
|
+
* as quick and can be the go-ahead for an hour's work, so a go-ahead can't go
|
|
465
|
+
* lighter than where the chat already is. A follow-up question, or a pick Jev is
|
|
466
|
+
* unsure of, needs less: at least standard. settle() keeps a heavy model for its
|
|
467
|
+
* cache, so only the effort comes down. Holding max effort for "and the fix for
|
|
468
|
+
* number one?" took 3 minutes where medium took 15 s.
|
|
467
469
|
*/
|
|
468
|
-
function steadyJevPick(pick, confidence, current, continues = false) {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
470
|
+
function steadyJevPick(pick, confidence, current, continues = false, goAhead = false) {
|
|
471
|
+
const atLeast = (least) => (rank(pick) < rank(least) ? least : pick);
|
|
472
|
+
if (goAhead)
|
|
473
|
+
return atLeast(current && rank(current) > rank('standard') ? current : 'standard');
|
|
474
|
+
if (continues || (confidence !== null && confidence < exports.JEV_CONFIDENCE_FLOOR))
|
|
475
|
+
return atLeast('standard');
|
|
476
|
+
return pick;
|
|
473
477
|
}
|
|
474
478
|
// ── one turn ─────────────────────────────────────────────────────────────────
|
|
475
479
|
// How long the prompt cache lives, and so how long holding a heavy model for it
|
|
@@ -518,6 +522,7 @@ async function decide(opts) {
|
|
|
518
522
|
selector_provider: provider,
|
|
519
523
|
confidence: null,
|
|
520
524
|
continues: false,
|
|
525
|
+
go_ahead: false,
|
|
521
526
|
max_run: cfg.max_run,
|
|
522
527
|
fan_out: t ? cfg.tiers[t].fan_out === true : false,
|
|
523
528
|
};
|
|
@@ -532,13 +537,14 @@ async function decide(opts) {
|
|
|
532
537
|
jev = await opts.runJev({ message, current });
|
|
533
538
|
}
|
|
534
539
|
catch (err) {
|
|
535
|
-
jev = { ok: false, tier: null, confidence: null, continues: false, ms: 0, inputTokens: null, error: `runner: ${err.message}` };
|
|
540
|
+
jev = { ok: false, tier: null, confidence: null, continues: false, goAhead: false, ms: 0, inputTokens: null, error: `runner: ${err.message}` };
|
|
536
541
|
}
|
|
537
542
|
if (!jev.ok || !jev.tier)
|
|
538
543
|
return fallback(jev.error ?? 'jev_bad_answer', jev.ms, jev.inputTokens);
|
|
539
544
|
}
|
|
540
545
|
const continues = jev?.continues === true;
|
|
541
|
-
const
|
|
546
|
+
const goAhead = jev?.goAhead === true;
|
|
547
|
+
const picked = forced ?? steadyJevPick(jev.tier, jev.confidence, current, continues, goAhead);
|
|
542
548
|
const s = settle(cfg, last, picked, forced ? 'override' : 'selector');
|
|
543
549
|
const sure = jev?.confidence;
|
|
544
550
|
const decision = {
|
|
@@ -549,7 +555,7 @@ async function decide(opts) {
|
|
|
549
555
|
source: forced ? 'override' : 'selector',
|
|
550
556
|
why: forced
|
|
551
557
|
? 'asked for in the message'
|
|
552
|
-
: `Jev${typeof sure === 'number' ? `, ${Math.round(sure * 100)}% sure` : ''}${continues ? ', follows on from earlier' : ''}`,
|
|
558
|
+
: `Jev${typeof sure === 'number' ? `, ${Math.round(sure * 100)}% sure` : ''}${goAhead ? ', a go-ahead' : continues ? ', follows on from earlier' : ''}`,
|
|
553
559
|
line: plainLine(cfg, s.tier),
|
|
554
560
|
light_streak: s.light_streak,
|
|
555
561
|
effort_only: s.effort_only,
|
|
@@ -561,6 +567,7 @@ async function decide(opts) {
|
|
|
561
567
|
selector_provider: 'jev',
|
|
562
568
|
confidence: jev?.confidence ?? null,
|
|
563
569
|
continues,
|
|
570
|
+
go_ahead: goAhead,
|
|
564
571
|
max_run: cfg.max_run,
|
|
565
572
|
fan_out: cfg.tiers[s.tier].fan_out === true,
|
|
566
573
|
};
|
|
@@ -611,6 +618,7 @@ async function decide(opts) {
|
|
|
611
618
|
selector_provider: 'claude',
|
|
612
619
|
confidence: null,
|
|
613
620
|
continues: false,
|
|
621
|
+
go_ahead: false,
|
|
614
622
|
max_run: cfg.max_run,
|
|
615
623
|
fan_out: cfg.tiers[s.tier].fan_out === true,
|
|
616
624
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@addai/node",
|
|
3
|
-
"version": "0.30.16-msp.
|
|
3
|
+
"version": "0.30.16-msp.3",
|
|
4
4
|
"description": "Daemon that pairs a machine with your +Ai account and runs Claude / Codex / Kimi / Gemini agents on its behalf. Reachable via Supabase from Vault, Entity Studio, or any other +Ai surface.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|