@inbrowser/agent 0.0.0-placeholder → 0.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/AGENTS.md +270 -0
- package/LICENSE +21 -0
- package/README.md +117 -2
- package/bin/agent.ts +10 -0
- package/dist/cli/commands/describe.d.ts +14 -0
- package/dist/cli/commands/describe.d.ts.map +1 -0
- package/dist/cli/commands/describe.js +179 -0
- package/dist/cli/commands/describe.js.map +1 -0
- package/dist/cli/commands/events.d.ts +21 -0
- package/dist/cli/commands/events.d.ts.map +1 -0
- package/dist/cli/commands/events.js +59 -0
- package/dist/cli/commands/events.js.map +1 -0
- package/dist/cli/commands/fleet.d.ts +15 -0
- package/dist/cli/commands/fleet.d.ts.map +1 -0
- package/dist/cli/commands/fleet.js +149 -0
- package/dist/cli/commands/fleet.js.map +1 -0
- package/dist/cli/commands/help.d.ts +15 -0
- package/dist/cli/commands/help.d.ts.map +1 -0
- package/dist/cli/commands/help.js +93 -0
- package/dist/cli/commands/help.js.map +1 -0
- package/dist/cli/commands/migrate.d.ts +27 -0
- package/dist/cli/commands/migrate.d.ts.map +1 -0
- package/dist/cli/commands/migrate.js +109 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/run.d.ts +38 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +535 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/schema.d.ts +8 -0
- package/dist/cli/commands/schema.d.ts.map +1 -0
- package/dist/cli/commands/schema.js +12 -0
- package/dist/cli/commands/schema.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +39 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +65 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/undo.d.ts +36 -0
- package/dist/cli/commands/undo.d.ts.map +1 -0
- package/dist/cli/commands/undo.js +132 -0
- package/dist/cli/commands/undo.js.map +1 -0
- package/dist/cli/fixtures.d.ts +17 -0
- package/dist/cli/fixtures.d.ts.map +1 -0
- package/dist/cli/fixtures.js +107 -0
- package/dist/cli/fixtures.js.map +1 -0
- package/dist/cli/hardening.d.ts +39 -0
- package/dist/cli/hardening.d.ts.map +1 -0
- package/dist/cli/hardening.js +68 -0
- package/dist/cli/hardening.js.map +1 -0
- package/dist/cli/index.d.ts +28 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +19 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/llm/openrouter.d.ts +33 -0
- package/dist/cli/llm/openrouter.d.ts.map +1 -0
- package/dist/cli/llm/openrouter.js +285 -0
- package/dist/cli/llm/openrouter.js.map +1 -0
- package/dist/cli/main.d.ts +32 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +106 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/output.d.ts +36 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +95 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/parse.d.ts +26 -0
- package/dist/cli/parse.d.ts.map +1 -0
- package/dist/cli/parse.js +160 -0
- package/dist/cli/parse.js.map +1 -0
- package/dist/cli/session-log.d.ts +34 -0
- package/dist/cli/session-log.d.ts.map +1 -0
- package/dist/cli/session-log.js +52 -0
- package/dist/cli/session-log.js.map +1 -0
- package/dist/cli/spec.d.ts +62 -0
- package/dist/cli/spec.d.ts.map +1 -0
- package/dist/cli/spec.js +510 -0
- package/dist/cli/spec.js.map +1 -0
- package/dist/cli/ui/RunView.d.ts +134 -0
- package/dist/cli/ui/RunView.d.ts.map +1 -0
- package/dist/cli/ui/RunView.js +341 -0
- package/dist/cli/ui/RunView.js.map +1 -0
- package/dist/diagnostics/index.d.ts +5 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +3 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/diagnostics/timing.d.ts +48 -0
- package/dist/diagnostics/timing.d.ts.map +1 -0
- package/dist/diagnostics/timing.js +85 -0
- package/dist/diagnostics/timing.js.map +1 -0
- package/dist/diagnostics/truthfulness.d.ts +36 -0
- package/dist/diagnostics/truthfulness.d.ts.map +1 -0
- package/dist/diagnostics/truthfulness.js +180 -0
- package/dist/diagnostics/truthfulness.js.map +1 -0
- package/dist/dispatch-memoization.d.ts +84 -0
- package/dist/dispatch-memoization.d.ts.map +1 -0
- package/dist/dispatch-memoization.js +197 -0
- package/dist/dispatch-memoization.js.map +1 -0
- package/dist/eval/comparison-report.d.ts +164 -0
- package/dist/eval/comparison-report.d.ts.map +1 -0
- package/dist/eval/comparison-report.js +316 -0
- package/dist/eval/comparison-report.js.map +1 -0
- package/dist/eval/fixture.d.ts +74 -0
- package/dist/eval/fixture.d.ts.map +1 -0
- package/dist/eval/fixture.js +217 -0
- package/dist/eval/fixture.js.map +1 -0
- package/dist/eval/index.d.ts +13 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +7 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/eval/load-node.d.ts +16 -0
- package/dist/eval/load-node.d.ts.map +1 -0
- package/dist/eval/load-node.js +58 -0
- package/dist/eval/load-node.js.map +1 -0
- package/dist/eval/metric-collector.d.ts +209 -0
- package/dist/eval/metric-collector.d.ts.map +1 -0
- package/dist/eval/metric-collector.js +293 -0
- package/dist/eval/metric-collector.js.map +1 -0
- package/dist/eval/run-record.d.ts +76 -0
- package/dist/eval/run-record.d.ts.map +1 -0
- package/dist/eval/run-record.js +32 -0
- package/dist/eval/run-record.js.map +1 -0
- package/dist/eval/runner.d.ts +140 -0
- package/dist/eval/runner.d.ts.map +1 -0
- package/dist/eval/runner.js +310 -0
- package/dist/eval/runner.js.map +1 -0
- package/dist/eval/spec-framework.d.ts +113 -0
- package/dist/eval/spec-framework.d.ts.map +1 -0
- package/dist/eval/spec-framework.js +100 -0
- package/dist/eval/spec-framework.js.map +1 -0
- package/dist/eval/spec-helpers.d.ts +245 -0
- package/dist/eval/spec-helpers.d.ts.map +1 -0
- package/dist/eval/spec-helpers.js +605 -0
- package/dist/eval/spec-helpers.js.map +1 -0
- package/dist/events/codec.d.ts +79 -0
- package/dist/events/codec.d.ts.map +1 -0
- package/dist/events/codec.js +142 -0
- package/dist/events/codec.js.map +1 -0
- package/dist/events/log-core.d.ts +76 -0
- package/dist/events/log-core.d.ts.map +1 -0
- package/dist/events/log-core.js +73 -0
- package/dist/events/log-core.js.map +1 -0
- package/dist/events/log.d.ts +60 -0
- package/dist/events/log.d.ts.map +1 -0
- package/dist/events/log.js +193 -0
- package/dist/events/log.js.map +1 -0
- package/dist/events/replay.d.ts +106 -0
- package/dist/events/replay.d.ts.map +1 -0
- package/dist/events/replay.js +137 -0
- package/dist/events/replay.js.map +1 -0
- package/dist/events/wrap.d.ts +100 -0
- package/dist/events/wrap.d.ts.map +1 -0
- package/dist/events/wrap.js +141 -0
- package/dist/events/wrap.js.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/llm-adapter.d.ts +96 -0
- package/dist/llm-adapter.d.ts.map +1 -0
- package/dist/llm-adapter.js +132 -0
- package/dist/llm-adapter.js.map +1 -0
- package/dist/mcp/serve.d.ts +70 -0
- package/dist/mcp/serve.d.ts.map +1 -0
- package/dist/mcp/serve.js +154 -0
- package/dist/mcp/serve.js.map +1 -0
- package/dist/metrics/runs.d.ts +58 -0
- package/dist/metrics/runs.d.ts.map +1 -0
- package/dist/metrics/runs.js +99 -0
- package/dist/metrics/runs.js.map +1 -0
- package/dist/metrics.d.ts +38 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +123 -0
- package/dist/metrics.js.map +1 -0
- package/dist/node.d.ts +23 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +23 -0
- package/dist/node.js.map +1 -0
- package/dist/planner-executor.d.ts +132 -0
- package/dist/planner-executor.d.ts.map +1 -0
- package/dist/planner-executor.js +274 -0
- package/dist/planner-executor.js.map +1 -0
- package/dist/session.d.ts +10 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +179 -0
- package/dist/session.js.map +1 -0
- package/dist/skill-catalog.d.ts +81 -0
- package/dist/skill-catalog.d.ts.map +1 -0
- package/dist/skill-catalog.js +388 -0
- package/dist/skill-catalog.js.map +1 -0
- package/dist/skill-router.d.ts +95 -0
- package/dist/skill-router.d.ts.map +1 -0
- package/dist/skill-router.js +130 -0
- package/dist/skill-router.js.map +1 -0
- package/dist/storage.d.ts +14 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +58 -0
- package/dist/storage.js.map +1 -0
- package/dist/strategy.d.ts +45 -0
- package/dist/strategy.d.ts.map +1 -0
- package/dist/strategy.js +520 -0
- package/dist/strategy.js.map +1 -0
- package/dist/tools.d.ts +40 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +147 -0
- package/dist/tools.js.map +1 -0
- package/dist/types/agent.d.ts +94 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +17 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/capabilities.d.ts +17 -0
- package/dist/types/capabilities.d.ts.map +1 -0
- package/dist/types/capabilities.js +13 -0
- package/dist/types/capabilities.js.map +1 -0
- package/dist/types/chat.d.ts +74 -0
- package/dist/types/chat.d.ts.map +1 -0
- package/dist/types/chat.js +10 -0
- package/dist/types/chat.js.map +1 -0
- package/dist/types/events.d.ts +115 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +30 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/llm.d.ts +89 -0
- package/dist/types/llm.d.ts.map +1 -0
- package/dist/types/llm.js +12 -0
- package/dist/types/llm.js.map +1 -0
- package/dist/types/metrics.d.ts +34 -0
- package/dist/types/metrics.d.ts.map +1 -0
- package/dist/types/metrics.js +10 -0
- package/dist/types/metrics.js.map +1 -0
- package/dist/types/observer.d.ts +41 -0
- package/dist/types/observer.d.ts.map +1 -0
- package/dist/types/observer.js +41 -0
- package/dist/types/observer.js.map +1 -0
- package/dist/types/project-context.d.ts +18 -0
- package/dist/types/project-context.d.ts.map +1 -0
- package/dist/types/project-context.js +11 -0
- package/dist/types/project-context.js.map +1 -0
- package/dist/types/runtime.d.ts +71 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +21 -0
- package/dist/types/runtime.js.map +1 -0
- package/dist/types/session.d.ts +103 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/session.js +11 -0
- package/dist/types/session.js.map +1 -0
- package/dist/types/storage.d.ts +20 -0
- package/dist/types/storage.d.ts.map +1 -0
- package/dist/types/storage.js +41 -0
- package/dist/types/storage.js.map +1 -0
- package/dist/types/strategy.d.ts +124 -0
- package/dist/types/strategy.d.ts.map +1 -0
- package/dist/types/strategy.js +10 -0
- package/dist/types/strategy.js.map +1 -0
- package/dist/types/tools.d.ts +154 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +11 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/trace.d.ts +175 -0
- package/dist/types/trace.d.ts.map +1 -0
- package/dist/types/trace.js +26 -0
- package/dist/types/trace.js.map +1 -0
- package/dist/types/workspace.d.ts +29 -0
- package/dist/types/workspace.d.ts.map +1 -0
- package/dist/types/workspace.js +18 -0
- package/dist/types/workspace.js.map +1 -0
- package/package.json +45 -14
- package/skills/agent-cli.md +218 -0
- package/index.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-catalog.js","sourceRoot":"","sources":["../src/skill-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EACL,iCAAiC,EACjC,iCAAiC,EACjC,4DAA4D,EAC5D,mDAAmD,EACnD,2BAA2B,EAC3B,oCAAoC,EACpC,qCAAqC,GACtC,MAAM,wB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ACvF,QAAQ,EAAE;oBACR,IAAI,EAAE,4DAA4D;oBAClE,IAAI,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE;iBAChC;aACF;YACD;gBACE,EAAE,EAAE,uBAAuB;gBAC3B,WAAW,EACT,uGAAuG;gBACzG,QAAQ,EAAE;oBACR,IAAI,EAAE,2BAA2B;oBACjC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;iBACtC;aACF;SACF;KACF;CACF,CAAC;AAEF,8EAA8E;AAC9E,0EAA0E;AAC1E,yEAAyE;AACzE,2DAA2D;AAC3D,8EAA8E;AAE9E,MAAM,aAAa,GAA8C,IAAI,GAAG,CACtE,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAClD,CAAC;AAEF,MAAM,KAAK,GAAyB,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAe;IAC3C,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyword-based skill router.
|
|
3
|
+
*
|
|
4
|
+
* Phase five of the implementation plan splits the planner-executor
|
|
5
|
+
* work into three branches: the static `SkillCatalog`, this router
|
|
6
|
+
* that classifies a user prompt against the catalog, and the
|
|
7
|
+
* executor that walks a chosen skill's prescribed step sequence.
|
|
8
|
+
*
|
|
9
|
+
* The router is intentionally simple. It does not call a language
|
|
10
|
+
* model. It lowercases the prompt and counts how many of each
|
|
11
|
+
* catalog entry's `triggerHints` appear as substrings in the
|
|
12
|
+
* prompt. The entry with the highest hit count wins. Ties break
|
|
13
|
+
* in favor of entries whose literal `name` (e.g.
|
|
14
|
+
* `rtdb-game-rules`) appears in the prompt — either in the
|
|
15
|
+
* lowered text or in the prompt's kebab-case form (whitespace
|
|
16
|
+
* collapsed to dashes). After that, ties break by catalog order.
|
|
17
|
+
* When the score AND name-in-prompt signal both tie between the
|
|
18
|
+
* top entry and the runner-up, the router returns `match: null`
|
|
19
|
+
* rather than mis-route into a coin-flip pick.
|
|
20
|
+
*
|
|
21
|
+
* A v1 design point: confidence is the raw hit count. There is no
|
|
22
|
+
* normalization, no probability. The planner-executor decides
|
|
23
|
+
* whether a `RouterDecision.match` is good enough to act on. When
|
|
24
|
+
* no entry scores at or above `threshold` (default 1), the router
|
|
25
|
+
* returns `match: null` and the executor is expected to fall back
|
|
26
|
+
* to plain ReAct.
|
|
27
|
+
*
|
|
28
|
+
* Future work: an LLM-based router could layer on top of this
|
|
29
|
+
* keyword scoring (for example, only invoked when the keyword
|
|
30
|
+
* router returns null or returns a low-margin tie). That layering
|
|
31
|
+
* is explicitly deferred and is not in this branch.
|
|
32
|
+
*/
|
|
33
|
+
import type { SkillName } from './eval/fixture.js';
|
|
34
|
+
import { type SkillCatalog } from './skill-catalog.js';
|
|
35
|
+
/**
|
|
36
|
+
* A single scored entry in the router's ranking. `score` is the
|
|
37
|
+
* raw number of `triggerHints` that appeared as substrings of
|
|
38
|
+
* the lowercased prompt — no normalization or probability.
|
|
39
|
+
*/
|
|
40
|
+
export interface RouterMatch {
|
|
41
|
+
/** The skill the catalog entry identifies. */
|
|
42
|
+
skill: SkillName;
|
|
43
|
+
/** Number of trigger hints matched. Higher is better. */
|
|
44
|
+
score: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The router's verdict for one prompt. `match` is the top-scoring
|
|
48
|
+
* candidate when it cleared the threshold, otherwise `null`.
|
|
49
|
+
* `ranking` always reflects the full sorted scoring, useful for
|
|
50
|
+
* debugging accuracy and for callers that want to inspect runners-up.
|
|
51
|
+
*/
|
|
52
|
+
export interface RouterDecision {
|
|
53
|
+
/** The top-scoring match, or null when no entry scored >= threshold. */
|
|
54
|
+
match: RouterMatch | null;
|
|
55
|
+
/** All scored entries, descending. Useful for debugging accuracy. */
|
|
56
|
+
ranking: readonly RouterMatch[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Optional overrides for `routeSkill`. `threshold` is the minimum
|
|
60
|
+
* `score` required to count as a real match (default 1, so a single
|
|
61
|
+
* trigger hit clears the bar). `catalog` lets tests inject a
|
|
62
|
+
* different catalog without touching the global.
|
|
63
|
+
*/
|
|
64
|
+
export interface RouterOptions {
|
|
65
|
+
/** Minimum score required to call it a match. Default 1. */
|
|
66
|
+
threshold?: number;
|
|
67
|
+
/** Optional override of the catalog. Defaults to SKILL_CATALOG. */
|
|
68
|
+
catalog?: SkillCatalog;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Route a user prompt to a catalog entry using keyword scoring.
|
|
72
|
+
*
|
|
73
|
+
* Algorithm:
|
|
74
|
+
* 1. Lowercase the prompt and compute its kebab-case form
|
|
75
|
+
* (whitespace collapsed to dashes) for name matching.
|
|
76
|
+
* 2. For each entry, score = count of `triggerHints` whose
|
|
77
|
+
* lowercased form appears as a substring of the prompt.
|
|
78
|
+
* 3. Build a ranking sorted by (score DESC, name-in-prompt DESC,
|
|
79
|
+
* catalog order ASC). `name-in-prompt` is true when the
|
|
80
|
+
* literal skill name (e.g. `rtdb-game-rules`) appears in
|
|
81
|
+
* either the lowered prompt or its kebab-case form.
|
|
82
|
+
* 4. If the top entry's score is >= threshold (default 1),
|
|
83
|
+
* return it as `match`; otherwise `match: null`.
|
|
84
|
+
* 5. Ambiguity guard: if the top entry ties on score with the
|
|
85
|
+
* runner-up and the tie-break (name-in-prompt) does not
|
|
86
|
+
* disambiguate, return `match: null` rather than committing
|
|
87
|
+
* to the catalog-order winner. The brief's hard requirement
|
|
88
|
+
* is that the router never returns a *wrong* skill — a
|
|
89
|
+
* coin-flip pick is exactly that failure mode.
|
|
90
|
+
*
|
|
91
|
+
* The `ranking` returned always covers every catalog entry so
|
|
92
|
+
* callers can inspect runners-up regardless of the match decision.
|
|
93
|
+
*/
|
|
94
|
+
export declare function routeSkill(prompt: string, options?: RouterOptions): RouterDecision;
|
|
95
|
+
//# sourceMappingURL=skill-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-router.d.ts","sourceRoot":"","sources":["../src/skill-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEtE;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,KAAK,EAAE,SAAS,CAAC;IACjB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,qEAAqE;IACrE,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAmCD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,cAAc,CA6ClF"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyword-based skill router.
|
|
3
|
+
*
|
|
4
|
+
* Phase five of the implementation plan splits the planner-executor
|
|
5
|
+
* work into three branches: the static `SkillCatalog`, this router
|
|
6
|
+
* that classifies a user prompt against the catalog, and the
|
|
7
|
+
* executor that walks a chosen skill's prescribed step sequence.
|
|
8
|
+
*
|
|
9
|
+
* The router is intentionally simple. It does not call a language
|
|
10
|
+
* model. It lowercases the prompt and counts how many of each
|
|
11
|
+
* catalog entry's `triggerHints` appear as substrings in the
|
|
12
|
+
* prompt. The entry with the highest hit count wins. Ties break
|
|
13
|
+
* in favor of entries whose literal `name` (e.g.
|
|
14
|
+
* `rtdb-game-rules`) appears in the prompt — either in the
|
|
15
|
+
* lowered text or in the prompt's kebab-case form (whitespace
|
|
16
|
+
* collapsed to dashes). After that, ties break by catalog order.
|
|
17
|
+
* When the score AND name-in-prompt signal both tie between the
|
|
18
|
+
* top entry and the runner-up, the router returns `match: null`
|
|
19
|
+
* rather than mis-route into a coin-flip pick.
|
|
20
|
+
*
|
|
21
|
+
* A v1 design point: confidence is the raw hit count. There is no
|
|
22
|
+
* normalization, no probability. The planner-executor decides
|
|
23
|
+
* whether a `RouterDecision.match` is good enough to act on. When
|
|
24
|
+
* no entry scores at or above `threshold` (default 1), the router
|
|
25
|
+
* returns `match: null` and the executor is expected to fall back
|
|
26
|
+
* to plain ReAct.
|
|
27
|
+
*
|
|
28
|
+
* Future work: an LLM-based router could layer on top of this
|
|
29
|
+
* keyword scoring (for example, only invoked when the keyword
|
|
30
|
+
* router returns null or returns a low-margin tie). That layering
|
|
31
|
+
* is explicitly deferred and is not in this branch.
|
|
32
|
+
*/
|
|
33
|
+
import { SKILL_CATALOG } from './skill-catalog.js';
|
|
34
|
+
/**
|
|
35
|
+
* Count how many of `hints` appear as substrings of `lowerPrompt`.
|
|
36
|
+
* Each hint is counted at most once, regardless of how many times
|
|
37
|
+
* it appears in the prompt — this matches the "number of hints
|
|
38
|
+
* that matched" framing in the brief, not "total occurrences."
|
|
39
|
+
*/
|
|
40
|
+
function scoreHints(lowerPrompt, hints) {
|
|
41
|
+
let score = 0;
|
|
42
|
+
for (const hint of hints) {
|
|
43
|
+
if (hint.length === 0)
|
|
44
|
+
continue;
|
|
45
|
+
if (lowerPrompt.includes(hint.toLowerCase())) {
|
|
46
|
+
score += 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return score;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The brief's tie-break: prefer entries whose `name` appears in
|
|
53
|
+
* the prompt as a substring of the lowercased prompt or its
|
|
54
|
+
* kebab-case form. The kebab-case form of the prompt is the
|
|
55
|
+
* lowercased text with all whitespace collapsed to single dashes,
|
|
56
|
+
* so a user typing "rtdb game rules" still picks up the literal
|
|
57
|
+
* `rtdb-game-rules` skill name.
|
|
58
|
+
*/
|
|
59
|
+
function nameInPrompt(lowerPrompt, kebabPrompt, name) {
|
|
60
|
+
return lowerPrompt.includes(name) || kebabPrompt.includes(name);
|
|
61
|
+
}
|
|
62
|
+
function toKebabPrompt(lowerPrompt) {
|
|
63
|
+
return lowerPrompt.replace(/\s+/g, '-');
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Route a user prompt to a catalog entry using keyword scoring.
|
|
67
|
+
*
|
|
68
|
+
* Algorithm:
|
|
69
|
+
* 1. Lowercase the prompt and compute its kebab-case form
|
|
70
|
+
* (whitespace collapsed to dashes) for name matching.
|
|
71
|
+
* 2. For each entry, score = count of `triggerHints` whose
|
|
72
|
+
* lowercased form appears as a substring of the prompt.
|
|
73
|
+
* 3. Build a ranking sorted by (score DESC, name-in-prompt DESC,
|
|
74
|
+
* catalog order ASC). `name-in-prompt` is true when the
|
|
75
|
+
* literal skill name (e.g. `rtdb-game-rules`) appears in
|
|
76
|
+
* either the lowered prompt or its kebab-case form.
|
|
77
|
+
* 4. If the top entry's score is >= threshold (default 1),
|
|
78
|
+
* return it as `match`; otherwise `match: null`.
|
|
79
|
+
* 5. Ambiguity guard: if the top entry ties on score with the
|
|
80
|
+
* runner-up and the tie-break (name-in-prompt) does not
|
|
81
|
+
* disambiguate, return `match: null` rather than committing
|
|
82
|
+
* to the catalog-order winner. The brief's hard requirement
|
|
83
|
+
* is that the router never returns a *wrong* skill — a
|
|
84
|
+
* coin-flip pick is exactly that failure mode.
|
|
85
|
+
*
|
|
86
|
+
* The `ranking` returned always covers every catalog entry so
|
|
87
|
+
* callers can inspect runners-up regardless of the match decision.
|
|
88
|
+
*/
|
|
89
|
+
export function routeSkill(prompt, options) {
|
|
90
|
+
const threshold = options?.threshold ?? 1;
|
|
91
|
+
const catalog = options?.catalog ?? SKILL_CATALOG;
|
|
92
|
+
const lowerPrompt = prompt.toLowerCase();
|
|
93
|
+
const kebabPrompt = toKebabPrompt(lowerPrompt);
|
|
94
|
+
// Snapshot each entry with its score, its catalog position, and
|
|
95
|
+
// the tie-break signal. We sort a copy so the input catalog is
|
|
96
|
+
// not mutated.
|
|
97
|
+
const scored = catalog.map((entry, index) => ({
|
|
98
|
+
skill: entry.name,
|
|
99
|
+
score: scoreHints(lowerPrompt, entry.triggerHints),
|
|
100
|
+
nameInPrompt: nameInPrompt(lowerPrompt, kebabPrompt, entry.name),
|
|
101
|
+
catalogIndex: index,
|
|
102
|
+
}));
|
|
103
|
+
scored.sort((a, b) => {
|
|
104
|
+
if (b.score !== a.score)
|
|
105
|
+
return b.score - a.score;
|
|
106
|
+
if (a.nameInPrompt !== b.nameInPrompt)
|
|
107
|
+
return a.nameInPrompt ? -1 : 1;
|
|
108
|
+
return a.catalogIndex - b.catalogIndex;
|
|
109
|
+
});
|
|
110
|
+
const ranking = scored.map((s) => ({ skill: s.skill, score: s.score }));
|
|
111
|
+
const top = scored[0];
|
|
112
|
+
let match = top !== undefined && top.score >= threshold ? { skill: top.skill, score: top.score } : null;
|
|
113
|
+
// Ambiguity guard. When the top and runner-up share a positive
|
|
114
|
+
// score and the name-in-prompt tie-break does not separate them,
|
|
115
|
+
// the keyword router does not have enough signal to commit.
|
|
116
|
+
// Returning null here hands the prompt off to the planner-executor's
|
|
117
|
+
// fallback (plain ReAct) rather than mis-routing — the brief's
|
|
118
|
+
// hard requirement is that the router never returns a *wrong*
|
|
119
|
+
// skill. Only applies when the top score is at least 1: callers
|
|
120
|
+
// who pass `threshold: 0` are explicitly asking for the
|
|
121
|
+
// catalog-order winner regardless of signal.
|
|
122
|
+
if (match !== null && top.score > 0 && scored.length > 1) {
|
|
123
|
+
const runnerUp = scored[1];
|
|
124
|
+
if (runnerUp.score === top.score && runnerUp.nameInPrompt === top.nameInPrompt) {
|
|
125
|
+
match = null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return { match, ranking };
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=skill-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-router.js","sourceRoot":"","sources":["../src/skill-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,aAAa,EAAqB,MAAM,oBAAoB,CAAC;AAwCtE;;;;;GAKG;AACH,SAAS,UAAU,CAAC,WAAmB,EAAE,KAAwB;IAC/D,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAChC,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YAC7C,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,WAAmB,EAAE,WAAmB,EAAE,IAAe;IAC7E,OAAO,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,WAAmB;IACxC,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC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AAK,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAEvF,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,KAAK,GACP,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAE9F,+DAA+D;IAC/D,iEAAiE;IACjE,4DAA4D;IAC5D,qEAAqE;IACrE,+DAA+D;IAC/D,8DAA8D;IAC9D,gEAAgE;IAChE,wDAAwD;IACxD,6CAA6C;IAC7C,IAAI,KAAK,KAAK,IAAI,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzD,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,QAAQ,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,QAAQ,CAAC,YAAY,KAAK,GAAG,CAAC,YAAY,EAAE,CAAC;YAC/E,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Storage` runtime helpers — adapters over the `Storage` interface
|
|
3
|
+
* in `./types/storage.ts`. `noopStorage` and `createMemoryStorage`
|
|
4
|
+
* are exported from the types module since they have no dependencies;
|
|
5
|
+
* this file adds adapters that DO have host-specific deps.
|
|
6
|
+
*/
|
|
7
|
+
import type { Storage } from './types/storage.js';
|
|
8
|
+
/**
|
|
9
|
+
* Browser-only adapter over `window.localStorage`. Errors (private
|
|
10
|
+
* browsing, quota-exceeded) are swallowed silently — `get` returns
|
|
11
|
+
* null, `set` is a no-op, the host doesn't crash.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createLocalStorageAdapter(): Storage;
|
|
14
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAwCnD"}
|
package/dist/storage.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Storage` runtime helpers — adapters over the `Storage` interface
|
|
3
|
+
* in `./types/storage.ts`. `noopStorage` and `createMemoryStorage`
|
|
4
|
+
* are exported from the types module since they have no dependencies;
|
|
5
|
+
* this file adds adapters that DO have host-specific deps.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Browser-only adapter over `window.localStorage`. Errors (private
|
|
9
|
+
* browsing, quota-exceeded) are swallowed silently — `get` returns
|
|
10
|
+
* null, `set` is a no-op, the host doesn't crash.
|
|
11
|
+
*/
|
|
12
|
+
export function createLocalStorageAdapter() {
|
|
13
|
+
return {
|
|
14
|
+
get(key) {
|
|
15
|
+
try {
|
|
16
|
+
return globalThis.localStorage?.getItem(key) ?? null;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
set(key, value) {
|
|
23
|
+
try {
|
|
24
|
+
globalThis.localStorage?.setItem(key, value);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
/* quota / private-mode */
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
remove(key) {
|
|
31
|
+
try {
|
|
32
|
+
globalThis.localStorage?.removeItem(key);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
/* ignored */
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
keys(prefix) {
|
|
39
|
+
try {
|
|
40
|
+
const ls = globalThis.localStorage;
|
|
41
|
+
if (!ls)
|
|
42
|
+
return [];
|
|
43
|
+
const out = [];
|
|
44
|
+
for (let i = 0; i < ls.length; i++) {
|
|
45
|
+
const k = ls.key(i);
|
|
46
|
+
if (k !== null && (prefix === undefined || k.startsWith(prefix))) {
|
|
47
|
+
out.push(k);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;GAIG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,GAAG,CAAC,GAAG;YACL,IAAI,CAAC;gBACH,OAAO,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;YACvD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,GAAG,CAAC,GAAG,EAAE,KAAK;YACZ,IAAI,CAAC;gBACH,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC/C,CAAC;YAAC,MAAM,CAAC;gBACP,0BAA0B;YAC5B,CAAC;QACH,CAAC;QACD,MAAM,CAAC,GAAG;YACR,IAAI,CAAC;gBACH,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;YAC3C,CAAC;YAAC,MAAM,CAAC;gBACP,aAAa;YACf,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM;YACT,IAAI,CAAC;gBACH,MAAM,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC;gBACnC,IAAI,CAAC,EAAE;oBAAE,OAAO,EAAE,CAAC;gBACnB,MAAM,GAAG,GAAa,EAAE,CAAC;gBACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBACnC,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBACpB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;wBACjE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBACd,CAAC;gBACH,CAAC;gBACD,OAAO,GAAG,CAAC;YACb,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createReactLoopStrategy()` — the default `AgentStrategy`.
|
|
3
|
+
*
|
|
4
|
+
* Implements the playground's current ReAct-style behavior:
|
|
5
|
+
*
|
|
6
|
+
* 1. Compose `[system, ...history, user(prompt)]` as the message
|
|
7
|
+
* array.
|
|
8
|
+
* 2. Issue one chat call against the LLM with the tool list.
|
|
9
|
+
* 3. Stream `text` / `thinking` / `tool_call` events through.
|
|
10
|
+
* 4. When the LLM produces tool calls, dispatch each one, append
|
|
11
|
+
* the result message, and loop back to step 2.
|
|
12
|
+
* 5. When the LLM produces no tool calls in a turn, emit
|
|
13
|
+
* `turn_complete` and finish.
|
|
14
|
+
*
|
|
15
|
+
* Future strategies (planner-executor, graph-of-thoughts,
|
|
16
|
+
* parallel-branch ensembling) sit alongside this one — same
|
|
17
|
+
* `AgentStrategy` interface, different control flow.
|
|
18
|
+
*/
|
|
19
|
+
import type { AgentStrategy, ReflexionConfig } from './types/strategy.js';
|
|
20
|
+
interface ReactLoopOptions {
|
|
21
|
+
/** Cap on loop iterations to avoid runaway tool-call ping-pong. Default 24. */
|
|
22
|
+
maxTurns?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Opt-in: when `true`, tool calls produced in a single turn are partitioned
|
|
25
|
+
* by the handler's `parallelSafe` tag. Parallel-safe calls run concurrently
|
|
26
|
+
* with `Promise.all`; the remaining (mutation) calls run sequentially after
|
|
27
|
+
* the parallel group settles. Result yield order and `messages` order are
|
|
28
|
+
* preserved in the original input order, so the trace and next-turn prompt
|
|
29
|
+
* are byte-for-byte identical to a sequential run — the only observable
|
|
30
|
+
* difference is wall-clock.
|
|
31
|
+
*
|
|
32
|
+
* Defaults to `false` (current behavior: every call serialised).
|
|
33
|
+
*/
|
|
34
|
+
parallelDispatch?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Opt-in critique-and-retry pass after a candidate final-answer turn.
|
|
37
|
+
* See `ReflexionConfig` for the verdict shape and the retry/exhaust
|
|
38
|
+
* semantics. When absent or `enabled: false`, behavior is byte-for-byte
|
|
39
|
+
* identical to the pre-reflexion loop.
|
|
40
|
+
*/
|
|
41
|
+
reflexion?: ReflexionConfig;
|
|
42
|
+
}
|
|
43
|
+
export declare function createReactLoopStrategy(options?: ReactLoopOptions): AgentStrategy;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAGhB,MAAM,qBAAqB,CAAC;AAG7B,UAAU,gBAAgB;IACxB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAKD,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,gBAAqB,GAAG,aAAa,CAuarF"}
|