@stalfh233/omc-cli 0.6.86 → 0.6.88
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/batch-executor.js +236 -0
- package/dist/capability-overview.js +2 -2
- package/dist/cli.js +65 -14
- package/dist/discovery.js +50 -1
- package/dist/endpoints.js +16 -0
- package/dist/goal-plan.js +12 -0
- package/dist/goal-routes.js +20 -1
- package/dist/intent/capabilities/bizservice.js +368 -58
- package/dist/intent/compiler.js +11 -5
- package/dist/intent/plan-apply.js +22 -5
- package/dist/intent/plan-file.js +1 -0
- package/dist/intent/readback.js +78 -1
- package/dist/intent/schema.js +1 -1
- package/dist/lanes/apply-changes.js +134 -252
- package/dist/lanes/b2-registration.js +61 -5
- package/dist/lanes/businessrule-contract.js +2 -2
- package/dist/lanes/businessrule.js +167 -10
- package/dist/lanes/config-diff.js +9 -0
- package/dist/lanes/rule-lifecycle.js +37 -4
- package/dist/lanes/runtime-data-contract.js +6 -1
- package/dist/lanes/runtime-data.js +375 -121
- package/dist/lanes/runtime-paging.js +100 -0
- package/dist/package.js +8 -2
- package/dist/path-projection.js +120 -37
- package/dist/read-shapes.js +55 -10
- package/dist/rollback.js +71 -20
- package/dist/rule-support.js +43 -1
- package/dist/service-support.js +57 -0
- package/dist/surface-ref.js +37 -0
- package/dist/tool-types.js +5 -0
- package/dist/write.js +5 -1
- package/package.json +3 -3
- package/skills/omc-capabilities.md +1 -1
- package/skills/omc-refusals.md +1 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
import { appendJournalEntry } from "./journal.js";
|
|
4
|
+
import { journalAudit } from "./write-audit.js";
|
|
5
|
+
import { isUncertainWireError, wireErrorKind, writeArtifact } from "./support.js";
|
|
6
|
+
import { WireError } from "./wire.js";
|
|
7
|
+
import { ToolRefusalError } from "./tool-types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Ticket 58: the batch time budget. `startedAt` is the execution start (ms
|
|
10
|
+
* epoch); `budgetMs` undefined means no budget. Exported so the arithmetic is
|
|
11
|
+
* pinned by a unit test instead of a timing-sensitive S1 test.
|
|
12
|
+
*/
|
|
13
|
+
export function batchBudgetExceeded(startedAt, budgetMs, now) {
|
|
14
|
+
if (budgetMs === undefined)
|
|
15
|
+
return false;
|
|
16
|
+
return now - startedAt >= budgetMs;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The default whole-batch time budget (8 minutes), applied when the caller
|
|
20
|
+
* omits `totalTimeoutMs`. It MUST stay safely below the CLI's own call timeout:
|
|
21
|
+
* the omc CLI caps `--timeout-ms` at 600000 ms (10 min), and the 2026-09-14
|
|
22
|
+
* `eq_repair_record` incident was exactly the failure mode of a batch that
|
|
23
|
+
* outlives its caller — the caller abandoned at its timeout while the batch
|
|
24
|
+
* kept executing, and the agent's retry became a second writer in the same
|
|
25
|
+
* environment. Stopping at a bounded budget returns a clean `uncertain` +
|
|
26
|
+
* progressFile + resumeFromIndex while the caller is still listening.
|
|
27
|
+
*/
|
|
28
|
+
export const DEFAULT_BATCH_BUDGET_MS = 8 * 60 * 1000;
|
|
29
|
+
export async function executeGovernedBatch(input) {
|
|
30
|
+
const { changes, mode, runTool } = input;
|
|
31
|
+
const rollback = mode === "rollback";
|
|
32
|
+
const steps = [];
|
|
33
|
+
// Ticket 58: a recoverable handle for a long batch. Every step appends to one
|
|
34
|
+
// progress artifact, so a client-side timeout or a killed server still leaves
|
|
35
|
+
// the exact progress on disk.
|
|
36
|
+
const runId = randomUUID().slice(0, 8);
|
|
37
|
+
const startedAt = Date.now();
|
|
38
|
+
const budgetMs = input.timeoutMs ?? DEFAULT_BATCH_BUDGET_MS;
|
|
39
|
+
const summaryEcho = input.summary !== undefined && input.summary.length > 0 ? `${input.summary};` : "";
|
|
40
|
+
const progressPlan = input.progress;
|
|
41
|
+
const recordProgress = progressPlan !== undefined
|
|
42
|
+
? (status, upTo) => writeArtifact(progressPlan.ctx, `${rollback ? "rollback" : "batch"}-progress-${runId}.json`, {
|
|
43
|
+
runId,
|
|
44
|
+
summary: progressPlan.summary,
|
|
45
|
+
startedAt,
|
|
46
|
+
budgetMs: budgetMs ?? null,
|
|
47
|
+
steps,
|
|
48
|
+
nextIndex: upTo,
|
|
49
|
+
status,
|
|
50
|
+
}).detailFile
|
|
51
|
+
: undefined;
|
|
52
|
+
const withProgress = (envelope, progressFile) => progressFile !== undefined ? { ...envelope, progressFile } : { ...envelope };
|
|
53
|
+
for (let index = 0; index < changes.length; index += 1) {
|
|
54
|
+
const change = changes[index];
|
|
55
|
+
const stop = (status, envelope) => {
|
|
56
|
+
input.onStep?.({ index, tool: change.tool, ok: false, steps: [...steps] });
|
|
57
|
+
return { kind: "stop", outcome: { status, steps, failedStep: { index, tool: change.tool }, envelope } };
|
|
58
|
+
};
|
|
59
|
+
if (batchBudgetExceeded(startedAt, budgetMs, Date.now())) {
|
|
60
|
+
const progressFile = recordProgress?.("STOPPED", steps.length);
|
|
61
|
+
const envelope = withProgress({
|
|
62
|
+
blocker: "batch-timeout-budget",
|
|
63
|
+
frozen: true,
|
|
64
|
+
budgetMs,
|
|
65
|
+
message: rollback
|
|
66
|
+
? `已达恢复批预算 ${budgetMs}ms,在第 ${index + 1} 步(${change.tool})前停止;已完成 ${steps.length} 项恢复(其效果真实存在,各自已记 journal)。先读 progressFile 与 omc rollback list 核对进度,再对剩余恢复调用决定续跑——绝不盲重试`
|
|
67
|
+
: `已达整批预算 ${budgetMs}ms,在第 ${index + 1} 步(${change.tool})前停止;已完成 ${steps.length} 项(其效果真实存在)。先读 progressFile 与只读发现确认进度,再决定是否续跑——绝不盲重试`,
|
|
68
|
+
summary: rollback
|
|
69
|
+
? `${summaryEcho}恢复批达预算停止于第 ${index + 1} 步前,已完成 ${steps.length} 项`
|
|
70
|
+
: `${summaryEcho}批量达预算停止于第 ${index + 1} 步前,已完成 ${steps.length} 项`,
|
|
71
|
+
// Ticket 81: structured recovery semantics — a timeout is NOT
|
|
72
|
+
// failure; the server may have completed everything.
|
|
73
|
+
nextAction: {
|
|
74
|
+
rule: "read-back-first",
|
|
75
|
+
steps: rollback
|
|
76
|
+
? [
|
|
77
|
+
"读 progressFile:拿到已完成恢复步骤清单(其效果真实存在,各自已记 journal)",
|
|
78
|
+
"用 omc rollback list / plan 核对每个已完成恢复写的现态",
|
|
79
|
+
`仅对缺失的恢复调用继续:从 failedStep.index=${index} 起对原 seq 重新 rollback apply(先 plan 复看 inverse 全集,剔除读回确认已生效的步骤)`,
|
|
80
|
+
]
|
|
81
|
+
: [
|
|
82
|
+
"读 progressFile:拿到已完成步骤清单(其效果真实存在于环境)",
|
|
83
|
+
"用只读发现核对每一步的权威面(discover_environment / 对应 lane 的 list/get 读回;写工具的 already-present/already-published 短路可安全复用)",
|
|
84
|
+
`仅对缺失步骤重新组包:从 failedStep.index=${index} 起,剔除读回确认已生效的项`,
|
|
85
|
+
],
|
|
86
|
+
forbidden: rollback
|
|
87
|
+
? "盲目整批重试——已完成的恢复写重复执行会覆盖后续变更或触发重复码拒绝"
|
|
88
|
+
: "盲目整批重试——已完成步骤会重复执行或触发重复码拒绝(如 listview.create 303002)",
|
|
89
|
+
resumeFromIndex: index,
|
|
90
|
+
},
|
|
91
|
+
}, progressFile);
|
|
92
|
+
return stop("uncertain", envelope);
|
|
93
|
+
}
|
|
94
|
+
let run;
|
|
95
|
+
try {
|
|
96
|
+
run = await runTool(change, index);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
const failedStep = { index, tool: change.tool };
|
|
100
|
+
const progressFile = recordProgress?.("STOPPED", steps.length);
|
|
101
|
+
if (isUncertainWireError(error)) {
|
|
102
|
+
// Per-step transport/timeout: uncertain, frozen — never success.
|
|
103
|
+
return stop("uncertain", withProgress({
|
|
104
|
+
frozen: true,
|
|
105
|
+
reason: `wire-transport:${wireErrorKind(error)}`,
|
|
106
|
+
detail: error.message,
|
|
107
|
+
message: rollback
|
|
108
|
+
? `第 ${index + 1} 步恢复调用(${change.tool})传输中断,恢复结果无法判定;已冻结——先重新发现再决定重试,绝不假定为成功`
|
|
109
|
+
: `第 ${index + 1} 步(${change.tool})传输中断,写入结果无法判定;已冻结——先重新发现再决定重试,绝不假定为成功`,
|
|
110
|
+
summary: rollback
|
|
111
|
+
? `${summaryEcho}恢复批在第 ${index + 1} 步(${change.tool})中断,已完成 ${steps.length} 项,结果不确定`
|
|
112
|
+
: `${summaryEcho}批量在第 ${index + 1} 步(${change.tool})中断,已完成 ${steps.length} 项,结果不确定`,
|
|
113
|
+
// Ticket 81: the interrupted step itself may have taken
|
|
114
|
+
// effect server-side — read back before any retry.
|
|
115
|
+
nextAction: {
|
|
116
|
+
rule: "read-back-first",
|
|
117
|
+
steps: rollback
|
|
118
|
+
? [
|
|
119
|
+
"读 progressFile:拿到已完成恢复步骤清单(其效果真实存在,各自已记 journal)",
|
|
120
|
+
`先核对第 ${index + 1} 步恢复调用(${change.tool})本身是否已生效——超时≠失败,服务端可能已写入`,
|
|
121
|
+
"用 omc rollback list / plan 核对每个已完成恢复写,仅对缺失步骤对原 seq 重新 rollback apply",
|
|
122
|
+
]
|
|
123
|
+
: [
|
|
124
|
+
"读 progressFile:拿到已完成步骤清单(其效果真实存在于环境)",
|
|
125
|
+
`先核对第 ${index + 1} 步(${change.tool})本身是否已生效——超时≠失败,服务端可能已写入`,
|
|
126
|
+
"用只读发现核对每一步的权威面,仅对缺失步骤重新组包执行",
|
|
127
|
+
],
|
|
128
|
+
forbidden: rollback
|
|
129
|
+
? "盲目整批重试或假定中断步骤失败——重复执行会覆盖后续变更"
|
|
130
|
+
: "盲目整批重试或假定中断步骤失败——重复执行会撞重复码(如 listview.create 303002)",
|
|
131
|
+
resumeFromIndex: index,
|
|
132
|
+
},
|
|
133
|
+
}, progressFile));
|
|
134
|
+
}
|
|
135
|
+
const envelope = error instanceof ToolRefusalError
|
|
136
|
+
? { ...error.payload }
|
|
137
|
+
: error instanceof WireError
|
|
138
|
+
? { blocker: `wire-${error.kind}`, errcode: error.errcode, message: error.message }
|
|
139
|
+
: { blocker: rollback ? "rollback-step-failed" : "apply-changes-step-failed", message: error.message };
|
|
140
|
+
return stop("refused", withProgress({
|
|
141
|
+
...envelope,
|
|
142
|
+
message: rollback
|
|
143
|
+
? `${typeof envelope.message === "string" ? envelope.message : "恢复调用失败"};恢复批在第 ${index + 1} 步(${change.tool})停止,后续恢复调用未执行;已完成恢复见 steps(其效果真实存在,各自已记 journal)`
|
|
144
|
+
: `${typeof envelope.message === "string" ? envelope.message : "步骤失败"};批量在第 ${index + 1} 步(${change.tool})停止,后续步骤未执行;已完成步骤见 steps(其效果真实存在,需要善后时按 steps 清单处理)`,
|
|
145
|
+
summary: rollback
|
|
146
|
+
? `${summaryEcho}恢复批在第 ${index + 1} 步(${change.tool})停止,已完成 ${steps.length} 项`
|
|
147
|
+
: `${summaryEcho}批量在第 ${index + 1} 步(${change.tool})停止,已完成 ${steps.length} 项`,
|
|
148
|
+
}, progressFile));
|
|
149
|
+
}
|
|
150
|
+
if (run.kind === "stop") {
|
|
151
|
+
// A step-chain write (field.update cascadeRepublish) may RETURN a
|
|
152
|
+
// mid-chain stop instead of throwing, and a rollback replay call may
|
|
153
|
+
// settle non-zero: surface it as this batch's stop with the entry
|
|
154
|
+
// face's own envelope preserved for audit.
|
|
155
|
+
const progressFile = recordProgress?.("STOPPED", steps.length);
|
|
156
|
+
const envelope = rollback
|
|
157
|
+
? withProgress({
|
|
158
|
+
...run.envelope,
|
|
159
|
+
nextAction: {
|
|
160
|
+
rule: "read-back-first",
|
|
161
|
+
steps: [
|
|
162
|
+
"读 progressFile:拿到已完成恢复步骤清单(其效果真实存在,各自已记 journal)",
|
|
163
|
+
"用 omc rollback list / plan 核对每个已完成恢复写的现态",
|
|
164
|
+
`缺失的恢复从 failedStep.index=${index} 起对原 seq 重新 rollback apply(先 plan 复看 inverse 全集)`,
|
|
165
|
+
],
|
|
166
|
+
forbidden: "把 stopped 当作失败去回滚已完成的恢复写——它们已是目标态",
|
|
167
|
+
resumeFromIndex: index,
|
|
168
|
+
},
|
|
169
|
+
}, progressFile)
|
|
170
|
+
: withProgress({
|
|
171
|
+
...run.envelope,
|
|
172
|
+
message: `${String(run.envelope.message ?? "步骤失败")}(第 ${index + 1} 步 ${change.tool} 的内部级联中途停止)`,
|
|
173
|
+
}, progressFile);
|
|
174
|
+
return stop(run.status, envelope);
|
|
175
|
+
}
|
|
176
|
+
steps.push(run.step);
|
|
177
|
+
recordProgress?.("RUNNING", index + 1);
|
|
178
|
+
input.onStep?.({ index, tool: change.tool, ok: true, steps: [...steps] });
|
|
179
|
+
}
|
|
180
|
+
const progressFile = recordProgress?.("DONE", steps.length);
|
|
181
|
+
const stepTools = [...new Set(changes.map((change) => change.tool))];
|
|
182
|
+
return { kind: "ok", steps, stepTools, ...(progressFile !== undefined ? { progressFile } : {}) };
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* One honest journal line per delivered batch (audit only, not a rollback
|
|
186
|
+
* unit). Shared by apply_changes (and therefore intent apply, W11C) and
|
|
187
|
+
* rollback apply (B1): the line is `rollbackable:false` because the STEP-level
|
|
188
|
+
* before snapshots belong to the individual governed writes, not the batch —
|
|
189
|
+
* the batch line can never pretend to be a rollback unit. Delivered batches
|
|
190
|
+
* only; a stopped batch's audit lives in its per-step journal lines plus the
|
|
191
|
+
* stop receipt (progressFile/package artifact), never a fake "delivered" row.
|
|
192
|
+
*
|
|
193
|
+
* The receipt is deliberately NOT extended by this helper (byte-for-byte
|
|
194
|
+
* stable for eval baselines): the audit line is discoverable with
|
|
195
|
+
* `omc rollback list --tool apply_changes` / `--tool rollback`.
|
|
196
|
+
*/
|
|
197
|
+
export async function appendBatchAuditLine(input) {
|
|
198
|
+
const { ctx, mode, steps } = input;
|
|
199
|
+
if (steps.length === 0)
|
|
200
|
+
return;
|
|
201
|
+
const tools = [...new Set(steps.map((step) => String(step.step ?? "?")))];
|
|
202
|
+
const rollback = mode === "rollback";
|
|
203
|
+
const target = `${rollback ? "rollback-batch" : "batch"}:${tools.slice(0, 3).join("+")}${tools.length > 3 ? `+${tools.length - 3}` : ""}`;
|
|
204
|
+
const summary = input.summary;
|
|
205
|
+
let environment = typeof input.environmentArg === "string" && input.environmentArg.length > 0 ? input.environmentArg : "local";
|
|
206
|
+
let environmentFingerprint = rollback ? "rollback-batch" : "batch";
|
|
207
|
+
try {
|
|
208
|
+
// The batch itself established this session: a cache hit, never a second login.
|
|
209
|
+
const session = await ctx.sessions.session(input.environmentArg);
|
|
210
|
+
environment = session.environmentName;
|
|
211
|
+
environmentFingerprint = session.environmentFingerprint();
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
/* journal still useful with the raw env name */
|
|
215
|
+
}
|
|
216
|
+
const rollbackOf = input.rollbackOf;
|
|
217
|
+
const note = rollback
|
|
218
|
+
? `恢复批审计行(${steps.length} 步:${tools.slice(0, 6).join("、")}${rollbackOf !== undefined ? `;回滚 seq ${rollbackOf.seq} 的 ${rollbackOf.tool} 写` : ""}${summary !== undefined ? `;${summary}` : ""}):本行只是汇总(rollbackable:false,不是回滚单元);逐步恢复写已各自记 journal——对单个恢复写 seq 再 plan/apply`
|
|
219
|
+
: `批量审计行(${steps.length} 步:${tools.slice(0, 6).join("、")}${summary !== undefined ? `;${summary}` : ""}):逐步 before 快照未捕获,不能整包回滚;逐项恢复请用对应单工具写面重做`;
|
|
220
|
+
const entry = appendJournalEntry(ctx.artifactsDir, {
|
|
221
|
+
v: 1,
|
|
222
|
+
environment,
|
|
223
|
+
environmentFingerprint,
|
|
224
|
+
tool: rollback ? "rollback.apply" : "apply_changes",
|
|
225
|
+
target,
|
|
226
|
+
beforeSha: null,
|
|
227
|
+
rollbackable: false,
|
|
228
|
+
note,
|
|
229
|
+
...journalAudit(ctx.sessions.config(), environment, input.reason),
|
|
230
|
+
artifactFile: input.progressFile ?? `${target.replace(/[^\w.-]+/gu, "_")}.batch.json`,
|
|
231
|
+
artifactId: input.progressFile !== undefined ? basename(input.progressFile) : rollback ? "rollback.apply-batch" : "apply_changes-batch",
|
|
232
|
+
artifactSha: typeof input.fingerprint === "string" ? input.fingerprint : "batch",
|
|
233
|
+
});
|
|
234
|
+
void entry;
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=batch-executor.js.map
|
|
@@ -172,9 +172,9 @@ const SURFACES = [
|
|
|
172
172
|
title: "业务集成",
|
|
173
173
|
lane: LANES.b2,
|
|
174
174
|
description: "业务服务与方法注册(RESTFUL/DATA_SQL/DATA_TABLE/SAP/KAFKA/SOAP)、服务清单(按分类/关键词,凭据不回显)、导入导出、设计器测试、调用日志(h_log_biz_service 读面:params/result/状态/耗时)。",
|
|
175
|
-
operations: ["list", "register", "update", "method.create", "method.update", "delete", "export", "import", "check", "test", "log"],
|
|
175
|
+
operations: ["list", "register", "update", "method.create", "method.update", "method.delete", "delete", "export", "import", "check", "test", "log"],
|
|
176
176
|
requires: [],
|
|
177
|
-
intent: { level: "partial", note: "
|
|
177
|
+
intent: { level: "partial", note: "声明式支持 service.register(可带一个 method 或 methods[] 多方法,后者 name 可不同于 code)、既有 service/method 的 update、给既有服务加方法(method.create),以及 service/methods[].absent:true 删除(服务删除有引用硬门 intent-service-referenced;方法删除以平台 500108 为权威,plan 给 warning);分类/连接池/IE 仍走 escape hatch。" },
|
|
178
178
|
notes: "方法 configJson 走 AES-128-ECB;RESTFUL/DATA_SQL 绑定前须带适配器必需配置(否则是注册壳)。",
|
|
179
179
|
},
|
|
180
180
|
{
|
package/dist/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ import { artifactFetchHint, artifactRoot, boundResult, emitInvalid, emitResult,
|
|
|
26
26
|
import { CLI_DEFAULT_OUTPUT_BYTES, assertSafeOutputPath, pruneArtifacts } from "./artifacts.js";
|
|
27
27
|
import { sessionAccountForEnvironment } from "./session-account.js";
|
|
28
28
|
import { closeWritableWindow, openWritableWindow, parseWritableTtl, sweepWritableWindowsAtStartup, validateWritableReason, writableWindowStatus, WRITABLE_WINDOW_DEFAULT_TTL_MINUTES, WRITABLE_WINDOW_LOG, WRITABLE_WINDOW_MAX_TTL_MINUTES, WritableWindowInputError } from "./writable-window.js";
|
|
29
|
-
import { artifactPathMissHint, nullProjectionHint, partialPathMissHint, pathMissCopyableHint, pathMissDidYouMean, projectJsonPath, projectJsonPathFanout, projectResultExtract, shapeOf, SHAPE_MAX_DEPTH, unwrapSinglePathProjection } from "./path-projection.js";
|
|
29
|
+
import { artifactPathMissHint, nullProjectionHint, PATH_MISS_HELP_REF, partialPathMissHint, pathMissCopyableHint, pathMissCopyablePaths, pathMissCrossFaceCorrection, pathMissDidYouMean, projectJsonPath, projectJsonPathFanout, projectResultExtract, shapeOf, SHAPE_MAX_DEPTH, unwrapSinglePathProjection } from "./path-projection.js";
|
|
30
30
|
import { basename, join, resolve } from "node:path";
|
|
31
31
|
import { existsSync, readFileSync, writeFileSync, chmodSync } from "node:fs";
|
|
32
32
|
import { buildToolRegistry } from "./tools.js";
|
|
@@ -49,6 +49,8 @@ else if (process.env.OMC_ASCII_STDOUT !== "0" && process.argv.some((arg) => arg
|
|
|
49
49
|
}
|
|
50
50
|
import { SEARCH_MARGIN_THRESHOLD } from "./tool-search.js";
|
|
51
51
|
import { commandCapabilitySlice, commandIndex, commandInventory, commandKindIndex, describeContract, describeContractFull, describeContractTool, describeExample, describeParam, describeSchemaOnly, describeTool, describeToolFull, filterTools } from "./discovery.js";
|
|
52
|
+
import { locatorMetaFor } from "./read-shapes.js";
|
|
53
|
+
import { surfaceRefFor } from "./surface-ref.js";
|
|
52
54
|
import { closestMatches } from "./closest-match.js";
|
|
53
55
|
import { KEY_ALIAS_HINTS, inputAliasSynonymKeys } from "./tool-types.js";
|
|
54
56
|
import { repeatFullDescribe } from "./describe-cache.js";
|
|
@@ -491,7 +493,7 @@ async function cmdBatchCall(store, toolName, rawList, options) {
|
|
|
491
493
|
.flatMap((path) => path.split(",")).map((path) => path.trim()).filter(Boolean);
|
|
492
494
|
const preflightKeys = options.args.includes("--extract-keys") || options.args.includes("--keys") || options.args.some((token, index) => token === "--jq" && (options.args[index + 1] === undefined || options.args[index + 1].startsWith("--")));
|
|
493
495
|
if (preflightPaths.length > 0 || preflightKeys) {
|
|
494
|
-
const projected = projectResultExtract(result, preflightPaths, preflightKeys);
|
|
496
|
+
const projected = projectResultExtract(result, preflightPaths, preflightKeys, { tool: toolName, ...(options.environment !== undefined ? { environment: options.environment } : {}) });
|
|
495
497
|
if (projected !== undefined)
|
|
496
498
|
result = projected;
|
|
497
499
|
}
|
|
@@ -762,7 +764,15 @@ async function cmdCall(store, args) {
|
|
|
762
764
|
blocker: "tool-input-unknown-keys",
|
|
763
765
|
tool: toolName,
|
|
764
766
|
unknownKeys: otherUnknown,
|
|
767
|
+
// F1(retro 22,ticket 138):与写面同款机器字段——被拒键 + 合法键全集
|
|
768
|
+
// 成对给出;nextCommand 指向「最接近的合法键」的参数面(而非整份
|
|
769
|
+
// describe),脚本可零解析消费。
|
|
770
|
+
expectedKeys: [...schemaKeys],
|
|
765
771
|
suggestions,
|
|
772
|
+
// 有拼写近邻时直达该参数的 describe;否则退回整份参数表。
|
|
773
|
+
...(suggestions.some((entry) => entry.closest !== undefined)
|
|
774
|
+
? { nextCommand: `omc describe ${toolName} --param ${suggestions.find((entry) => entry.closest !== undefined).closest}` }
|
|
775
|
+
: { nextCommand: `omc describe ${toolName}` }),
|
|
766
776
|
message: `读面不接受未知键(与写面对齐):${pairs.join("、")}。` +
|
|
767
777
|
`改用合法键后重试;确需宽松忽略传 lenientArgs:true。参数表:omc describe ${toolName}`,
|
|
768
778
|
};
|
|
@@ -845,7 +855,14 @@ async function cmdCall(store, args) {
|
|
|
845
855
|
let unwrappedBody;
|
|
846
856
|
let resultMeta;
|
|
847
857
|
if (extractPaths.length > 0 || extractKeys) {
|
|
848
|
-
|
|
858
|
+
// F1(retro 22,ticket 138):把调用上下文交给投影层——pathMiss 能推导出
|
|
859
|
+
// correctPath 时,拼一条含 --env/--args/--jq 的完整可复制命令(nextCommand)。
|
|
860
|
+
// args 用调用方**原始** JSON(未归一化),>500B 时投影层放弃拼命令(不截断造假)。
|
|
861
|
+
const projected = projectResultExtract(result, extractPaths, extractKeys, {
|
|
862
|
+
tool: toolName,
|
|
863
|
+
...(environment !== undefined && environment.length > 0 ? { environment } : {}),
|
|
864
|
+
argsJson: rawArgs !== undefined ? rawArgs : JSON.stringify(parsedArgs),
|
|
865
|
+
});
|
|
849
866
|
if (projected !== undefined)
|
|
850
867
|
result = projected;
|
|
851
868
|
// Projected reads are represented by extract[] (and rows[] for multi-path).
|
|
@@ -920,9 +937,13 @@ async function cmdCall(store, args) {
|
|
|
920
937
|
// body 自带 `status`/`blocker` 时(如 --jq 直接取回整包),信封的 error 仍以
|
|
921
938
|
// **投影前**的 classified 为准——别让 payload 里的字段改写本调用的结论。
|
|
922
939
|
const emitValue = unwrappedBody !== undefined ? unwrappedBody : result;
|
|
940
|
+
// A2(r89 契约层):跨面键名对照(read-shapes 单一声明)挂信封 resultMeta.locator——
|
|
941
|
+
// 成功读回才有定位意义;result 本体与 --jq 路径零改动。
|
|
942
|
+
const locatorExtra = classified.status === "ok" ? locatorMetaFor(toolName) : undefined;
|
|
943
|
+
const mergedMeta = { ...(locatorExtra ?? {}), ...(resultMeta ?? {}) };
|
|
923
944
|
const extras = unwrappedBody !== undefined
|
|
924
|
-
? { error: classified.error, ...(
|
|
925
|
-
:
|
|
945
|
+
? { error: classified.error, ...(Object.keys(mergedMeta).length > 0 ? { resultMeta: mergedMeta } : {}) }
|
|
946
|
+
: Object.keys(mergedMeta).length > 0 ? { resultMeta: mergedMeta } : undefined;
|
|
926
947
|
return emit(classified.status, emitValue, classified.exitCode, extras);
|
|
927
948
|
}
|
|
928
949
|
finally {
|
|
@@ -1009,7 +1030,24 @@ function projectArtifactPath(value, path) {
|
|
|
1009
1030
|
const fanout = projectJsonPathFanout(value, path);
|
|
1010
1031
|
return fanout.missed
|
|
1011
1032
|
? { missed: true, ...(fanout.at !== undefined ? { at: fanout.at } : {}), ...(fanout.available !== undefined ? { available: fanout.available } : {}), ...(fanout.availableAll !== undefined ? { availableAll: fanout.availableAll } : {}), ...(fanout.availableTruncated !== undefined ? { availableTruncated: fanout.availableTruncated } : {}) }
|
|
1012
|
-
: { missed: false, content: fanout.values, mapped: fanout.values.length, ...(fanout.missedEntries > 0 ? { missedEntries: fanout.missedEntries } : {}), nullEntries: fanout.nullEntries };
|
|
1033
|
+
: { missed: false, content: fanout.values, mapped: fanout.values.length, ...(fanout.missedEntries > 0 ? { missedEntries: fanout.missedEntries } : {}), nullEntries: fanout.nullEntries, nonNullEntries: fanout.nonNullEntries };
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* F1/F2(retro 21/22,ticket 138):artifact 面 pathMiss 的机器可读纠错面——
|
|
1037
|
+
* `correctPath`(已验证可解析)+ `helpRef`(教程指针)+ 可整段复制的重跑命令。
|
|
1038
|
+
* 与 call 面(projectResultExtract)同一套推导(拼写近似走 didYouMean 字段,
|
|
1039
|
+
* 这里只补跨面改写与同名键两条**全路径**推导),推导不出就全部缺席(不编造)。
|
|
1040
|
+
*/
|
|
1041
|
+
function artifactMissCorrection(content, path, at, artifactId) {
|
|
1042
|
+
const correction = pathMissCrossFaceCorrection(content, path, at) ?? (() => {
|
|
1043
|
+
const copyable = pathMissCopyablePaths(content, path, at, 1);
|
|
1044
|
+
return copyable.length > 0 ? { correctPath: copyable[0] } : undefined;
|
|
1045
|
+
})();
|
|
1046
|
+
return {
|
|
1047
|
+
...(correction !== undefined ? { correctPath: correction.correctPath } : {}),
|
|
1048
|
+
helpRef: PATH_MISS_HELP_REF,
|
|
1049
|
+
...(correction !== undefined ? { nextCommand: `omc artifact get ${artifactId} --jq '${correction.correctPath.replace(/'/g, "'\\''")}'` } : {}),
|
|
1050
|
+
};
|
|
1013
1051
|
}
|
|
1014
1052
|
/** Preserve source completeness/count facts on every artifact projection. */
|
|
1015
1053
|
function artifactProjectionMetadata(value) {
|
|
@@ -1134,7 +1172,7 @@ async function cmdArtifactGet(id, transport, options = {}) {
|
|
|
1134
1172
|
// `--shape <path>`:在命中的子树上出骨架(同 --jq 的路径 DSL,含 [] 与 [code=X])。
|
|
1135
1173
|
const projected = projectArtifactPath(artifact.content.toString("utf8") === "" ? undefined : content, options.shape);
|
|
1136
1174
|
if (projected.missed) {
|
|
1137
|
-
return emitTransportResult({ status: "ok", artifactId: id, sha256: artifact.sha256, ...artifactProjectionMetadata(content), path: options.shape, content: null, pathMiss: true, missedAt: projected.at, available: projected.available, ...artifactMissExtras(projected), unanswered: true, hint: artifactPathMissHint(projected.at, pathMissCopyableHint(content, options.shape, projected.at)) }, transport);
|
|
1175
|
+
return emitTransportResult({ status: "ok", artifactId: id, sha256: artifact.sha256, ...artifactProjectionMetadata(content), path: options.shape, content: null, pathMiss: true, missedAt: projected.at, available: projected.available, ...artifactMissExtras(projected), unanswered: true, ...artifactMissCorrection(content, options.shape, projected.at, id), hint: artifactPathMissHint(projected.at, pathMissCopyableHint(content, options.shape, projected.at)) }, transport);
|
|
1138
1176
|
}
|
|
1139
1177
|
return emitTransportResult({ status: "ok", artifactId: id, sha256: artifact.sha256, bytes: artifact.content.length, path: options.shape, depth, shape: shapeOf(projected.content, depth), fetch: artifactFetchHint(id) }, transport);
|
|
1140
1178
|
}
|
|
@@ -1177,7 +1215,7 @@ async function cmdArtifactGet(id, transport, options = {}) {
|
|
|
1177
1215
|
// 一层 `projection:{path,content}`——`artifact get --jq` 与 `--summary --jq`
|
|
1178
1216
|
// 因此同形(顶层 path/content),换读面不用重新探根键。
|
|
1179
1217
|
return emitTransportResult(projected.missed
|
|
1180
|
-
? { status: "ok", artifactId: id, sha256: artifact.sha256, bytes: artifact.content.length, ...artifactProjectionMetadata(content), keys, path: options.jq, content: null, projections: [{ path: options.jq, content: null, pathMiss: true, missedAt: projected.at, available: projected.available, ...artifactMissExtras(projected) }], pathMiss: true, missedAt: projected.at, available: projected.available, ...artifactMissExtras(projected), unanswered: true, hint: artifactPathMissHint(projected.at, pathMissCopyableHint(content, options.jq, projected.at)) }
|
|
1218
|
+
? { status: "ok", artifactId: id, sha256: artifact.sha256, bytes: artifact.content.length, ...artifactProjectionMetadata(content), keys, path: options.jq, content: null, projections: [{ path: options.jq, content: null, pathMiss: true, missedAt: projected.at, available: projected.available, ...artifactMissExtras(projected) }], pathMiss: true, missedAt: projected.at, available: projected.available, ...artifactMissExtras(projected), unanswered: true, ...artifactMissCorrection(content, options.jq, projected.at, id), hint: artifactPathMissHint(projected.at, pathMissCopyableHint(content, options.jq, projected.at)) }
|
|
1181
1219
|
: {
|
|
1182
1220
|
status: "ok",
|
|
1183
1221
|
artifactId: id,
|
|
@@ -1186,9 +1224,10 @@ async function cmdArtifactGet(id, transport, options = {}) {
|
|
|
1186
1224
|
...artifactProjectionMetadata(content),
|
|
1187
1225
|
keys,
|
|
1188
1226
|
path: options.jq,
|
|
1189
|
-
projections: [{ path: options.jq, content: projected.content ?? null, ...(projected.mapped !== undefined ? { mapped: projected.mapped } : {}), ...(projected.missedEntries !== undefined ? { missedEntries: projected.missedEntries } : {}), ...(projected.nullEntries !== undefined && projected.nullEntries > 0 ? { nullEntries: projected.nullEntries } : {}) }],
|
|
1227
|
+
projections: [{ path: options.jq, content: projected.content ?? null, ...(projected.mapped !== undefined ? { mapped: projected.mapped } : {}), ...(projected.missedEntries !== undefined ? { missedEntries: projected.missedEntries } : {}), ...(projected.nullEntries !== undefined && projected.nullEntries > 0 ? { nullEntries: projected.nullEntries } : {}), ...(projected.nonNullEntries !== undefined ? { nonNullEntries: projected.nonNullEntries } : {}) }],
|
|
1190
1228
|
...(projected.mapped !== undefined ? { mapped: projected.mapped } : {}),
|
|
1191
1229
|
...(projected.nullEntries !== undefined && projected.nullEntries > 0 ? { nullEntries: projected.nullEntries } : {}),
|
|
1230
|
+
...(projected.nonNullEntries !== undefined ? { nonNullEntries: projected.nonNullEntries } : {}),
|
|
1192
1231
|
...(projected.missedEntries !== undefined ? { missedEntries: projected.missedEntries } : {}),
|
|
1193
1232
|
...(artifactNullHint(projected.content, projected.nullEntries) !== undefined ? { hint: artifactNullHint(projected.content, projected.nullEntries) } : {}),
|
|
1194
1233
|
}, transport);
|
|
@@ -1229,15 +1268,15 @@ async function cmdArtifactGet(id, transport, options = {}) {
|
|
|
1229
1268
|
const projections = jqPaths.map((path) => {
|
|
1230
1269
|
const projected = projectArtifactPath(artifactContent, path);
|
|
1231
1270
|
return projected.missed
|
|
1232
|
-
? { path, content: null, pathMiss: true, missedAt: projected.at, available: projected.available, ...artifactMissExtras(projected) }
|
|
1233
|
-
: { path, content: projected.content ?? null, ...(projected.mapped !== undefined ? { mapped: projected.mapped } : {}), ...(projected.missedEntries !== undefined ? { missedEntries: projected.missedEntries } : {}), ...(projected.nullEntries !== undefined && projected.nullEntries > 0 ? { nullEntries: projected.nullEntries } : {}), ...(artifactNullHint(projected.content, projected.nullEntries) !== undefined ? { hint: artifactNullHint(projected.content, projected.nullEntries) } : {}) };
|
|
1271
|
+
? { path, content: null, pathMiss: true, missedAt: projected.at, available: projected.available, ...artifactMissExtras(projected), ...artifactMissCorrection(artifactContent, path, projected.at, id) }
|
|
1272
|
+
: { path, content: projected.content ?? null, ...(projected.mapped !== undefined ? { mapped: projected.mapped } : {}), ...(projected.missedEntries !== undefined ? { missedEntries: projected.missedEntries } : {}), ...(projected.nullEntries !== undefined && projected.nullEntries > 0 ? { nullEntries: projected.nullEntries } : {}), ...(projected.nonNullEntries !== undefined ? { nonNullEntries: projected.nonNullEntries } : {}), ...(artifactNullHint(projected.content, projected.nullEntries) !== undefined ? { hint: artifactNullHint(projected.content, projected.nullEntries) } : {}) };
|
|
1234
1273
|
});
|
|
1235
1274
|
return emitTransportResult({ status: "ok", artifactId: id, sha256: artifact.sha256, ...artifactProjectionMetadata(content), projections, ...(projections.some((entry) => entry.pathMiss) ? { unanswered: true, hint: partialPathMissHint() } : {}) }, transport);
|
|
1236
1275
|
}
|
|
1237
1276
|
const projected = projectArtifactPath(artifactContent, options.jq);
|
|
1238
1277
|
return emitTransportResult(projected.missed
|
|
1239
|
-
? { status: "ok", artifactId: id, sha256: artifact.sha256, ...artifactProjectionMetadata(content), path: options.jq, content: null, pathMiss: true, missedAt: projected.at, available: projected.available, ...artifactMissExtras(projected), unanswered: true, hint: artifactPathMissHint(projected.at, pathMissCopyableHint(artifactContent, options.jq, projected.at)) }
|
|
1240
|
-
: { status: "ok", artifactId: id, sha256: artifact.sha256, ...artifactProjectionMetadata(content), path: options.jq, projections: [{ path: options.jq, content: projected.content ?? null, ...(projected.mapped !== undefined ? { mapped: projected.mapped } : {}), ...(projected.missedEntries !== undefined ? { missedEntries: projected.missedEntries } : {}), ...(projected.nullEntries !== undefined && projected.nullEntries > 0 ? { nullEntries: projected.nullEntries } : {}) }], ...(projected.mapped !== undefined ? { mapped: projected.mapped } : {}), ...(projected.missedEntries !== undefined ? { missedEntries: projected.missedEntries } : {}), ...(projected.nullEntries !== undefined && projected.nullEntries > 0 ? { nullEntries: projected.nullEntries } : {}), ...(artifactNullHint(projected.content, projected.nullEntries) !== undefined ? { hint: artifactNullHint(projected.content, projected.nullEntries) } : {}) }, transport);
|
|
1278
|
+
? { status: "ok", artifactId: id, sha256: artifact.sha256, ...artifactProjectionMetadata(content), path: options.jq, content: null, pathMiss: true, missedAt: projected.at, available: projected.available, ...artifactMissExtras(projected), unanswered: true, ...artifactMissCorrection(artifactContent, options.jq, projected.at, id), hint: artifactPathMissHint(projected.at, pathMissCopyableHint(artifactContent, options.jq, projected.at)) }
|
|
1279
|
+
: { status: "ok", artifactId: id, sha256: artifact.sha256, ...artifactProjectionMetadata(content), path: options.jq, projections: [{ path: options.jq, content: projected.content ?? null, ...(projected.mapped !== undefined ? { mapped: projected.mapped } : {}), ...(projected.missedEntries !== undefined ? { missedEntries: projected.missedEntries } : {}), ...(projected.nullEntries !== undefined && projected.nullEntries > 0 ? { nullEntries: projected.nullEntries } : {}), ...(projected.nonNullEntries !== undefined ? { nonNullEntries: projected.nonNullEntries } : {}) }], ...(projected.mapped !== undefined ? { mapped: projected.mapped } : {}), ...(projected.missedEntries !== undefined ? { missedEntries: projected.missedEntries } : {}), ...(projected.nullEntries !== undefined && projected.nullEntries > 0 ? { nullEntries: projected.nullEntries } : {}), ...(projected.nonNullEntries !== undefined ? { nonNullEntries: projected.nonNullEntries } : {}), ...(artifactNullHint(projected.content, projected.nullEntries) !== undefined ? { hint: artifactNullHint(projected.content, projected.nullEntries) } : {}) }, transport);
|
|
1241
1280
|
}
|
|
1242
1281
|
// r6-onboarding 2026-10-21: 47 artifact fetches, 0 used a projection; the 10
|
|
1243
1282
|
// large ones (up to 55 KB) pulled whole workflow templates just to read one
|
|
@@ -1652,6 +1691,18 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
1652
1691
|
if (semanticByName !== undefined)
|
|
1653
1692
|
for (const tool of inventory.tools)
|
|
1654
1693
|
tool.matchedVia = semanticByName.get(String(tool.name))?.via;
|
|
1694
|
+
// A3(r89 契约层):搜索命中后的结构化交接——非分组面 top1 附 surfaceRef
|
|
1695
|
+
// (firstCall/needs/returns/onRefusal 一次拿全,省 describe 一跳);top2/3 作
|
|
1696
|
+
// alternatives(when=命中信号)。宽词分组面行被隐藏,surfaceRef 挂了也看不见,
|
|
1697
|
+
// 只在 filtered.top 留名(原行为不变)。
|
|
1698
|
+
if (!groupedFace && scoped.length > 0) {
|
|
1699
|
+
const ref = surfaceRefFor(registry, scoped[0].name, {
|
|
1700
|
+
via: scoped[0].via,
|
|
1701
|
+
alternatives: scoped.slice(1, 3).map((hit) => ({ tool: hit.name, when: hit.via })),
|
|
1702
|
+
});
|
|
1703
|
+
if (ref !== undefined)
|
|
1704
|
+
inventory.surfaceRef = ref;
|
|
1705
|
+
}
|
|
1655
1706
|
// A filtered query wants tool rows, not the whole catalogue's discovery,
|
|
1656
1707
|
// skills, and intent prose. Keep only the authoritative route pointer.
|
|
1657
1708
|
delete inventory.skills;
|
|
@@ -3190,7 +3241,7 @@ async function main() {
|
|
|
3190
3241
|
script: { lines: lines.length, skipped: parsed.skipped.length },
|
|
3191
3242
|
}, 0);
|
|
3192
3243
|
});
|
|
3193
|
-
const rollbackCommand = command.command("rollback").description("配置回滚(git-revert 语义):list 列写时间线 / plan 预览恢复(diff+后续写覆盖警告)/ apply 执行恢复——恢复走完整写闸门并记 journal(回滚可再回滚)。list 支持 --since <ISO|30m|2h> 收窄窗口,并回显每行的 actor(token 解码,actorSource:token-claim,不是平台 currentUser)与 reason(写入时 --reason 声明);apply 支持 --reason 与 --wait <毫秒> 有界排队。list/plan 为只读面不接写锁。journal 是**项目级**审计面(.omc/journal/<env>.ndjson,随项目目录、本机边界:不跨机器、不跨项目;故意不做第二个 omc audit 真相源)。接入全部配置写面(workflow/规则/数据规则/视图/表单草稿/在线JS/字典/字段/模型/应用/报表)+ 批量写审计行(apply_changes/intent apply,rollbackable:false 只记录);publish 类生命周期推进不可逆(plan 会说明)");
|
|
3244
|
+
const rollbackCommand = command.command("rollback").description("配置回滚(git-revert 语义):list 列写时间线 / plan 预览恢复(diff+后续写覆盖警告)/ apply 执行恢复——恢复走完整写闸门并记 journal(回滚可再回滚)。list 支持 --since <ISO|30m|2h> 收窄窗口,并回显每行的 actor(token 解码,actorSource:token-claim,不是平台 currentUser)与 reason(写入时 --reason 声明);apply 支持 --reason 与 --wait <毫秒> 有界排队。list/plan 为只读面不接写锁。journal 是**项目级**审计面(.omc/journal/<env>.ndjson,随项目目录、本机边界:不跨机器、不跨项目;故意不做第二个 omc audit 真相源)。接入全部配置写面(workflow/规则/数据规则/视图/表单草稿/在线JS/字典/字段/模型/应用/报表)+ 批量写审计行(apply_changes/intent apply/rollback apply,rollbackable:false 只记录);publish 类生命周期推进不可逆(plan 会说明)");
|
|
3194
3245
|
rollbackCommand.command("list").option("--env <environment>").option("--environment <environment>").option("--target <substr>").option("--tool <name>").option("--limit <n>").option("--since <ISO|duration>", "只保留该时刻之后的写:ISO(2026-11-20T09:30Z)或带单位时长(30m、2h、7d);非法值即 invalid-input,不猜窗口").action(async (options) => {
|
|
3195
3246
|
commandExitCode = await withTransport(options, "rollback list", (transport) => cmdRollbackList({ environment: options.env ?? options.environment, target: options.target, tool: options.tool, limit: options.limit, since: options.since }, transport));
|
|
3196
3247
|
});
|
package/dist/discovery.js
CHANGED
|
@@ -230,6 +230,20 @@ export function commandCapabilitySlice(registry, capabilityId, options = {}) {
|
|
|
230
230
|
...(recipes.length > 0 ? { recipes } : {}),
|
|
231
231
|
};
|
|
232
232
|
}),
|
|
233
|
+
// A3(r89 契约层):族级 default 交接——本能力的读面起手工具(同 surfaceRef
|
|
234
|
+
// 结构的 recommended 切片,requiredArgs 同一实现;firstCall/needs/returns 等
|
|
235
|
+
// 完整面一步 `omc describe <tool>`,族面不整份复制)。
|
|
236
|
+
...(tools.length > 0
|
|
237
|
+
? {
|
|
238
|
+
surfaceRef: {
|
|
239
|
+
recommended: {
|
|
240
|
+
tool: (tools.find((tool) => tool.kind === "read") ?? tools[0]).name,
|
|
241
|
+
argsHint: requiredArgs(tools.find((tool) => tool.kind === "read") ?? tools[0]).join(","),
|
|
242
|
+
via: `${route.id} 能力读面起手`,
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
}
|
|
246
|
+
: {}),
|
|
233
247
|
next: {
|
|
234
248
|
detail: "omc describe <tool>(参数/必填/firstCall)",
|
|
235
249
|
executable: `omc capability ${route.id} --executable`,
|
|
@@ -441,7 +455,7 @@ function placeholderKeys(args) {
|
|
|
441
455
|
function trimPreconditions(preconditions) {
|
|
442
456
|
const kept = [];
|
|
443
457
|
let bytes = 0;
|
|
444
|
-
for (const entry of preconditions) {
|
|
458
|
+
for (const entry of preconditions ?? []) {
|
|
445
459
|
const next = bytes + Buffer.byteLength(entry, "utf8") + 4;
|
|
446
460
|
if (kept.length >= 3 || next > 420)
|
|
447
461
|
break;
|
|
@@ -663,6 +677,41 @@ function documentedParamNames(tool) {
|
|
|
663
677
|
}
|
|
664
678
|
return names.sort();
|
|
665
679
|
}
|
|
680
|
+
// A3(r89 契约层):surface-ref 共享交接的原料导出。requiredArgs 与
|
|
681
|
+
// leanFirstCallFor 仍是唯一实现(describe 默认面同源),surface-ref.ts 只组包,
|
|
682
|
+
// 不复制第二份真相——发现面三处(next / commands --filter / plan)共用一份。
|
|
683
|
+
export { requiredArgs };
|
|
684
|
+
/** The lean firstCall projection the default describe face inlines (A3 shared source). */
|
|
685
|
+
export function leanFirstCallFor(tool) {
|
|
686
|
+
const firstCall = firstCallFor(tool);
|
|
687
|
+
return firstCall === undefined ? undefined : leanFirstCall(firstCall);
|
|
688
|
+
}
|
|
689
|
+
/** The paste-able one-liner command when the recipe args are small enough (A3 shared source). */
|
|
690
|
+
export function firstCallCommandFor(tool) {
|
|
691
|
+
const firstCall = firstCallFor(tool);
|
|
692
|
+
if (firstCall === undefined)
|
|
693
|
+
return undefined;
|
|
694
|
+
const out = {
|
|
695
|
+
recipeId: String(firstCall.recipeId),
|
|
696
|
+
missing: Array.isArray(firstCall.missing) ? firstCall.missing : [],
|
|
697
|
+
};
|
|
698
|
+
if (typeof firstCall.command === "string")
|
|
699
|
+
out.command = firstCall.command;
|
|
700
|
+
if (typeof firstCall.commandHint === "string")
|
|
701
|
+
out.commandHint = firstCall.commandHint;
|
|
702
|
+
return out;
|
|
703
|
+
}
|
|
704
|
+
/** Placeholder sources (A3 shared source): where each missing id comes from, tool-name only. */
|
|
705
|
+
export function placeholderSourceFor(key) {
|
|
706
|
+
const source = PLACEHOLDER_SOURCES[key];
|
|
707
|
+
if (source === undefined)
|
|
708
|
+
return undefined;
|
|
709
|
+
return source.replace(/^omc call /, "").replace(/(.*$/, "").replace(/^omc env.*$/, "omc env");
|
|
710
|
+
}
|
|
711
|
+
/** The authored read shape reference (A3 shared source): a pointer, not a copy. */
|
|
712
|
+
export function shapeRefFor(toolName) {
|
|
713
|
+
return readShapeFor(toolName) === undefined ? undefined : { shapeRef: toolName, jqRoot: "result" };
|
|
714
|
+
}
|
|
666
715
|
/**
|
|
667
716
|
* `--param` 的价码提示(r26b 实测):标量参数 150–900 B,**object 参数 ≈ 整份
|
|
668
717
|
* `--full`**(`--param nodeGraph` = 8773 B,`--full` = 16950 B)。原来的提示只写
|
package/dist/endpoints.js
CHANGED
|
@@ -174,6 +174,8 @@ export const ENDPOINTS = {
|
|
|
174
174
|
runtimeFormLoad: "/api/api/runtime/form/load",
|
|
175
175
|
runtimeFormReplayToken: "/api/api/runtime/form/getReplayToken",
|
|
176
176
|
runtimeQueryList: "/api/api/runtime/query/list",
|
|
177
|
+
/** 平台服务端聚合(QueryRuntimeController.sum,POST /runtime/query/sum;数值/公式列,ALL_DATA)。 */
|
|
178
|
+
runtimeQuerySum: "/api/api/runtime/query/sum",
|
|
177
179
|
runtimeFormDelete: "/api/api/runtime/form/delete",
|
|
178
180
|
runtimeFormSubmit: "/api/api/runtime/form/submit",
|
|
179
181
|
bizServiceCreate: "/api/api/bizservice/service/create",
|
|
@@ -198,6 +200,20 @@ export const ENDPOINTS = {
|
|
|
198
200
|
bizServiceMethodDelete: "/api/api/bizservice/method/delete",
|
|
199
201
|
bizServiceMethodTest: "/api/api/bizservice/method/service_test",
|
|
200
202
|
bizServiceMethodList: "/api/api/bizservice/method/list_by_service_code",
|
|
203
|
+
/**
|
|
204
|
+
* 方法引用方清单(只读):`GET /bizservice/method/viewReference?serviceCode=&serviceMethodCode=`
|
|
205
|
+
* → `[{schemaCode, appCode, schemaName, appName}]`(BizServiceMethodController.java:452-487)。
|
|
206
|
+
* 给「删除被引用方法」的警告补可读归属;权威计数是 bizMethodCountMapping。
|
|
207
|
+
*/
|
|
208
|
+
bizServiceMethodViewReference: "/api/api/bizservice/method/viewReference",
|
|
209
|
+
/**
|
|
210
|
+
* 业务方法映射引用计数(只读,F12):`GET /app/bizmethod/count_mapping?serviceCode=[&serviceMethodCode=]`
|
|
211
|
+
* → Integer。类级 `@RequestMapping("/app/bizmethod")` + `@GetMapping("/count_mapping")`
|
|
212
|
+
* (BizMethodController.java:52,287-307;AppManagementFacadeImpl.java:1238-1240),
|
|
213
|
+
* 本部署 engine 挂双前缀,故用 `/api/api/app/bizmethod/count_mapping`。
|
|
214
|
+
* 服务删除的写前硬门用它(平台自身删服务不做任何引用校验)。
|
|
215
|
+
*/
|
|
216
|
+
bizMethodCountMapping: "/api/api/app/bizmethod/count_mapping",
|
|
201
217
|
/**
|
|
202
218
|
* 业务服务调用日志(表 h_log_biz_service)。
|
|
203
219
|
* 8.6.26 源码:LogManagerController `@RequestMapping("/api/log")` +
|
package/dist/goal-plan.js
CHANGED
|
@@ -4,6 +4,7 @@ import { goalRoute } from "./goal-routes.js";
|
|
|
4
4
|
import { capabilityRouteIndex } from "./capability-overview.js";
|
|
5
5
|
import { paramFillRuleFor } from "./search-index.js";
|
|
6
6
|
import { scoreTools } from "./tool-search.js";
|
|
7
|
+
import { surfaceRefFor } from "./surface-ref.js";
|
|
7
8
|
const AUTHORED_KEYS = new Set([
|
|
8
9
|
"nodeGraph", "template", "source", "methodConfig", "serviceConfig",
|
|
9
10
|
"methodInputParameters", "methodOutputParameters", "draftViewJson", "draftAttributesJson",
|
|
@@ -722,6 +723,17 @@ export function resolveModelCandidate(hint, models, goal = "") {
|
|
|
722
723
|
* Build a plan. PURE except for the injected probe runner — no writes, ever.
|
|
723
724
|
*/
|
|
724
725
|
export async function planGoal(registry, goal, options = {}) {
|
|
726
|
+
const plan = await planGoalInner(registry, goal, options);
|
|
727
|
+
// A3:steps[0] 的工具附 surfaceRef(与 next / commands --filter 同一组包点)。
|
|
728
|
+
// plan 自己的 steps[].args 已是本环境的解析结果;surfaceRef 补的是「下一步工具
|
|
729
|
+
// 的 firstCall 形状与缺参来源」——两个面各说一半,拼起来才是一步可跑的命令。
|
|
730
|
+
const firstTool = plan.steps[0]?.tool;
|
|
731
|
+
if (firstTool === undefined)
|
|
732
|
+
return plan;
|
|
733
|
+
const ref = surfaceRefFor(registry, firstTool, { via: "plan.steps[0]" });
|
|
734
|
+
return ref === undefined ? plan : { ...plan, surfaceRef: ref };
|
|
735
|
+
}
|
|
736
|
+
async function planGoalInner(registry, goal, options = {}) {
|
|
725
737
|
const explicit = options.target;
|
|
726
738
|
const route = explicit === undefined
|
|
727
739
|
? goalRoute(registry, goal)
|
package/dist/goal-routes.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { boundaryOf, capabilityRouteIndex, CAPABILITY_CUES, DISCOVERY_AUTHORITY } from "./capability-overview.js";
|
|
2
2
|
import { listSkills, readSkillSection } from "./skills.js";
|
|
3
|
+
import { surfaceRefFor } from "./surface-ref.js";
|
|
3
4
|
/**
|
|
4
5
|
* Mode cues. `next` used to answer every goal with the BUILD ladder, so
|
|
5
6
|
* "只读查看 X 的字段定义" was routed to field.create/form etc. (write:true) and
|
|
@@ -1484,6 +1485,24 @@ export function goalRoute(registry, goal) {
|
|
|
1484
1485
|
const hint = graphHintFor(goal);
|
|
1485
1486
|
const triage = triageHintFor(goal);
|
|
1486
1487
|
const withGraph = hint === undefined ? base : { ...base, graphHint: hint };
|
|
1487
|
-
|
|
1488
|
+
const withTriage = triage === undefined ? withGraph : { ...withGraph, triageHint: triage };
|
|
1489
|
+
// A3:firstAnswer 的 action 指向 registry 工具(omc call <tool> / omc describe
|
|
1490
|
+
// <tool> --example)时附 surfaceRef——读 ladder 的起手工具、配方命中与
|
|
1491
|
+
// needs-input 的 resolver 都能一次拿到 firstCall/needs/returns/onRefusal。
|
|
1492
|
+
const action = withTriage.firstAnswer?.action;
|
|
1493
|
+
const surfaceRef = action === undefined
|
|
1494
|
+
? undefined
|
|
1495
|
+
: surfaceRefFor(registry, toolOfAction(action), { via: "firstAnswer.action" });
|
|
1496
|
+
return surfaceRef === undefined ? withTriage : { ...withTriage, surfaceRef };
|
|
1497
|
+
}
|
|
1498
|
+
/** `omc call <tool> …` / `omc describe <tool> --example <id>` 里的工具名;其它形态返回空串(查不到即零字节)。 */
|
|
1499
|
+
function toolOfAction(action) {
|
|
1500
|
+
const call = /(?:^|\s)omc call ([a-zA-Z][\w.-]*)/.exec(action);
|
|
1501
|
+
if (call !== null)
|
|
1502
|
+
return call[1];
|
|
1503
|
+
const describe = /(?:^|\s)omc describe ([a-zA-Z][\w.-]*)/.exec(action);
|
|
1504
|
+
if (describe !== null)
|
|
1505
|
+
return describe[1];
|
|
1506
|
+
return "";
|
|
1488
1507
|
}
|
|
1489
1508
|
//# sourceMappingURL=goal-routes.js.map
|