@stalfh233/omc-cli 0.6.47 → 0.6.50
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/capability-overview.js +114 -1
- package/dist/cli-stdout.js +3 -0
- package/dist/cli.js +318 -62
- package/dist/closest-match.js +22 -3
- package/dist/command-transport.js +5 -1
- package/dist/discovery.js +193 -75
- package/dist/goal-plan.js +1296 -0
- package/dist/goal-routes.js +87 -5
- package/dist/graph.js +223 -34
- package/dist/intent/capabilities/field.js +24 -0
- package/dist/intent/plan-apply.js +10 -3
- package/dist/intent/schema.js +24 -1
- package/dist/lanes/app.js +4 -0
- package/dist/lanes/apply-changes.js +1 -0
- package/dist/lanes/b2-registration.js +24 -0
- package/dist/lanes/businessrule.js +14 -0
- package/dist/lanes/custom-page.js +8 -0
- package/dist/lanes/datarule.js +4 -0
- package/dist/lanes/dictionary.js +13 -0
- package/dist/lanes/environment.js +2 -0
- package/dist/lanes/field.js +5 -0
- package/dist/lanes/folder.js +4 -0
- package/dist/lanes/form.js +5 -0
- package/dist/lanes/list-view-contract.js +1 -1
- package/dist/lanes/list-view.js +5 -0
- package/dist/lanes/meta.js +5 -0
- package/dist/lanes/model.js +9 -0
- package/dist/lanes/online-js.js +2 -0
- package/dist/lanes/organization.js +20 -0
- package/dist/lanes/perm.js +5 -5
- package/dist/lanes/programming.js +6 -0
- package/dist/lanes/report.js +9 -0
- package/dist/lanes/rule-lifecycle.js +6 -0
- package/dist/lanes/rulelog.js +1 -0
- package/dist/lanes/runtime-data.js +39 -1
- package/dist/lanes/workflow.js +18 -0
- package/dist/mcp-graph.js +180 -41
- package/dist/package-tool.js +1 -0
- package/dist/recipes/workflow.js +1 -1
- package/dist/search-index.js +137 -0
- package/dist/tool-search.js +647 -0
- package/dist/tool-types.js +6 -0
- package/dist/tools.js +1 -0
- package/dist/write.js +2 -1
- package/docs/omc-introduction.md +5 -7
- package/package.json +6 -5
- package/skills/omc-business-configuration.md +2 -1
- package/skills/omc-capabilities.md +4 -2
- package/skills/omc-start-here.md +21 -7
- package/skills/omc-tool-selection.md +7 -15
- package/skills/omc-write-hazards.md +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { loadCoverageManifest } from "./coverage.js";
|
|
2
|
+
import { closestMatches } from "./closest-match.js";
|
|
2
3
|
import { INTENT_CAPABILITIES } from "./intent/capabilities/index.js";
|
|
3
4
|
import { LANES } from "./lanes/lane-ids.js";
|
|
4
5
|
import { listSkills } from "./skills.js";
|
|
@@ -215,6 +216,39 @@ const CAPABILITY_ALIASES = Object.freeze({
|
|
|
215
216
|
report: ["reports", "R1-report"],
|
|
216
217
|
data: ["runtime-data", "M2-runtime-data"],
|
|
217
218
|
});
|
|
219
|
+
/**
|
|
220
|
+
* r59 Step 1 — scenario phrases for `commands --filter` ONLY.
|
|
221
|
+
*
|
|
222
|
+
* `filterTools` used to match only tool name / capability id / alias substrings,
|
|
223
|
+
* and the aliases are English registration ids(`bizservices B2-registration`).
|
|
224
|
+
* The CJK requirement words live in `CAPABILITY_CUES`, which serves `next` — so
|
|
225
|
+
* a requirement stated the way a user says it(「对接外部系统」「连数据库取数」)
|
|
226
|
+
* matched nothing even though the capability exists (r59: 0/168 for five real
|
|
227
|
+
* asks). These authored phrases close that gap through a controlled reverse
|
|
228
|
+
* match, `query.includes(phrase)`.
|
|
229
|
+
*
|
|
230
|
+
* Deliberately NOT projected into any stdout surface: the bare catalogue runs
|
|
231
|
+
* within ~15 B of its byte ceiling (`commands --json` ≤ 29,950 B), so adding a
|
|
232
|
+
* field to the inventory/capability projection would break the budget. `next`
|
|
233
|
+
* keeps consuming `CAPABILITY_CUES` unchanged — those cues carry historical
|
|
234
|
+
* regression tuning (bare 「自动」, 部门/组织 competition) and are not derived
|
|
235
|
+
* from this table.
|
|
236
|
+
*/
|
|
237
|
+
export const CAPABILITY_SCENARIOS = Object.freeze({
|
|
238
|
+
model: ["新建模型", "建模"],
|
|
239
|
+
// P7(加字段)是 composer 的业务,但 `--filter` 只搜工具注册表;登记场景短语让它
|
|
240
|
+
// 落到 field 能力(composer 路由仍由 `omc next` 负责,两边不互相派生)。
|
|
241
|
+
field: ["加字段", "新增字段", "子表字段"],
|
|
242
|
+
datarule: ["字段级校验", "提交校验", "条件必填", "显示规则", "字段级规则"],
|
|
243
|
+
workflow: ["配审批流", "审批流", "审批流程", "流程模板", "审批节点"],
|
|
244
|
+
// 「BIZ_ACTION 绑定」「在线 JS 调用」「DATA_SQL 数据源」是业务集成的三种真实用法,
|
|
245
|
+
// 加上出站/回调与跨系统同步(r59 B4 的长句走「同步到另一个系统」这一条)。
|
|
246
|
+
bizservice: ["对接", "对接外部系统", "调用别人家的接口", "调用第三方接口", "调用外部接口",
|
|
247
|
+
"注册接口给业务规则用", "注册二开接口给业务规则调用", "注册接口给在线JS调用",
|
|
248
|
+
"连数据库取数", "配SQL数据源", "把数据推送到别的系统", "同步到另一个系统", "同步到别的系统",
|
|
249
|
+
"回调", "外部系统回调我们"],
|
|
250
|
+
data: ["造数据", "录数据"],
|
|
251
|
+
});
|
|
218
252
|
/**
|
|
219
253
|
* Requirement cues per capability (round 3): the Chinese phrases a requirement
|
|
220
254
|
* is likely to use for this capability. Authored next to the capability id so
|
|
@@ -225,7 +259,7 @@ const CAPABILITY_ALIASES = Object.freeze({
|
|
|
225
259
|
*/
|
|
226
260
|
export const CAPABILITY_CUES = Object.freeze({
|
|
227
261
|
environment: ["环境", "指纹", "版本", "连接", "登录", "就绪", "发现"],
|
|
228
|
-
app: ["应用", "门户"
|
|
262
|
+
app: ["应用", "门户"],
|
|
229
263
|
dictionary: ["字典", "选项来源", "选项", "键值", "树型"],
|
|
230
264
|
model: ["模型", "对象", "主数据", "物理删除", "汇总表", "统计表", "汇总对象", "月度汇总表", "汇总模型"],
|
|
231
265
|
field: ["字段", "属性", "子表", "明细", "下拉", "单选", "多选", "附件", "人员", "部门", "日期", "数值", "文本", "关联", "公式", "计算", "计算字段", "求和", "汇总", "合计", "回主表", "超链接", "地址", "单据号", "流水号", "编号自动生成", "表单层", "必填", "只读", "条件必填", "恒必填", "条件只读", "恒只读", "表单必填", "表单只读"],
|
|
@@ -496,6 +530,51 @@ export function capabilityRouteForTool(registry, toolName) {
|
|
|
496
530
|
const tool = registry.find((entry) => entry.name === toolName);
|
|
497
531
|
return tool?.lane === undefined ? undefined : capabilityRouteForLane(registry, tool.lane);
|
|
498
532
|
}
|
|
533
|
+
/**
|
|
534
|
+
* r59 Step 1 — zero-hit `commands --filter` candidates at CAPABILITY level.
|
|
535
|
+
*
|
|
536
|
+
* The old fallback ran closest-match over TOOL NAMES, so an unmet requirement
|
|
537
|
+
* (「把数据同步到另一个系统」)was answered with app.create/app.delete/app.list —
|
|
538
|
+
* tool names that share no intent with the ask. Candidates are now the
|
|
539
|
+
* capabilities themselves (title / alias / scenario phrases), each carrying the
|
|
540
|
+
* exact `--filter <id>` command that expands that capability's tools.
|
|
541
|
+
*/
|
|
542
|
+
export function capabilityCandidatesFor(registry, query, limit = 3) {
|
|
543
|
+
const byPhrase = new Map();
|
|
544
|
+
for (const route of capabilityRoutes(registry)) {
|
|
545
|
+
for (const phrase of [route.title, ...route.aliases, ...(CAPABILITY_SCENARIOS[route.id] ?? [])]) {
|
|
546
|
+
if (!byPhrase.has(phrase))
|
|
547
|
+
byPhrase.set(phrase, route);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
const seen = new Set();
|
|
551
|
+
const candidates = [];
|
|
552
|
+
// closestMatches falls back to "可能不相关" least-bad names when NOTHING is
|
|
553
|
+
// close; at capability level that is noise("≈12" against every phrase). Drop
|
|
554
|
+
// those and answer with one honest pointer instead.
|
|
555
|
+
const closeHits = closestMatches(query, [...byPhrase.keys()], limit * 6).filter((hit) => !hit.reason.includes("可能不相关"));
|
|
556
|
+
for (const hit of closeHits) {
|
|
557
|
+
const route = byPhrase.get(hit.name);
|
|
558
|
+
if (route === undefined || seen.has(route.id))
|
|
559
|
+
continue;
|
|
560
|
+
seen.add(route.id);
|
|
561
|
+
candidates.push({
|
|
562
|
+
name: route.id,
|
|
563
|
+
reason: `${route.title}:${hit.reason}`,
|
|
564
|
+
next: `omc commands --json --filter ${route.id}`,
|
|
565
|
+
});
|
|
566
|
+
if (candidates.length >= limit)
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
if (candidates.length === 0) {
|
|
570
|
+
candidates.push({
|
|
571
|
+
name: "capabilities",
|
|
572
|
+
reason: `没有能力短语接近 "${query.trim()}":这是能力检索,不是工具名近似;先看 18 个能力总览再选词`,
|
|
573
|
+
next: "omc commands --json",
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
return candidates;
|
|
577
|
+
}
|
|
499
578
|
export function executableCapabilityBundle(registry, id) {
|
|
500
579
|
const resolvedId = resolveCapabilityId(id);
|
|
501
580
|
if (!resolvedId)
|
|
@@ -560,6 +639,18 @@ export function executableCapabilityBundle(registry, id) {
|
|
|
560
639
|
* node keeps only `id`. The capability id/lane/tools/order/coverage truth is
|
|
561
640
|
* unchanged; only the repetition is gone.
|
|
562
641
|
*/
|
|
642
|
+
/**
|
|
643
|
+
* `omc capabilities` — the capability overview, at three widths.
|
|
644
|
+
*
|
|
645
|
+
* r59 M2-3: the default was 8.9 KB of `{id,title,lane,aliases,tools,
|
|
646
|
+
* relatedTopics,requires,precedes,intent,coverage}` per capability — the whole
|
|
647
|
+
* projection before an agent knows which one it wants. The default is now an
|
|
648
|
+
* INDEX (id + tool count, ~0.8 KB); `--full` returns the old projection, and
|
|
649
|
+
* `--compact` keeps the mid-width shape (id/lane/intent/coverage/toolCount) it
|
|
650
|
+
* has had since HANDOFF §三.3-7, so existing callers do not move.
|
|
651
|
+
*
|
|
652
|
+
* `legacy` (OMC_LEGACY_DISCOVERY=1) restores the pre-M2 default exactly.
|
|
653
|
+
*/
|
|
563
654
|
export function compactCapabilities(registry, options = {}) {
|
|
564
655
|
const index = capabilityRouteIndex(registry);
|
|
565
656
|
// `--compact`(HANDOFF §三.3-7):默认面 ~8 KB,其中 `tools` 一项就占 ~3 KB。
|
|
@@ -567,6 +658,28 @@ export function compactCapabilities(registry, options = {}) {
|
|
|
567
658
|
// `omc capability <id>` 按需取。压缩档因此把 tools 换成 toolCount,并**明说**
|
|
568
659
|
// 省略了工具名,不让读者误以为该能力没有工具。
|
|
569
660
|
const compact = options.compact === true;
|
|
661
|
+
const full = options.full === true || options.legacy === true || compact;
|
|
662
|
+
if (!full) {
|
|
663
|
+
// Lean index. A single `id:toolCount` line instead of 18 objects: the
|
|
664
|
+
// decision this face answers is "which family do I need", and the family's
|
|
665
|
+
// tools are one command away (`omc commands --capability <id>`).
|
|
666
|
+
return {
|
|
667
|
+
status: "ok",
|
|
668
|
+
// Same two-field route as bare `commands` (ticket-07 pins the agreement).
|
|
669
|
+
// The seven-field authority block (~380 B) is a --full/--compact concern:
|
|
670
|
+
// a caller reading the index already knows where the authoritative copy
|
|
671
|
+
// lives, and this face must stay under 800 B.
|
|
672
|
+
discovery: { authoritative: DISCOVERY_AUTHORITY.authoritative, route: DISCOVERY_AUTHORITY.route },
|
|
673
|
+
capabilityCount: index.routes.length,
|
|
674
|
+
capabilities: index.routes.map((route) => `${route.id}:${route.tools.length}`).join(" "),
|
|
675
|
+
next: {
|
|
676
|
+
tools: "omc commands --capability <id>(工具名+brief+recipe id)",
|
|
677
|
+
detail: "omc capability <id>(依赖顺序/意图/覆盖)",
|
|
678
|
+
full: "omc capabilities --full(id/标题/别名/工具,~9KB)",
|
|
679
|
+
},
|
|
680
|
+
note: "默认面只有能力 id+工具数(省 ~8KB)",
|
|
681
|
+
};
|
|
682
|
+
}
|
|
570
683
|
return {
|
|
571
684
|
status: "ok",
|
|
572
685
|
discovery: DISCOVERY_AUTHORITY,
|
package/dist/cli-stdout.js
CHANGED
|
@@ -30,6 +30,9 @@ export const CLI_STDOUT_OWNERS = {
|
|
|
30
30
|
capabilities: "envelope",
|
|
31
31
|
capability: "envelope",
|
|
32
32
|
next: "envelope",
|
|
33
|
+
// r59 M3:只读规划;`--ndjson` 时输出 omc script 的输入行(与 script 同类,
|
|
34
|
+
// 但默认面仍是一个结果信封,所以主流程不得再补)。
|
|
35
|
+
plan: "envelope",
|
|
33
36
|
usage: "envelope",
|
|
34
37
|
intent: "envelope",
|
|
35
38
|
help: "envelope",
|