@stalfh233/omc-cli 0.6.96 → 0.6.98
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/cli.js +62 -7
- package/dist/environment-policy.js +1 -1
- package/dist/lanes/businessrule-contract.js +1 -1
- package/dist/lanes/businessrule.js +70 -6
- package/dist/lanes/datarule-contract.js +1 -1
- package/dist/lanes/datarule.js +2 -2
- package/dist/lanes/environment.js +17 -19
- package/dist/lanes/perm.js +292 -32
- package/dist/lanes/runtime-data-contract.js +3 -3
- package/dist/lanes/runtime-data.js +28 -2
- package/dist/lanes/workflow-contract.js +1 -1
- package/dist/lanes/workflow.js +76 -10
- package/dist/path-projection.js +1 -1
- package/dist/read-shapes.js +3 -3
- package/dist/read.js +17 -2
- package/dist/rollback.js +33 -2
- package/dist/session.js +79 -38
- package/dist/write.js +5 -0
- package/package.json +3 -3
package/dist/lanes/workflow.js
CHANGED
|
@@ -2195,6 +2195,40 @@ export async function resolveWorkflowArg(session, args) {
|
|
|
2195
2195
|
const workflowCode = code && typeof code.workflowCode === "string" && code.workflowCode ? code.workflowCode : null;
|
|
2196
2196
|
return workflowCode;
|
|
2197
2197
|
}
|
|
2198
|
+
/**
|
|
2199
|
+
* BUG-05-F8: `isworkflow` can lag behind the real workflow binding. Keep the
|
|
2200
|
+
* ordinary probe hot path unchanged, and only use the bounded model index when
|
|
2201
|
+
* that probe says nothing. The index is intentionally not the high-level
|
|
2202
|
+
* workflow.list tool (which would add summaries/details to this point lookup).
|
|
2203
|
+
*/
|
|
2204
|
+
async function resolveWorkflowArgWithFallback(session, args) {
|
|
2205
|
+
if (args.workflowCode)
|
|
2206
|
+
return { workflowCode: args.workflowCode };
|
|
2207
|
+
if (!args.schemaCode)
|
|
2208
|
+
throw new ToolInputError({ status: "error", blocker: "tool-input-invalid", tool: "workflow.*", message: "需要 workflowCode,或 schemaCode(工具内部解析该模型的流程)" });
|
|
2209
|
+
const direct = await resolveWorkflowArg(session, args);
|
|
2210
|
+
if (direct)
|
|
2211
|
+
return { workflowCode: direct, resolution: "schemaCode-bind" };
|
|
2212
|
+
// 直接探针的唯一门槛是 `workflow/isworkflow`——真机里它会滞后于真实绑定。
|
|
2213
|
+
// 因此缺席时**绕过该门**直接问 getWorkflow(不问应用树:单点解析不需要
|
|
2214
|
+
// 模型清单,省一次 wire),拿到平台真实 workflowCode 才继续。
|
|
2215
|
+
const base = {
|
|
2216
|
+
workflowCode: null,
|
|
2217
|
+
resolution: "schemaCode-probe-plus-fallback",
|
|
2218
|
+
scannedModels: 1,
|
|
2219
|
+
nextCommand: `omc call workflow.list --args '{"applicationCode":"<应用code>"}'(按模型索引复核;不要据此断言流程不存在)`,
|
|
2220
|
+
};
|
|
2221
|
+
try {
|
|
2222
|
+
const linked = (await wireCall(session, { path: ENDPOINTS.workflowGetBySchema, query: { schemaCode: args.schemaCode } })).data;
|
|
2223
|
+
const workflowCode = linked && typeof linked.workflowCode === "string" && linked.workflowCode ? linked.workflowCode : null;
|
|
2224
|
+
if (workflowCode)
|
|
2225
|
+
return { ...base, workflowCode, resolution: "workflow-list-fallback" };
|
|
2226
|
+
}
|
|
2227
|
+
catch {
|
|
2228
|
+
return { ...base, readFailed: true, nextCommand: `omc call workflow.list --args '{"applicationCode":"<应用code>"}'(getWorkflow 读取失败;不要断言流程不存在)` };
|
|
2229
|
+
}
|
|
2230
|
+
return base;
|
|
2231
|
+
}
|
|
2198
2232
|
export async function scanModelWorkflowBindings(session, schemaCode) {
|
|
2199
2233
|
const workflowCode = await resolveWorkflowArg(session, { schemaCode });
|
|
2200
2234
|
if (!workflowCode)
|
|
@@ -2815,9 +2849,16 @@ export function registerWorkflowLane(tools) {
|
|
|
2815
2849
|
}
|
|
2816
2850
|
return { keyword: participantSearch, scannedModels, withWorkflow, hits, hitsCount: hits.length };
|
|
2817
2851
|
}
|
|
2818
|
-
const
|
|
2852
|
+
const resolved = await resolveWorkflowArgWithFallback(session, args);
|
|
2853
|
+
const workflowCode = resolved.workflowCode;
|
|
2819
2854
|
if (!workflowCode)
|
|
2820
|
-
return {
|
|
2855
|
+
return {
|
|
2856
|
+
schemaCode: args.schemaCode,
|
|
2857
|
+
exists: false,
|
|
2858
|
+
published: false,
|
|
2859
|
+
...resolved,
|
|
2860
|
+
note: "流程解析未命中;可能是平台索引不同步或扫描不完整,不据此断言流程不存在。先 workflow.list 确认;确认无绑定后再 workflow.create",
|
|
2861
|
+
};
|
|
2821
2862
|
let pub;
|
|
2822
2863
|
try {
|
|
2823
2864
|
pub = await wireCall(session, { path: ENDPOINTS.workflowGetPublished, query: { workflowCode } });
|
|
@@ -2840,6 +2881,9 @@ export function registerWorkflowLane(tools) {
|
|
|
2840
2881
|
workflowCode,
|
|
2841
2882
|
exists: true,
|
|
2842
2883
|
published,
|
|
2884
|
+
...(resolved.resolution ? { resolution: resolved.resolution } : {}),
|
|
2885
|
+
...(resolved.scannedModels !== undefined ? { scannedModels: resolved.scannedModels } : {}),
|
|
2886
|
+
...(resolved.partial ? { partial: true } : {}),
|
|
2843
2887
|
...(data && !published ? { note: "平台对未发布流程仍返回草稿形态——此读回不能当作已发布证据;以 published:true / templateType:PUBLISH 为准(先 workflow.publish)" } : {}),
|
|
2844
2888
|
data: pub.data,
|
|
2845
2889
|
};
|
|
@@ -3114,7 +3158,7 @@ export function registerWorkflowLane(tools) {
|
|
|
3114
3158
|
lane: WORKFLOW_LANE,
|
|
3115
3159
|
scope: WORKFLOW_TOOLS["workflow.publish"].scope,
|
|
3116
3160
|
description: WORKFLOW_TOOLS["workflow.publish"].description,
|
|
3117
|
-
inputSchema: { schemaCode: z.string().min(1), code: z.string().min(1).describe("流程编码——本参数名是 code,传 workflowCode 会被 schema 拒绝"), template: workflowTemplateArg.optional() },
|
|
3161
|
+
inputSchema: { schemaCode: z.string().min(1), code: z.string().min(1).describe("流程编码——本参数名是 code,传 workflowCode 会被 schema 拒绝"), template: workflowTemplateArg.describe("可省略——省略即把已存草稿原样发布(平台原生路径,先 workflow.update 写草稿)。要带模板时形状/连线/参与人/体积铁律与 workflow.update 的 template 完全同源,见 `omc describe workflow.update --param template`(此处不复制第二份,防漂移)").optional() },
|
|
3118
3162
|
execute: async (session, args) => {
|
|
3119
3163
|
// An absent template publishes the stored draft as-is — the platform's own
|
|
3120
3164
|
// path. The schema is optional so the contract no longer contradicts it.
|
|
@@ -3570,38 +3614,60 @@ export function registerWorkflowLane(tools) {
|
|
|
3570
3614
|
const performed = await wireCall(session, { path: ENDPOINTS.workflowUpdate, method: "POST", body });
|
|
3571
3615
|
const shouldPublish = args.publish !== false;
|
|
3572
3616
|
let publishMarked = false;
|
|
3617
|
+
// issue 2026-11 F1:发布后必须读**发布面**。此前只读草稿,草稿里空
|
|
3618
|
+
// customBtns 容器还在、发布面却被平台归一化成 buttonPermission:null——
|
|
3619
|
+
// 回执说「容器内按钮 enabled:false」而真实效果是「容器没了」,调用方据此
|
|
3620
|
+
// 判断「仍命中节点权限分支」,把方案引向错误结论。
|
|
3621
|
+
let authoritative = null;
|
|
3573
3622
|
if (shouldPublish) {
|
|
3574
3623
|
const publishPerformed = await wireCall(session, { path: ENDPOINTS.workflowPublish, method: "POST", body });
|
|
3575
3624
|
assertWorkflowWriteAccepted(publishPerformed, "workflow.setButtons", args.workflowCode);
|
|
3576
3625
|
const pub = await wireCall(session, { path: ENDPOINTS.workflowGetPublished, query: { workflowCode: args.workflowCode } });
|
|
3577
|
-
|
|
3578
|
-
publishMarked =
|
|
3626
|
+
authoritative = (pub.data ?? null);
|
|
3627
|
+
publishMarked = authoritative !== null && (authoritative.templateType === "PUBLISH" || authoritative.published === true);
|
|
3579
3628
|
}
|
|
3580
|
-
const readback =
|
|
3629
|
+
const readback = shouldPublish
|
|
3630
|
+
? authoritative
|
|
3631
|
+
: (await wireCall(session, { path: ENDPOINTS.workflowGetDraft, query: { workflowCode: args.workflowCode } })).data;
|
|
3581
3632
|
const nodeButtons = (readback ? readback.activities : draft.activities);
|
|
3582
3633
|
const rows = Array.isArray(nodeButtons)
|
|
3583
3634
|
? nodeButtons
|
|
3584
3635
|
: nodeButtons && typeof nodeButtons === "object"
|
|
3585
3636
|
? Object.values(nodeButtons)
|
|
3586
3637
|
: [];
|
|
3638
|
+
// 以权威面为准区分三种真实状态:容器不存在 / 容器在但按钮全禁用 / 有启用按钮。
|
|
3587
3639
|
const state = args.nodes.map((node) => {
|
|
3588
3640
|
const row = rows.find((entry) => String(entry.activityCode ?? "") === node.activityCode) ?? {};
|
|
3589
|
-
const
|
|
3641
|
+
const rawPerm = row.buttonPermission;
|
|
3642
|
+
const buttonPermissionIsNull = rawPerm === null || rawPerm === undefined;
|
|
3643
|
+
const bp = (rawPerm ?? {});
|
|
3590
3644
|
const btns = Array.isArray(bp.customBtns) ? bp.customBtns : [];
|
|
3645
|
+
const enabled = btns.filter((button) => button.enabled === true).map((button) => String(button.code ?? ""));
|
|
3646
|
+
const disabled = btns.filter((button) => button.enabled !== true).map((button) => String(button.code ?? ""));
|
|
3647
|
+
const containers = Array.isArray(bp.childTableBtns) ? bp.childTableBtns.length : 0;
|
|
3591
3648
|
return {
|
|
3592
3649
|
activityCode: node.activityCode,
|
|
3593
|
-
enabled
|
|
3594
|
-
disabled
|
|
3650
|
+
enabled,
|
|
3651
|
+
disabled,
|
|
3652
|
+
buttonPermissionIsNull,
|
|
3653
|
+
mode: buttonPermissionIsNull ? "absent" : enabled.length > 0 ? "enabled-in-container" : "disabled-in-container",
|
|
3654
|
+
childTableButtonContainerCount: containers,
|
|
3595
3655
|
};
|
|
3596
3656
|
});
|
|
3657
|
+
const cleared = state.filter((entry) => entry.buttonPermissionIsNull);
|
|
3597
3658
|
return {
|
|
3598
3659
|
performed: { errcode: performed.errcode, publishRequested: shouldPublish, nodes: args.nodes.map((node) => node.activityCode) },
|
|
3599
3660
|
readback: {
|
|
3600
3661
|
workflowCode: args.workflowCode,
|
|
3601
3662
|
nodes: state,
|
|
3602
3663
|
published: publishMarked,
|
|
3664
|
+
readbackFace: shouldPublish ? "published" : "draft",
|
|
3603
3665
|
buttonNames: names,
|
|
3604
|
-
|
|
3666
|
+
buttonPermissionIsNull: cleared.length > 0,
|
|
3667
|
+
...(cleared.length > 0 ? { clearedNodes: cleared.map((entry) => entry.activityCode) } : {}),
|
|
3668
|
+
note: cleared.length > 0
|
|
3669
|
+
? "权威读回显示这些节点的 buttonPermission 为 null(容器被平台清空/归一化,不是容器仍在但按钮均被禁用):节点不再命中节点权限分支,表单按钮会回落到权限组。子表按钮配置也未保留——需要保留时请只传有内容的 buttonCodes,不要传空数组。"
|
|
3670
|
+
: "权威读回显示 buttonPermission 容器仍在;未列出的表单按钮为 enabled:false,子表按钮配置保留。表单页只在 enabled:true 的节点显示该按钮。",
|
|
3605
3671
|
},
|
|
3606
3672
|
};
|
|
3607
3673
|
},
|
package/dist/path-projection.js
CHANGED
|
@@ -967,7 +967,7 @@ export function projectResultExtract(result, paths, keysOnly, retry) {
|
|
|
967
967
|
}
|
|
968
968
|
return out;
|
|
969
969
|
}
|
|
970
|
-
const SINGLE_PATH_META_KEYS = ["from", "artifactId", "sha256", "truncated", "truncatedKeys", "itemsCount", "total", "projectionHint"];
|
|
970
|
+
const SINGLE_PATH_META_KEYS = ["from", "artifactId", "sha256", "truncated", "truncatedKeys", "itemsCount", "total", "projectionHint", "projectionMiss"];
|
|
971
971
|
const SINGLE_PATH_ENTRY_META_KEYS = ["mapped", "nullEntries", "nonNullEntries", "missedEntries", "from", "autoStripped", "hint"];
|
|
972
972
|
export function unwrapSinglePathProjection(projected) {
|
|
973
973
|
const extracts = projected.extract;
|
package/dist/read-shapes.js
CHANGED
|
@@ -160,11 +160,11 @@ const READ_SHAPES = {
|
|
|
160
160
|
// A2 locator:模板摘要 activities[].code ↔ 实例/待办 activityCode(Activity.java:26-30
|
|
161
161
|
// 存储面原生键就是 activityCode/activityType/activityName;code/name/type 是摘要投影)。
|
|
162
162
|
locator: { templateActivityKey: "code", instanceKey: "activityCode", workitemKey: "activityCode" },
|
|
163
|
-
keys: ["status", "workflowCode", "exists", "published", "workflowSummary:{workflowCode,templateType,activities:array<{index,code,type,name,bizActions?:{<nodeEvent>:[ruleCode]},systemBizActions?:{bizActionType,ruleCodes:[code]}}>,edges:array<{from,to}>,ruleBindings:array<{...}>,nodeRuleBindings?,systemRuleBindings?,ruleBindingCount,originateActivity:{code,type,name,participant}}", "activities:array<{code,name,type,bizActions?,systemBizActions?}>(投影)", "propertyPermissionsCount", "version", "summaryHint", "truncatedKeys?", "omittedKeys?", "truncated?", "data?(外置时 null,完整模板在 detailArtifactId)", "omittedShape?", "omittedNote?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
|
|
164
|
-
notes: ["规则绑定三个面:流程级 ruleBindings、节点事件 activities[].bizActions、SYSTEM_ACTIVITY 顶层 activities[].systemBizActions(规则绑在系统活动节点本身、激活时执行)——三个面看完再下「没绑」结论;完整模板在 data(外置 detailArtifactId),要深层字段时投影写到叶子(如 --jq 'data.activities[].bizActions')——写整棵父节点会因总量超限再次被外置;activities[] 键=code/name/type,实例/待办面(workflow.instanceActivity、workitem.list)同一概念叫 activityCode/activityName(workitem 行没有 activityType)——跨面对照别拿错键"],
|
|
163
|
+
keys: ["status", "workflowCode", "exists", "published", "workflowSummary:{workflowCode,templateType,activities:array<{index,code,type,name,bizActions?:{<nodeEvent>:[ruleCode]},systemBizActions?:{bizActionType,ruleCodes:[code]}}>,edges:array<{from,to,ruleConditionGroup?:[[{currentDataItem,bizPropertyType,conditionType,value}]],utilizeElse?,popupType?,childMatchType?}>,ruleBindings:array<{...}>,nodeRuleBindings?,systemRuleBindings?,ruleBindingCount,originateActivity:{code,type,name,participant}}", "activities:array<{code,name,type,bizActions?,systemBizActions?}>(投影)", "propertyPermissionsCount", "version", "summaryHint", "truncatedKeys?", "omittedKeys?", "truncated?", "data?(外置时 null,完整模板在 detailArtifactId)", "omittedShape?", "omittedNote?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
|
|
164
|
+
notes: ["规则绑定三个面:流程级 ruleBindings、节点事件 activities[].bizActions、SYSTEM_ACTIVITY 顶层 activities[].systemBizActions(规则绑在系统活动节点本身、激活时执行)——三个面看完再下「没绑」结论;完整模板在 data(外置 detailArtifactId),要深层字段时投影写到叶子(如 --jq 'data.activities[].bizActions')——写整棵父节点会因总量超限再次被外置;activities[] 键=code/name/type,实例/待办面(workflow.instanceActivity、workitem.list)同一概念叫 activityCode/activityName(workitem 行没有 activityType)——跨面对照别拿错键", "条件分支在 edges[]:带 ruleConditionGroup 的边就是条件边(条件行含 currentDataItem/bizPropertyType/conditionType/value),utilizeElse:true 是该节点的 else 出口;摘要已含这些字段——确认「金额>1000→主管」这类分支不必再取 data 全量模板"],
|
|
165
165
|
},
|
|
166
166
|
"workflow.get_draft": {
|
|
167
|
-
keys: ["status", "workflowCode", "exists", "workflowSummary:{workflowCode,templateType,activities:array<{index,code,type,name,bizActions?:{<nodeEvent>:[ruleCode]},systemBizActions?:{bizActionType,ruleCodes:[code]}}>,edges:array<{from,to}>,ruleBindings:array<{...}>,nodeRuleBindings?,systemRuleBindings?,ruleBindingCount,originateActivity:{code,type,name,participant}}", "activities:array<{code,name,type,bizActions?,systemBizActions?}>(投影)", "propertyPermissionsCount", "version", "summaryHint", "truncatedKeys?", "omittedKeys?", "truncated?", "data?(外置时 null,完整模板在 detailArtifactId)", "omittedShape?", "omittedNote?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
|
|
167
|
+
keys: ["status", "workflowCode", "exists", "workflowSummary:{workflowCode,templateType,activities:array<{index,code,type,name,bizActions?:{<nodeEvent>:[ruleCode]},systemBizActions?:{bizActionType,ruleCodes:[code]}}>,edges:array<{from,to,ruleConditionGroup?:[[{currentDataItem,bizPropertyType,conditionType,value}]],utilizeElse?,popupType?,childMatchType?}>,ruleBindings:array<{...}>,nodeRuleBindings?,systemRuleBindings?,ruleBindingCount,originateActivity:{code,type,name,participant}}", "activities:array<{code,name,type,bizActions?,systemBizActions?}>(投影)", "propertyPermissionsCount", "version", "summaryHint", "truncatedKeys?", "omittedKeys?", "truncated?", "data?(外置时 null,完整模板在 detailArtifactId)", "omittedShape?", "omittedNote?", "environmentFingerprint", "detailArtifactId?", "detailSha256?", "fetch?"],
|
|
168
168
|
notes: ["与 workflow.get_published 同形(少了 published 键);节点绑定看 activities[].bizActions、系统活动顶层看 systemBizActions;templateType=DRAFT;深层字段投影写到叶子,完整模板在 data/detailArtifactId"],
|
|
169
169
|
},
|
|
170
170
|
// R88 #1:双面排查面。returnsFace 只显 notes 首条——教学并进首条。
|
package/dist/read.js
CHANGED
|
@@ -44,8 +44,11 @@ export async function governedRead(ctx, tool, args, execute, options = {}) {
|
|
|
44
44
|
return refusalFromCoverage(error);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
// issue 2026-11 F5:catch 里也要说清「打的是哪台」,所以把 session 提到 try 外。
|
|
48
|
+
let sessionRef;
|
|
47
49
|
try {
|
|
48
50
|
const session = await ctx.sessions.session(args.environment);
|
|
51
|
+
sessionRef = session;
|
|
49
52
|
const environmentFingerprint = safeFingerprint(session);
|
|
50
53
|
const result = await execute(session);
|
|
51
54
|
if (result.status === "refused" || result.status === "uncertain")
|
|
@@ -65,7 +68,9 @@ export async function governedRead(ctx, tool, args, execute, options = {}) {
|
|
|
65
68
|
|| (Array.isArray(result.logs) && result.logs.length <= 10)
|
|
66
69
|
// 2026-11-22(0.6.93 真机,kind:"trigger"):触发器清单就是答案本体——
|
|
67
70
|
// 6 条就超 2048B 被折叠到 artifact,agent 还得再取一次。与 items/logs 同口径。
|
|
68
|
-
|
|
71
|
+
// 2026-11-23(0.6.97):数据规则纳入后单模型可达 30+ 行(1 条计算/校验规则
|
|
72
|
+
// 各一行)——30→60,仍是有界的小行集(长度规则已聚合,不会无限长)。
|
|
73
|
+
|| (Array.isArray(result.triggers) && result.triggers.length <= 60);
|
|
69
74
|
const large = !smallRowSet && jsonBytes(result) > 2048;
|
|
70
75
|
const fileName = `${tool.name.replace(/[^a-zA-Z0-9._-]/g, "_")}-${sha256(target).slice(0, 16)}.json`;
|
|
71
76
|
const artifactRef = writeArtifact(ctx, fileName, detail);
|
|
@@ -109,7 +114,17 @@ export async function governedRead(ctx, tool, args, execute, options = {}) {
|
|
|
109
114
|
}
|
|
110
115
|
catch (error) {
|
|
111
116
|
if (isUncertainWireError(error))
|
|
112
|
-
return {
|
|
117
|
+
return {
|
|
118
|
+
status: "uncertain",
|
|
119
|
+
frozen: true,
|
|
120
|
+
reason: `wire-transport:${wireErrorKind(error)}`,
|
|
121
|
+
detail: error.message,
|
|
122
|
+
// issue 2026-11 F5:传输失败时把「到底打的是哪台」一起回出来——真机会话里
|
|
123
|
+
// env list 是 cwd 作用域,agent 静默落到全局 default 的另一台主机,只看
|
|
124
|
+
// detail 无从判断。configRoot/项目根用 `omc env list` 复核。
|
|
125
|
+
...(sessionRef !== undefined ? { environment: sessionRef.environmentName, baseUrl: sessionRef.profile.baseUrl } : {}),
|
|
126
|
+
environmentHint: "env 清单随 cwd 变(项目根 .omc-env/.omc-envs + 配置根);`omc env list` 首行回显 configRoot/projectRoot",
|
|
127
|
+
};
|
|
113
128
|
if (error instanceof WireError)
|
|
114
129
|
return { status: "refused", blocker: `wire-${error.kind}`, errcode: error.errcode, message: error.message, ...(error.diagnostic ? { diagnostic: error.diagnostic } : {}), ...(error.hint ? { hint: error.hint } : {}) };
|
|
115
130
|
throw error;
|
package/dist/rollback.js
CHANGED
|
@@ -353,8 +353,30 @@ export async function applyRollback(ref, options, context) {
|
|
|
353
353
|
// explicitification tolerance can never hide a real mismatch past limit.
|
|
354
354
|
verify = residual.nonAdditionCount === 0 ? "restored" : "mismatch";
|
|
355
355
|
}
|
|
356
|
+
const mismatch = verify === "mismatch";
|
|
357
|
+
// issue 2026-11 F2:mismatch 的下一步必须能真的把目标改回去。优先给**可粘贴的
|
|
358
|
+
// 单条补偿命令**(取 inverse 的第一条;参数过大时退回 rollback plan/apply,
|
|
359
|
+
// 避免把 1MB 模板塞进回执)。
|
|
360
|
+
const inverseCall = plan.inverse.kind === "calls" ? plan.inverse.calls[0] : undefined;
|
|
361
|
+
const inverseArgs = inverseCall === undefined ? undefined : { ...inverseCall.args, environment: entry.environment };
|
|
362
|
+
const inverseJson = inverseArgs === undefined ? undefined : JSON.stringify(inverseArgs);
|
|
363
|
+
const pasteable = inverseCall !== undefined && inverseJson !== undefined && inverseJson.length <= 1_200;
|
|
364
|
+
const nextCommand = !mismatch
|
|
365
|
+
? undefined
|
|
366
|
+
: pasteable
|
|
367
|
+
? `omc call ${inverseCall.tool} --env ${entry.environment} --args '${inverseJson}'`
|
|
368
|
+
: `omc rollback plan ${entry.seq} --env ${entry.environment}`;
|
|
369
|
+
const compensation = !mismatch
|
|
370
|
+
? undefined
|
|
371
|
+
: pasteable
|
|
372
|
+
? { tool: inverseCall.tool, args: inverseArgs, why: "权威读回与 before 不一致;这条是本次恢复原本要执行的写,可直接重放" }
|
|
373
|
+
: {
|
|
374
|
+
tool: "rollback.plan",
|
|
375
|
+
args: { seq: entry.seq, environment: entry.environment },
|
|
376
|
+
why: `权威读回与 before 不一致;恢复参数较大(${inverseJson?.length ?? 0}B)不回内联——先看 plan 的 diff,再 omc rollback apply ${entry.seq} 重试`,
|
|
377
|
+
};
|
|
356
378
|
return {
|
|
357
|
-
status: "ok",
|
|
379
|
+
status: mismatch ? "refused" : "ok",
|
|
358
380
|
rollbackOf: { seq: entry.seq, tool: entry.tool, target: entry.target },
|
|
359
381
|
calls: results,
|
|
360
382
|
// B1: the shared step-identity projection (same shape as apply_changes /
|
|
@@ -370,7 +392,16 @@ export async function applyRollback(ref, options, context) {
|
|
|
370
392
|
matchesBefore: verify === "restored",
|
|
371
393
|
recoveredTo: { seq: entry.seq, ts: entry.ts },
|
|
372
394
|
...(progressFile !== undefined ? { progressFile } : {}),
|
|
373
|
-
...(
|
|
395
|
+
...(mismatch
|
|
396
|
+
? {
|
|
397
|
+
beforeSha,
|
|
398
|
+
restoredSha,
|
|
399
|
+
blocker: "rollback-readback-mismatch",
|
|
400
|
+
message: "恢复调用已完成但权威读回与 before 不一致,不得标记成功;按 nextCommand 补偿后重跑 rollback plan 复核",
|
|
401
|
+
nextCommand,
|
|
402
|
+
compensation,
|
|
403
|
+
}
|
|
404
|
+
: {}),
|
|
374
405
|
hint: "本次恢复的每次调用都走了完整写闸门并已记 journal;恢复本身可再回滚(rollback plan <新 seq>)",
|
|
375
406
|
};
|
|
376
407
|
}
|
package/dist/session.js
CHANGED
|
@@ -23,6 +23,9 @@ export class CloudPivotSession {
|
|
|
23
23
|
version;
|
|
24
24
|
/** r86(retro issue 17):原始版本串("AI-Platform-v1.1.25" 这类含产品线前缀的完整值)。 */
|
|
25
25
|
rawVersion;
|
|
26
|
+
versionSource;
|
|
27
|
+
/** F7:license 载荷留作读面复用(buildTime/licenseType 只在 license/info 有)。 */
|
|
28
|
+
licenseInfoValue;
|
|
26
29
|
/**
|
|
27
30
|
* Non-fatal login caveats (e.g. the `client` blob in system/config was
|
|
28
31
|
* absent or unreadable, so the token request carried no client_secret).
|
|
@@ -67,32 +70,13 @@ export class CloudPivotSession {
|
|
|
67
70
|
administrator: cached.administrator,
|
|
68
71
|
...(cached.accountIdentity !== undefined ? { accountIdentity: cached.accountIdentity } : {}),
|
|
69
72
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
// public system config once and backfill the cache, otherwise every
|
|
78
|
-
// later write stays fail-closed even after the probe itself is fixed
|
|
79
|
-
// (live 2026-10-17: AI-Platform deployment, pcServerUrl null).
|
|
80
|
-
const systemConfig = await core
|
|
81
|
-
.fetchCloudPivotSystemConfig(this.profile.baseUrl, undefined, fetch, core.cloudPivotTenantHeaders(this.profile.engineCode))
|
|
82
|
-
.catch(() => undefined);
|
|
83
|
-
this.version = detectVersion(systemConfig);
|
|
84
|
-
this.rawVersion = detectRawVersion(systemConfig);
|
|
85
|
-
if (this.version !== undefined) {
|
|
86
|
-
this.tokenCache?.save({
|
|
87
|
-
token: cached.token,
|
|
88
|
-
enterpriseId: cached.enterpriseId,
|
|
89
|
-
administrator: cached.administrator,
|
|
90
|
-
...(cached.accountIdentity !== undefined ? { accountIdentity: cached.accountIdentity } : {}),
|
|
91
|
-
version: this.version,
|
|
92
|
-
...(this.rawVersion !== undefined ? { rawVersion: this.rawVersion } : {}),
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
73
|
+
const evidence = await this.probeVersionEvidence(cached.version, cached.rawVersion);
|
|
74
|
+
this.version = evidence.version;
|
|
75
|
+
this.rawVersion = evidence.rawVersion;
|
|
76
|
+
this.versionSource = evidence.source;
|
|
77
|
+
// 缓存命中路径只在**拿到证据**时回写(探测失败不得凭空改写缓存)。
|
|
78
|
+
if (evidence.version !== undefined)
|
|
79
|
+
this.saveCachedLogin(this.loginResult, evidence);
|
|
96
80
|
return this.loginResult;
|
|
97
81
|
}
|
|
98
82
|
const core = await omcCore();
|
|
@@ -115,16 +99,11 @@ export class CloudPivotSession {
|
|
|
115
99
|
...(systemConfig ? { systemConfig } : {}),
|
|
116
100
|
});
|
|
117
101
|
this.loginNotesValue = authenticator.loginNotes();
|
|
118
|
-
this.
|
|
119
|
-
this.
|
|
120
|
-
this.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
administrator: this.loginResult.administrator,
|
|
124
|
-
...(this.loginResult.accountIdentity !== undefined ? { accountIdentity: this.loginResult.accountIdentity } : {}),
|
|
125
|
-
...(this.version !== undefined ? { version: this.version } : {}),
|
|
126
|
-
...(this.rawVersion !== undefined ? { rawVersion: this.rawVersion } : {}),
|
|
127
|
-
});
|
|
102
|
+
const evidence = await this.probeVersionEvidence(undefined, undefined, systemConfig);
|
|
103
|
+
this.version = evidence.version;
|
|
104
|
+
this.rawVersion = evidence.rawVersion;
|
|
105
|
+
this.versionSource = evidence.source;
|
|
106
|
+
this.saveCachedLogin(this.loginResult, evidence);
|
|
128
107
|
return this.loginResult;
|
|
129
108
|
}
|
|
130
109
|
/** Version-family evidence; absent evidence returns undefined (fail closed upstream). */
|
|
@@ -135,6 +114,66 @@ export class CloudPivotSession {
|
|
|
135
114
|
rawSystemVersion() {
|
|
136
115
|
return this.rawVersion;
|
|
137
116
|
}
|
|
117
|
+
versionEvidenceSource() {
|
|
118
|
+
return this.versionSource;
|
|
119
|
+
}
|
|
120
|
+
/** F7:登录期已探测过的 license/info 载荷;读面据此免去第二次 wire。 */
|
|
121
|
+
licenseInfo() {
|
|
122
|
+
return this.licenseInfoValue;
|
|
123
|
+
}
|
|
124
|
+
async probeVersionEvidence(cachedVersion, cachedRawVersion, knownSystemConfig) {
|
|
125
|
+
// F7(issue 05):缓存命中**不意味着**要重新探测。已有版本且属于锚定族
|
|
126
|
+
// (或本来就是 license 证据)就零 wire 直接用;只有「没有版本」或「缓存说
|
|
127
|
+
// 自己不是 8.6 族」时才重探——后者正是真机 1.1.25 误报的场景。
|
|
128
|
+
if (cachedVersion !== undefined && (this.versionSource === "license/info" || cachedVersion.startsWith("8.6.")))
|
|
129
|
+
return { version: cachedVersion, rawVersion: cachedRawVersion, source: this.versionSource ?? "system-config" };
|
|
130
|
+
let license;
|
|
131
|
+
try {
|
|
132
|
+
// license/info 是管理员端点:401/403/404 都属「该产品线没这面」,直接回退。
|
|
133
|
+
// 用裸 http(不走 this.request):后者对 401 会清 token cache 重登,而非管理员
|
|
134
|
+
// 会话读 license 恰好是 401,会把缓存打掉。
|
|
135
|
+
const response = await (await this.http()).request({ path: "/api/license/info", method: "GET", headers: this.headers() });
|
|
136
|
+
if (response.status >= 200 && response.status < 300) {
|
|
137
|
+
const body = response.body;
|
|
138
|
+
const data = body && typeof body === "object" && body.data && typeof body.data === "object"
|
|
139
|
+
? body.data
|
|
140
|
+
: response.body;
|
|
141
|
+
if (data && typeof data === "object")
|
|
142
|
+
license = data;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// license 面不可达:回退 system/config。
|
|
147
|
+
}
|
|
148
|
+
this.licenseInfoValue = license;
|
|
149
|
+
const licenseVersion = detectVersion(license);
|
|
150
|
+
if (licenseVersion !== undefined)
|
|
151
|
+
return { version: licenseVersion, rawVersion: detectRawVersion(license), source: "license/info" };
|
|
152
|
+
let systemConfig = knownSystemConfig;
|
|
153
|
+
if (!systemConfig) {
|
|
154
|
+
const core = await omcCore();
|
|
155
|
+
systemConfig = await core
|
|
156
|
+
.fetchCloudPivotSystemConfig(this.profile.baseUrl, undefined, fetch, core.cloudPivotTenantHeaders(this.profile.engineCode))
|
|
157
|
+
.catch(() => undefined);
|
|
158
|
+
}
|
|
159
|
+
const publicVersion = detectVersion(systemConfig);
|
|
160
|
+
if (publicVersion !== undefined)
|
|
161
|
+
return { version: publicVersion, rawVersion: detectRawVersion(systemConfig), source: "system-config" };
|
|
162
|
+
if (cachedVersion !== undefined)
|
|
163
|
+
return { version: cachedVersion, rawVersion: cachedRawVersion, source: "token-cache" };
|
|
164
|
+
return {};
|
|
165
|
+
}
|
|
166
|
+
saveCachedLogin(login, evidence) {
|
|
167
|
+
this.tokenCache?.save({
|
|
168
|
+
token: login.token,
|
|
169
|
+
enterpriseId: login.enterpriseId,
|
|
170
|
+
administrator: login.administrator,
|
|
171
|
+
...(login.accountIdentity !== undefined ? { accountIdentity: login.accountIdentity } : {}),
|
|
172
|
+
...(evidence.version !== undefined ? { version: evidence.version } : {}),
|
|
173
|
+
...(evidence.rawVersion !== undefined ? { rawVersion: evidence.rawVersion } : {}),
|
|
174
|
+
...(evidence.source !== undefined ? { versionSource: evidence.source } : {}),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
138
177
|
/** Non-fatal login caveats; empty when the login was fully nominal. */
|
|
139
178
|
loginNotes() {
|
|
140
179
|
return this.loginNotesValue;
|
|
@@ -227,7 +266,9 @@ export class CloudPivotSession {
|
|
|
227
266
|
function detectVersion(systemConfig) {
|
|
228
267
|
if (!systemConfig)
|
|
229
268
|
return undefined;
|
|
230
|
-
|
|
269
|
+
// 真机 8.6 用 systemVersion;1.1.x 的公共配置与旧缓存用 version——都来自
|
|
270
|
+
// system/config 响应,不是 bundle 版本(bundle 猜版本是 F7 的原始误报来源)。
|
|
271
|
+
for (const key of ["systemVersion", "version", "sysVersion", "productVersion", "serverVersion"]) {
|
|
231
272
|
const value = systemConfig[key];
|
|
232
273
|
if (typeof value !== "string")
|
|
233
274
|
continue;
|
|
@@ -246,7 +287,7 @@ function detectVersion(systemConfig) {
|
|
|
246
287
|
function detectRawVersion(systemConfig) {
|
|
247
288
|
if (!systemConfig)
|
|
248
289
|
return undefined;
|
|
249
|
-
for (const key of ["
|
|
290
|
+
for (const key of ["systemVersion", "version", "sysVersion", "productVersion", "serverVersion"]) {
|
|
250
291
|
const value = systemConfig[key];
|
|
251
292
|
if (typeof value === "string" && value.trim().length > 0)
|
|
252
293
|
return value.trim();
|
package/dist/write.js
CHANGED
|
@@ -116,6 +116,11 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
|
|
|
116
116
|
frozen: true,
|
|
117
117
|
reason: `wire-transport:${wireErrorKind(error)}`,
|
|
118
118
|
detail: error.message,
|
|
119
|
+
// issue 2026-11 F5:同读面——把环境名与 baseUrl 一起回出来,避免
|
|
120
|
+
// 「cwd 落到全局 default 的另一台主机」被误判成参数问题。
|
|
121
|
+
environment: session.environmentName,
|
|
122
|
+
baseUrl: session.profile.baseUrl,
|
|
123
|
+
environmentHint: "env 清单随 cwd 变(项目根 .omc-env/.omc-envs + 配置根);`omc env list` 首行回显 configRoot/projectRoot",
|
|
119
124
|
message: "write outcome cannot be established; frozen — re-discover before retrying; never assume success",
|
|
120
125
|
// r46 实证:data.submit 传输中断但平台已落行,按回执盲重试产生重复数据
|
|
121
126
|
// 再连锁清理。uncertain ≠ 失败——先按业务键查重再决定。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.98",
|
|
4
4
|
"description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"commander": "14.0.3",
|
|
59
|
-
"omc-core": "0.6.
|
|
59
|
+
"omc-core": "0.6.98",
|
|
60
60
|
"proper-lockfile": "4.1.2",
|
|
61
61
|
"write-file-atomic": "6.0.0",
|
|
62
62
|
"zod": "^3.23.8",
|
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
"directory": "packages/omc-cli"
|
|
75
75
|
},
|
|
76
76
|
"optionalDependencies": {
|
|
77
|
-
"@stalfh233/omc-fake-platform": "0.6.
|
|
77
|
+
"@stalfh233/omc-fake-platform": "0.6.98"
|
|
78
78
|
}
|
|
79
79
|
}
|