weaver-work-cli 0.1.69 → 0.1.70

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.
Files changed (53) hide show
  1. package/dist/chunks/{attachment-content-7BEDNQ3O.js → attachment-content-DMU7KNZ7.js} +3 -3
  2. package/dist/chunks/{chunk-ELF5TPSG.js → chunk-4W6BSNIL.js} +6 -6
  3. package/dist/chunks/{chunk-BEYEXCWU.js → chunk-7CINV2BU.js} +2 -2
  4. package/dist/chunks/{chunk-JAIZY37Z.js → chunk-EHH363SP.js} +4 -4
  5. package/dist/chunks/{chunk-6DH73Q5H.js → chunk-GFOFUH6O.js} +38 -38
  6. package/dist/chunks/{chunk-MLJK4KLE.js → chunk-GWM5TLIK.js} +32 -32
  7. package/dist/chunks/{chunk-FMAZ42HS.js → chunk-HAORST2G.js} +7 -7
  8. package/dist/chunks/{chunk-ERAE4GHX.js → chunk-IVCOZCAW.js} +1 -1
  9. package/dist/chunks/{chunk-3TZURS7M.js → chunk-KDOJW5LH.js} +1 -1
  10. package/dist/chunks/{chunk-3CBURKSY.js → chunk-L2A3COWV.js} +2 -2
  11. package/dist/chunks/{chunk-4XYRTXRR.js → chunk-LJE7RZNC.js} +1 -1
  12. package/dist/chunks/{chunk-67AN5YJT.js → chunk-X6PMJQGO.js} +3 -3
  13. package/dist/chunks/{chunk-YR3K53BU.js → chunk-XIBMZEDB.js} +2 -2
  14. package/dist/chunks/{conflict-VKCRXHUV.js → conflict-YW5BULJ3.js} +2 -2
  15. package/dist/chunks/{create-flow-WYPLBLRK.js → create-flow-5OBS3B3V.js} +6 -6
  16. package/dist/chunks/{entry-mode-BCJ7RPFC.js → entry-mode-L65OWPFM.js} +3 -3
  17. package/dist/chunks/{env-SCVCHBN2.js → env-XW7LYIME.js} +2 -2
  18. package/dist/chunks/{factory-CBXYOEBF.js → factory-MHFZZAGH.js} +1 -1
  19. package/dist/chunks/{group-chat-RFL4U7RF.js → group-chat-EEOLO5NM.js} +3 -3
  20. package/dist/chunks/{jiuchuanhui-PY2WEBUH.js → jiuchuanhui-JCBUR563.js} +1278 -1131
  21. package/dist/chunks/{meeting-N2AGGLVI.js → meeting-PCD5EPBF.js} +11 -11
  22. package/dist/chunks/{minute-doc-C62EZOJH.js → minute-doc-WTZJVCHG.js} +2 -2
  23. package/dist/chunks/{performance-GBKM5G2Y.js → performance-SMVTPK6T.js} +5 -4
  24. package/dist/chunks/{registry-Y2HWS6JS.js → registry-3B3OAJYX.js} +1 -1
  25. package/dist/chunks/{registry-7US3QQXV.js → registry-ZQ7OONCB.js} +11 -11
  26. package/dist/chunks/{room-recommend-LMNF76YS.js → room-recommend-73NBN3RU.js} +4 -4
  27. package/dist/chunks/{schedule-4QE2THAP.js → schedule-SDBOBBUQ.js} +4 -4
  28. package/dist/chunks/{workflow-KXYTQZ2H.js → workflow-OWHWLAOX.js} +1 -1
  29. package/dist/index.js +4 -4
  30. package/dist/shortcuts/jiuchuanhui/cache.js +49 -35
  31. package/dist/shortcuts/jiuchuanhui/host.js +37 -5
  32. package/dist/shortcuts/jiuchuanhui/index.js +43 -7
  33. package/dist/shortcuts/jiuchuanhui/manifest.js +36 -1
  34. package/dist/shortcuts/jiuchuanhui/operations/customer-quick.js +110 -0
  35. package/dist/shortcuts/jiuchuanhui/operations/datajson.js +11 -56
  36. package/dist/shortcuts/jiuchuanhui/operations/esb.js +9 -16
  37. package/dist/shortcuts/jiuchuanhui/operations/generic.js +8 -30
  38. package/dist/shortcuts/jiuchuanhui/operations/registry.js +8 -2
  39. package/dist/shortcuts/jiuchuanhui/operations/shared.js +0 -10
  40. package/dist/shortcuts/performance/operations/flow-detail.js +5 -4
  41. package/dist/shortcuts/workflow/operations/aiDeepRead/collect.js +5 -2
  42. package/docs/jiuchuanhui.md +17 -5
  43. package/package.json +1 -1
  44. package/skills/weaver-e10-jiuchuanhui/SKILL.md +49 -90
  45. package/skills/weaver-e10-jiuchuanhui/references/cache.md +17 -13
  46. package/skills/weaver-e10-jiuchuanhui/references/customer.md +33 -5
  47. package/skills/weaver-e10-jiuchuanhui/references/discovery-config.md +3 -3
  48. package/skills/weaver-e10-jiuchuanhui/references/jiuchuanhui-entry.md +9 -7
  49. package/skills/weaver-e10-performance/SKILL.md +2 -2
  50. package/skills/weaver-e10-performance/agents/openai.yaml +4 -2
  51. package/skills/weaver-e10-performance/references/flow-assess.md +19 -6
  52. package/skills/weaver-e10-workflow/SKILL.md +1 -1
  53. package/skills/weaver-e10-workflow/references/workflow-deep-read.md +8 -3
@@ -0,0 +1,110 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { jiuchuanhuiCacheFile } from '../cache.js';
3
+ import { jiuchuanhuiValidationError } from '../errors.js';
4
+ import { asNonEmptyString } from './shared.js';
5
+ export const CUSTOMER_SEARCH_SCOPES = {
6
+ mine: { mine: '', all: '-1', customerSea: '-1' },
7
+ all: { mine: '-1', all: '', customerSea: '-1' },
8
+ 'open-sea': { mine: '-1', all: '-1', customerSea: '' },
9
+ };
10
+ const STATUS_PAGE_SIZE = 100;
11
+ const STATUS_MAX_PAGES = 5;
12
+ function addSuccessStatusIds(ids, rows) {
13
+ for (const row of rows) {
14
+ const status = row?.mainTable ?? row;
15
+ const fields = status;
16
+ const label = String(fields?.state_name ?? '').trim() || String(fields?.name ?? '').trim();
17
+ if (label !== '成功客户' && label !== '成功')
18
+ continue;
19
+ const id = String(fields?.id ?? '').trim();
20
+ if (/^[1-9]\d*$/u.test(id))
21
+ ids.add(id);
22
+ }
23
+ }
24
+ async function cachedCustomerStatuses(context) {
25
+ const { tenantKey, userId } = await context.host.getSession();
26
+ if (!tenantKey || !userId)
27
+ return [];
28
+ try {
29
+ const raw = await readFile(jiuchuanhuiCacheFile(tenantKey, userId), 'utf8');
30
+ const rows = JSON.parse(raw.replace(/^\uFEFF/u, ''))?.ebuilder?.customer_status;
31
+ return Array.isArray(rows) && rows.length < STATUS_PAGE_SIZE * STATUS_MAX_PAGES ? rows : [];
32
+ }
33
+ catch {
34
+ return [];
35
+ }
36
+ }
37
+ function uniqueSuccessStatusId(ids) {
38
+ if (ids.size > 1) {
39
+ throw jiuchuanhuiValidationError('customer_success_status_ambiguous', '找到多个成功客户状态,请确认要使用的客户状态', {
40
+ statusIds: [...ids],
41
+ });
42
+ }
43
+ return ids.values().next().value;
44
+ }
45
+ async function resolveSuccessStatus(search, context) {
46
+ const ids = new Set();
47
+ addSuccessStatusIds(ids, await cachedCustomerStatuses(context));
48
+ const cachedId = uniqueSuccessStatusId(ids);
49
+ if (cachedId)
50
+ return cachedId;
51
+ for (let pageNo = 1; pageNo <= STATUS_MAX_PAGES; pageNo += 1) {
52
+ const { response } = await search.execute({ pageNo, pageSize: STATUS_PAGE_SIZE }, context);
53
+ // This lookup supplies the filter for the next request. The final customer response is passed through.
54
+ const rows = response.value?.datajson?.datas;
55
+ if (response.httpStatus < 200 || response.httpStatus >= 300 || !Array.isArray(rows)) {
56
+ throw jiuchuanhuiValidationError('customer_success_status_lookup_failed', '无法读取客户状态字典,请确认需要使用的客户状态', { httpStatus: response.httpStatus });
57
+ }
58
+ addSuccessStatusIds(ids, rows);
59
+ const statusId = uniqueSuccessStatusId(ids);
60
+ if (rows.length < STATUS_PAGE_SIZE) {
61
+ if (statusId)
62
+ return statusId;
63
+ throw jiuchuanhuiValidationError('customer_success_status_not_found', '当前租户未找到“成功”或“成功客户”状态,请确认客户状态名称');
64
+ }
65
+ }
66
+ throw jiuchuanhuiValidationError('customer_success_status_lookup_incomplete', '客户状态字典未查完,请确认需要使用的客户状态');
67
+ }
68
+ export class CustomerQuickSearchOperation {
69
+ name;
70
+ customerSearch;
71
+ defaultScope;
72
+ customerStatusSearch;
73
+ constructor(name, customerSearch, defaultScope, customerStatusSearch) {
74
+ this.name = name;
75
+ this.customerSearch = customerSearch;
76
+ this.defaultScope = defaultScope;
77
+ this.customerStatusSearch = customerStatusSearch;
78
+ }
79
+ async execute(input, context) {
80
+ const { customer_name, pageNo, pageSize, count, scope = this.defaultScope, ...unsupported } = input;
81
+ const unexpected = Object.keys(unsupported);
82
+ if (!this.customerStatusSearch && Object.hasOwn(input, 'scope'))
83
+ unexpected.push('scope');
84
+ if (unexpected.length) {
85
+ throw jiuchuanhuiValidationError('field_unsupported', `快捷查询不支持以下参数:${unexpected.join('、')}`, { fields: unexpected });
86
+ }
87
+ if (typeof scope !== 'string' || !Object.hasOwn(CUSTOMER_SEARCH_SCOPES, scope)) {
88
+ throw jiuchuanhuiValidationError('input_invalid', 'scope 必须是 mine、all 或 open-sea');
89
+ }
90
+ if (pageNo !== undefined && (!Number.isSafeInteger(pageNo) || pageNo < 1)) {
91
+ throw jiuchuanhuiValidationError('input_invalid', 'pageNo 必须是正整数');
92
+ }
93
+ if (pageSize !== undefined && (!Number.isSafeInteger(pageSize) || pageSize < 1 || pageSize > 200)) {
94
+ throw jiuchuanhuiValidationError('input_invalid', 'pageSize 必须是 1 到 200 之间的整数');
95
+ }
96
+ if (count !== undefined && typeof count !== 'boolean') {
97
+ throw jiuchuanhuiValidationError('input_invalid', 'count 必须是布尔值');
98
+ }
99
+ const customerName = customer_name === undefined ? undefined : asNonEmptyString(customer_name, 'customer_name');
100
+ const status = this.customerStatusSearch ? await resolveSuccessStatus(this.customerStatusSearch, context) : undefined;
101
+ return this.customerSearch.execute({
102
+ ...CUSTOMER_SEARCH_SCOPES[scope],
103
+ customer_name: customerName,
104
+ pageNo,
105
+ pageSize,
106
+ count,
107
+ status,
108
+ }, context);
109
+ }
110
+ }
@@ -1,6 +1,6 @@
1
1
  import { CONTINUATION_TTL_SECONDS } from '../../../core/continuation-ttl.js';
2
2
  import { jiuchuanhuiConfirmationError, jiuchuanhuiPartialError, jiuchuanhuiValidationError, isJiuchuanhuiNetworkError, } from '../errors.js';
3
- import { asObject, asPositiveString, byIdBody, datasBody, listBody, listRecords, pagingFrom, resultDataIds, sessionMatches, stripForbiddenKeys, workflow, } from './shared.js';
3
+ import { asObject, asPositiveString, byIdBody, datasBody, listBody, pagingFrom, resultDataIds, sessionMatches, stripForbiddenKeys, workflow, } from './shared.js';
4
4
  /**
5
5
  * datajson 创建/更新写操作(saveFormData / updateFormData)。
6
6
  * prepare -> apply 确认链;apply 校验 confirm + continuation + 会话一致后提交。
@@ -106,20 +106,12 @@ export class DatajsonDetailOperation {
106
106
  async execute(input, { host }) {
107
107
  const id = asPositiveString(String(input.id ?? input.dataId), 'id');
108
108
  const session = await host.getSession();
109
- const result = await host.request({
109
+ const response = await host.query({
110
110
  path: this.path,
111
111
  body: byIdBody(id, session.userId),
112
112
  operation: this.name,
113
113
  });
114
- return {
115
- status: 'COMPLETE',
116
- data: {
117
- id,
118
- ...(result && typeof result === 'object' ? { raw: result } : {}),
119
- mainTable: extractMainTable(result),
120
- detail: result,
121
- },
122
- };
114
+ return { response };
123
115
  }
124
116
  }
125
117
  /**
@@ -140,26 +132,14 @@ export class DatajsonSearchOperation {
140
132
  const session = await host.getSession();
141
133
  const query = buildSearchQuery(input, pageNo, pageSize);
142
134
  const main = listBody(session.userId, pageNo, pageSize, {});
143
- const listPromise = host.request({ path: this.path, query, body: main, operation: this.name });
144
- const countPromise = input.count === true && this.countPath
145
- ? host.request({ path: this.countPath, query: withoutPaging(query), body: listBody(session.userId, 1, 1, {}), operation: `${this.name}.count` })
146
- : undefined;
147
- const [listResult, countResult] = countPromise
148
- ? await Promise.all([listPromise, countPromise])
149
- : [await listPromise, undefined];
150
- const records = listRecords(listResult);
151
- const total = extractCount(countResult);
152
- return {
153
- status: 'COMPLETE',
154
- data: {
155
- items: records,
156
- total,
157
- pageNo,
158
- pageSize,
159
- hasMore: total === undefined ? records.length >= pageSize : pageNo * pageSize < total,
160
- query,
161
- },
162
- };
135
+ const listPromise = host.query({ path: this.path, query, body: main, operation: this.name });
136
+ if (input.count !== true || !this.countPath)
137
+ return { response: await listPromise };
138
+ const [response, countResponse] = await Promise.all([
139
+ listPromise,
140
+ host.query({ path: this.countPath, query: withoutPaging(query), body: listBody(session.userId, 1, 1, {}), operation: `${this.name}.count` }),
141
+ ]);
142
+ return { response, countResponse };
163
143
  }
164
144
  }
165
145
  function buildSearchQuery(input, pageNo, pageSize) {
@@ -188,28 +168,3 @@ function withoutPaging(query) {
188
168
  delete next.pageSize;
189
169
  return next;
190
170
  }
191
- function extractCount(value) {
192
- if (!value || typeof value !== 'object')
193
- return undefined;
194
- const root = value;
195
- const datas = root.datajson?.datas;
196
- const raw = Array.isArray(datas) ? datas[0] : datas;
197
- const num = Number(raw ?? root.total ?? root.count);
198
- return Number.isFinite(num) ? num : undefined;
199
- }
200
- function extractMainTable(value) {
201
- if (!value || typeof value !== 'object')
202
- return undefined;
203
- const root = value;
204
- const mt = root.datajson?.mainTable;
205
- if (mt && typeof mt === 'object' && !Array.isArray(mt))
206
- return mt;
207
- const datas = root.datajson?.datas;
208
- if (Array.isArray(datas) && datas[0] && typeof datas[0] === 'object') {
209
- const first = datas[0];
210
- if (first.mainTable && typeof first.mainTable === 'object')
211
- return first.mainTable;
212
- return first;
213
- }
214
- return undefined;
215
- }
@@ -1,5 +1,6 @@
1
1
  import { CONTINUATION_TTL_SECONDS } from '../../../core/continuation-ttl.js';
2
2
  import { jiuchuanhuiConfirmationError, jiuchuanhuiPartialError, jiuchuanhuiValidationError, isJiuchuanhuiNetworkError, } from '../errors.js';
3
+ import { getJiuchuanhuiOperationContract } from '../manifest.js';
3
4
  import { asObject, asNonEmptyString, esbBody, esbOutcome, sessionMatches, workflow } from './shared.js';
4
5
  /**
5
6
  * ESB 写操作模板。所有 ESB 动作流写操作(新建/修改/转移/释放/领取/状态变更/赢单/输单/无效/暂停/重启/完成计划)
@@ -20,6 +21,12 @@ export class EsbWritePrepareOperation {
20
21
  }
21
22
  async execute(input, { host, continuation }) {
22
23
  const mainTable = normalizeMainTable(input.mainTable, this.mainTableKeys);
24
+ const properties = getJiuchuanhuiOperationContract(this.name)?.inputSchema.properties;
25
+ const missing = properties?.mainTable?.required?.filter((key) => !Object.hasOwn(mainTable, key)
26
+ || mainTable[key] === undefined || mainTable[key] === null || mainTable[key] === '');
27
+ if (missing?.length) {
28
+ throw jiuchuanhuiValidationError('field_required', `缺少必填参数:${missing.join('、')}`, { fields: missing });
29
+ }
23
30
  const preview = summaryOf(mainTable);
24
31
  const session = await host.getSession();
25
32
  const continuationToken = await continuation.issue({
@@ -117,26 +124,12 @@ export class EsbReadOperation {
117
124
  async execute(input, { host }) {
118
125
  const mainTable = normalizeMainTable(input.mainTable ?? input, this.mainTableKeys);
119
126
  const session = await host.getSession();
120
- const result = await host.request({
127
+ const response = await host.query({
121
128
  path: '/api/esb/server/event/triggerActionFlow',
122
129
  body: esbBody(mainTable, this.uniqueIndent, session.userId),
123
130
  operation: this.name,
124
131
  });
125
- const { resultCode, resultMsg } = esbOutcome(result);
126
- if (resultCode !== 200) {
127
- throw jiuchuanhuiValidationError('esb_read_failed', `动作流查询失败(resultCode=${resultCode}):${resultMsg}`);
128
- }
129
- const customData = result?.actionData?.responseData?.customData;
130
- return {
131
- status: 'COMPLETE',
132
- data: {
133
- resultCode,
134
- resultMsg,
135
- ...(customData && typeof customData === 'object' ? { customData } : {}),
136
- mainTable: customData?.mainTable,
137
- raw: result,
138
- },
139
- };
132
+ return { response };
140
133
  }
141
134
  }
142
135
  function normalizeMainTable(raw, allowedKeys) {
@@ -24,19 +24,13 @@ export class GetQueryOperation {
24
24
  continue;
25
25
  query[key] = Array.isArray(value) ? value.join(',') : value;
26
26
  }
27
- const result = await host.request({
27
+ const response = await host.query({
28
28
  method: 'GET',
29
29
  path: this.path,
30
30
  query,
31
31
  operation: this.name,
32
32
  });
33
- return {
34
- status: 'COMPLETE',
35
- data: {
36
- ...(result && typeof result === 'object' ? { raw: result } : { raw: result }),
37
- query,
38
- },
39
- };
33
+ return { response };
40
34
  }
41
35
  }
42
36
  /** POST raw body 接口(bodyMode=raw):params 原样透传。 */
@@ -62,18 +56,13 @@ export class RawPostOperation {
62
56
  query[key] = String(value);
63
57
  }
64
58
  }
65
- const result = await host.request({
59
+ const response = await host.query({
66
60
  path: this.path,
67
61
  query,
68
62
  body,
69
63
  operation: this.name,
70
64
  });
71
- return {
72
- status: 'COMPLETE',
73
- data: {
74
- ...(result && typeof result === 'object' ? { raw: result } : { raw: result }),
75
- },
76
- };
65
+ return { response };
77
66
  }
78
67
  }
79
68
  /** 占位符路径 raw POST(browser-option-search:path 含 {customBrowserType})。 */
@@ -96,17 +85,12 @@ export class PathParamsPostOperation {
96
85
  path = path.replace(`{${name}}`, encodeURIComponent(String(value)));
97
86
  }
98
87
  const body = input.params && typeof input.params === 'object' ? input.params : {};
99
- const result = await host.request({
88
+ const response = await host.query({
100
89
  path,
101
90
  body,
102
91
  operation: this.name,
103
92
  });
104
- return {
105
- status: 'COMPLETE',
106
- data: {
107
- ...(result && typeof result === 'object' ? { raw: result } : { raw: result }),
108
- },
109
- };
93
+ return { response };
110
94
  }
111
95
  }
112
96
  /** GET 文件预览/下载(get-file-preview):fileId 等 query,save 输出到本地。 */
@@ -129,18 +113,12 @@ export class FilePreviewOperation {
129
113
  query.appId = input.appId;
130
114
  if (input.customParam !== undefined)
131
115
  query.customParam = typeof input.customParam === 'string' ? input.customParam : JSON.stringify(input.customParam);
132
- const result = await host.request({
116
+ const response = await host.query({
133
117
  method: 'GET',
134
118
  path: '/api/file/preview',
135
119
  query,
136
120
  operation: this.name,
137
121
  });
138
- return {
139
- status: 'COMPLETE',
140
- data: {
141
- ...(result && typeof result === 'object' ? { raw: result } : { raw: result }),
142
- fileId,
143
- },
144
- };
122
+ return { response };
145
123
  }
146
124
  }
@@ -1,6 +1,7 @@
1
1
  import { jiuchuanhuiValidationError } from '../errors.js';
2
2
  import { jiuchuanhuiOperations } from '../manifest.js';
3
3
  import { CacheInitOperation } from '../cache.js';
4
+ import { CustomerQuickSearchOperation } from './customer-quick.js';
4
5
  import { DatajsonDetailOperation, DatajsonSearchOperation, DatajsonWriteApplyOperation, DatajsonWritePrepareOperation, } from './datajson.js';
5
6
  import { EsbReadOperation, EsbWriteApplyOperation, EsbWritePrepareOperation, } from './esb.js';
6
7
  import { FilePreviewOperation, GetQueryOperation, PathParamsPostOperation, } from './generic.js';
@@ -12,6 +13,8 @@ import { FilePreviewOperation, GetQueryOperation, PathParamsPostOperation, } fro
12
13
  */
13
14
  function buildRegistry() {
14
15
  const registry = new Map();
16
+ const customerSearch = new DatajsonSearchOperation('jiuchuanhui.customer.search', '/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_search_api', '/api/ebuilder/form/formdata/v2/getFormDataCount/ebcustomer_search_count_api');
17
+ const customerStatusSearch = new DatajsonSearchOperation('jiuchuanhui.customer.status.search', '/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_status_search_api');
15
18
  const handlers = [
16
19
  // ===== 发现与缓存 =====
17
20
  new CacheInitOperation(),
@@ -25,9 +28,12 @@ function buildRegistry() {
25
28
  new DatajsonWritePrepareOperation('jiuchuanhui.customer.create.prepare', 'jiuchuanhui.customer.create.apply'),
26
29
  new DatajsonWriteApplyOperation('jiuchuanhui.customer.create.apply', '/api/ebuilder/form/formdata/v2/saveFormData/customer_create_api'),
27
30
  new DatajsonDetailOperation('jiuchuanhui.customer.get', '/api/ebuilder/form/formdata/v2/getFormDataByPk/customer_get_api'),
28
- new DatajsonSearchOperation('jiuchuanhui.customer.search', '/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_search_api', '/api/ebuilder/form/formdata/v2/getFormDataCount/ebcustomer_search_count_api'),
31
+ customerSearch,
32
+ new CustomerQuickSearchOperation('jiuchuanhui.customer.mine.search', customerSearch, 'mine'),
33
+ new CustomerQuickSearchOperation('jiuchuanhui.customer.success.search', customerSearch, 'mine', customerStatusSearch),
34
+ new CustomerQuickSearchOperation('jiuchuanhui.customer.open-sea.customers.search', customerSearch, 'open-sea'),
29
35
  new DatajsonSearchOperation('jiuchuanhui.customer.type.search', '/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_type_search_api'),
30
- new DatajsonSearchOperation('jiuchuanhui.customer.status.search', '/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_status_search_api'),
36
+ customerStatusSearch,
31
37
  new DatajsonSearchOperation('jiuchuanhui.customer.industry.search', '/api/ebuilder/form/formdata/v2/getFormDataList/ebcustomer_industry_search_api'),
32
38
  new DatajsonSearchOperation('jiuchuanhui.customer.open-sea.search', '/api/ebuilder/form/formdata/v2/getFormDataList/customer_open_sea_search_api'),
33
39
  new DatajsonWritePrepareOperation('jiuchuanhui.customer.update.prepare', 'jiuchuanhui.customer.update.apply'),
@@ -122,16 +122,6 @@ function stripForbidden(value) {
122
122
  export function stripForbiddenKeys(value) {
123
123
  return stripForbidden(value);
124
124
  }
125
- /** 从 datajson-list 响应中安全提取 records 数组。 */
126
- export function listRecords(value) {
127
- if (!value || typeof value !== 'object')
128
- return [];
129
- const root = value;
130
- const datas = root.datajson?.datas;
131
- if (Array.isArray(datas))
132
- return datas;
133
- return [];
134
- }
135
125
  /** datajson 类创建/更新成功后的 dataIds。 */
136
126
  export function resultDataIds(value) {
137
127
  if (!value || typeof value !== 'object')
@@ -52,10 +52,11 @@ async function assess(args, env) {
52
52
  return pfSuccess('performance.flow.assess', {
53
53
  ...context,
54
54
  scoringHints: [
55
- '定量指标:以目标值与实际值(数据源聚合结果)为依据,先算达成率再映射分数',
56
- '定性指标:基于指标说明与可用数据给出可追溯的判断依据,不空泛',
57
- '数据源 error 字段非空的指标标注「无法取数」,不强行打分',
58
- '评分上限为满分(maxScore);超出会被拒绝,不做静默截断',
55
+ '评分必须由 AI 自己给出:禁止向用户询问「这项该打多少分」',
56
+ '依据优先级:①指标描述/等级标准 ②定量(目标值+实际值)→达成率映射 ③实际值缺失或取数失败→替代证据,仍无则中性预评 ④定性无量化→专业判断,无旁证则中性预评',
57
+ '中性预评 = 满分×70%(四舍五入 0.01),理由里必须注明「按中性水平预评」,用户可在详情页调整',
58
+ '数据源 error 字段非空的指标照常给分并在理由注明「取数失败」,不得跳过该行或留空',
59
+ '不得编造实际值;评分上限为满分(maxScore),超出会被拒绝,不做静默截断',
59
60
  ],
60
61
  });
61
62
  }
@@ -1344,6 +1344,9 @@ export function writeCollectCache(payload, batchSize) {
1344
1344
  return String(row?.workflowname ?? row?.workflowName ?? '').trim();
1345
1345
  }).filter(Boolean);
1346
1346
  const batchPrompts = resolvePromptsForBatch(promptEntries, batchWorkflowNames);
1347
+ // 提示词区块置于批次文件头部(2026-11-26 用户定稿):prompt/defaultPrompts 是详读指令,
1348
+ // 放在 rows/details 之前——批次文件体量大头在 details,指令放末尾会被 agent 读取截断
1349
+ // 漏掉(实测:第 1 批未读到 prompts → 误判未命中 → 退回默认口径),放头部彻底规避。
1347
1350
  const batchPayload = {
1348
1351
  collectedAt: payload.collectedAt,
1349
1352
  mode: payload.mode,
@@ -1352,14 +1355,14 @@ export function writeCollectCache(payload, batchSize) {
1352
1355
  batchNo,
1353
1356
  batchTotal: Math.ceil(details.length / size),
1354
1357
  batchSize: size,
1355
- rows: batchRows,
1356
- details: slice,
1357
1358
  // 默认详读提示词(2026-11-24 用户定稿:唯一提示词源 = config defaultPrompt):
1358
1359
  // 每个批次文件都带 defaultPrompts 区块,未命中 prompts 条目的详读指令来源
1359
1360
  ...(payload.defaultPrompts && typeof payload.defaultPrompts === 'object'
1360
1361
  ? { defaultPrompts: payload.defaultPrompts }
1361
1362
  : {}),
1362
1363
  ...(batchPrompts.length > 0 ? { prompts: batchPrompts } : {}),
1364
+ rows: batchRows,
1365
+ details: slice,
1363
1366
  };
1364
1367
  const batchFile = join(dir, `aiDeepRead-batch-${stamp}-${String(batchNo).padStart(2, '0')}.json`);
1365
1368
  const batchJson = JSON.stringify(batchPayload, null, 2);
@@ -8,13 +8,14 @@
8
8
 
9
9
  ## 公共前置
10
10
 
11
- 先通过 E10 鉴权模块登录:
11
+ 同一对话使用同一 E10 环境和账号时,复用已有登录判断。首次尚无判断时运行 `weaver-work-cli --json auth status --no-check`;需要建立会话时再通过 E10 鉴权模块登录:
12
12
 
13
13
  ```text
14
14
  weaver-work-cli auth login --base-url "https://jchdemo.e-cology.cn" --agent_type "<当前智能体名称>"
15
- weaver-work-cli auth status --no-check
16
15
  ```
17
16
 
17
+ 后续业务命令直接使用已保存的会话。切换环境或账号、退出登录、业务请求返回认证失败时,按新状态处理。
18
+
18
19
  每个九氚汇业务请求由 CLI 托管:
19
20
 
20
21
  1. 读取当前 `weaver-work-cli auth` Profile 的 E10 会话。
@@ -41,9 +42,9 @@ weaver-work-cli jiuchuanhui schema
41
42
  weaver-work-cli --json jiuchuanhui run jiuchuanhui.customer.search --input-json '{"customer_name":"小康","mine":"","all":"-1","customerSea":"-1","pageNo":1,"pageSize":10}'
42
43
  ```
43
44
 
44
- 成功和失败都使用 JSON envelope。成功写 stdout;失败写 stderr,并设置非 0 退出码。
45
+ 查询收到接口响应后,将原始响应体放入 stdout JSON envelope 的 `data`。`meta.httpStatus` 记录 HTTP 状态,`ok:true` 表示 CLI 已收到并输出响应。业务状态码、字段和业务错误消息以响应体为准。需要认证或请求未能完成时,CLI 走结构化错误路径。
45
46
 
46
- 当前输出层是完整 JSON 直接写 stdout,不提供飞书 CLI 的 `--jq`、`--format table/ndjson` 或通用 `--page-all`。Agent 使用时应默认小页读取和摘要渲染:列表先 `pageNo=1`、`pageSize=10`,按 `pageNo` 继续;回复只展示关键字段和数量,超长详情 JSON 落本地文件后给路径。
47
+ 使用 `weaver-work-cli jiuchuanhui schema --operation <name>` 查询单项契约。查询响应完整输出。列表默认 `pageNo=1`、`pageSize=10`,请求总数时将总数接口的原始响应放在顶层 `countResponse`,HTTP 状态放在 `meta.countHttpStatus`。写入失败或 CLI 错误在 `--json` 下以一个 JSON 对象写入 stderr,保留结构化 `error` 和适用的平台错误码。
47
48
 
48
49
  ## Operation 目录
49
50
 
@@ -68,6 +69,16 @@ weaver-work-cli --json jiuchuanhui run jiuchuanhui.customer.search --input-json
68
69
 
69
70
  ## 常用命令
70
71
 
72
+ 查询我的客户、成功客户、公海客户可直接调用以下只读入口,默认返回第一页 10 条。
73
+
74
+ ```text
75
+ weaver-work-cli --json jiuchuanhui run jiuchuanhui.customer.mine.search
76
+ weaver-work-cli --json jiuchuanhui run jiuchuanhui.customer.success.search
77
+ weaver-work-cli --json jiuchuanhui run jiuchuanhui.customer.open-sea.customers.search
78
+ ```
79
+
80
+ 三个入口都支持 `customer_name`、`pageNo`、`pageSize` 和 `count`。成功客户按租户的客户状态字典匹配「成功」或「成功客户」。默认在我的客户范围查询,也可显式传 `scope` 为 `all` 或 `open-sea`。公海客户入口返回客户记录,公海名称及 ID 仍通过 `customer.open-sea.search` 获取。
81
+
71
82
  Windows PowerShell:
72
83
 
73
84
  ```powershell
@@ -118,6 +129,7 @@ weaver-work-cli --json jiuchuanhui run jiuchuanhui.sale.win.apply --input-json '
118
129
  - 向用户摘要目标、差异、风险和 continuation 绑定含义。
119
130
  - 用户明确确认后才调用 `apply`(`confirm:true` + 有效 continuation)。
120
131
  - `apply` 不可盲目重试;遇到 `partial/write_uncertain` 先停止,再做一次只读回查(如 `customer.get`/`sale.get`/`clue.get`)。
132
+ - 公海领取收到明确的无领取权限提示时,返回 `permission/claim_forbidden` 和 E10 原始提示,`retryable` 为 `false`。
121
133
 
122
134
  写操作出现网络中断、部分成功、缺少回执 ID 或回查失败时,CLI 返回 `partial/write_uncertain`,Agent 禁止自动重复提交。
123
135
 
@@ -125,7 +137,7 @@ weaver-work-cli --json jiuchuanhui run jiuchuanhui.sale.win.apply --input-json '
125
137
 
126
138
  - 选项字段(Select/RadioBox/CheckBox)必须先取选项 ID 再传值;`RelateBrowser` 字段通过 `browser-option.search` 查对应类型选项。
127
139
  - 行政区划传逗号分隔全路径 ID(`country,province,city,district`),传细粒度自动填充粗粒度。
128
- - 客户搜索必须显式传 `mine`/`all`/`customerSea` 三个 key(一个 `""` 其余 `-1`),没有 `scope` 快捷参数。
140
+ - 通用 `customer.search` 显式传 `mine`/`all`/`customerSea` 三个范围键(一个 `""`,其余 `"-1"`)。快捷查询内部组装这三个键。
129
141
  - 列表、卡片及详情中的关联事项名称渲染为可点击链接 `https://{baseUrl}/sp/ebdfpage/card/0/{objId}/{dataId}`。
130
142
  - 新建客户前先查重;客户在公海时提醒可领取。
131
143
  - 线索转新客户走客户创建且传 `source_module_id=<clueId>`,成功后不再额外修改线索。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weaver-work-cli",
3
- "version": "0.1.69",
3
+ "version": "0.1.70",
4
4
  "description": "面向泛微工作工具链的可扩展 TypeScript CLI 基础框架(E10 业票通等能力)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",