@petercjl/taobao-ai-ops 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,10 +24,26 @@ SealSeek 用户改用 --agent sealseek。目标有歧义时通过 SEALSEEK_SKILL
24
24
  - @petercjl/taobao-search-product-form:搜索结果数据和商品形态研究、机会判断卡及 HTML。
25
25
  - @petercjl/tbcli:淘宝数据与 NAS 数据库工具,含其独立 Skill。
26
26
  - @petercjl/sycmcli:店铺经营数据工具,含其独立 Skill。
27
+ - @petercjl/commerce-ui:通用 HTML 报告 Skill、模板、渲染与校验。调用 `taobao-ai-ops component run html-report ...`;Python 依赖不足时通过该入口执行 `runtime install --yes`。
28
+ - @petercjl/procli:项目 SOP、任务依赖与成果归档,配套 `project-management` Skill。任务卡组织工作,项目 Wiki 积累可复用的证据与结论。
27
29
  - taobao-ai-operations:套件自带的管理与业务路由 Skill。
28
30
 
29
31
  yccli 为取数时按需准备的外部工具,可用 TAOBAO_AI_OPS_YCCLI 指定;Excel 分析不需要 NAS、VPN 或平台登录。账号与授权留在包外,安装不会获得服务权限。
30
32
 
33
+ ## 项目主线与知识复用
34
+
35
+ procli 是跨业务节点的公共能力:先读取项目的任务与已编译 Wiki,确定本次研究问题,再调用对应的独立研究工具;用户授权归档后,通过 `task publish` 将完整成果关联到指定项目和任务,供下一阶段读取。
36
+
37
+ 任务卡保存工作说明、责任人、依赖、状态和验收要求;钉钉文档与可选 HTML 面向人;完整报告 Wiki 与节点累计知识面向 Agent,保留数据口径、观察窗口、来源、分歧和待验证问题。普通 `task update` 只编辑任务字段;成果发布需要内容包与独立授权,报告完成也不等于任务已审批。
38
+
39
+ ```sh
40
+ taobao-ai-ops skill source --name project-management --json
41
+ taobao-ai-ops tool run procli directory list --json
42
+ taobao-ai-ops component run procli knowledge index --project "项目名称" --json
43
+ ```
44
+
45
+ 向 Agent 明确说“用 procli”,并指定项目、任务及读取或归档目标。按当前 `project-management` Skill 解析真实名称和目标环境。项目读写需项目服务授权;发布钉钉文档还需官方 dws 与对应权限。服务不可访问时报告原目标错误并停止该操作,已有 Excel 研究可独立进行。套件不自动创建所有 SOP 任务、执行整条业务链或向项目写入研究结果;现有项目的真实 SOP 与依赖以 procli 读取结果为准。
46
+
31
47
  ## 调用与开发
32
48
 
33
49
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@petercjl/taobao-ai-ops",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Independent Taobao AI operations SOP skills with a managed suite lifecycle",
5
5
  "repository": {
6
6
  "type": "git",
package/requirements.txt CHANGED
@@ -3,3 +3,4 @@ numpy>=1.26,<3
3
3
  openpyxl>=3.1,<4
4
4
  Pillow>=10,<13
5
5
  jieba>=0.42,<1
6
+ jsonschema>=4.23,<5
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: taobao-ai-operations
3
- description: Route a Taobao operator's research request to independently usable category-opportunity and search-product research nodes, preserve evidence handoffs, and track a multi-node research run.
3
+ description: Route Taobao research to independent tools, preserve evidence handoffs, and use procli for explicitly requested project SOP, task context and cumulative knowledge publication.
4
4
  ---
5
5
 
6
6
  # Taobao AI operations
@@ -10,18 +10,30 @@ Input: an operator's goal, supplied workbooks or authorized data sources, option
10
10
  ## Main line
11
11
 
12
12
  1. Resolve the requested business result with `taobao-ai-ops nodes list --json`. A category/monthly market question uses `category-research`; a search-result workbook and concrete research object use `product-research`. Existing product scope can enter product research directly. If no supported node covers the request, report the missing node.
13
+ An explicit request to use `procli` for project/task information, SOP progression, knowledge reuse or result publication uses `project-management`. Preserve this child's explicit-trigger contract; offering project integration does not authorize service reads or writes. For an authorized project-backed research request, resolve the project and read its task context and compiled Wiki before selecting the business research node. Preserve the target profile, exact project/task identities, observation windows, provenance and unresolved questions in the handoff.
14
+ A supplied analysis or compatible ViewModel requiring a reusable HTML report uses `html-report`, whose exact Skill is `compact-commerce-ui`. It supplies reporting methods, not business conclusions; existing category/product outputs keep their own declared contracts.
13
15
  2. Run `taobao-ai-ops doctor --node NODE --mode excel --json` for local workbooks, or `--mode nas` for live category data. Doctor checks deterministic resources; verify any listed native capabilities in the active Agent before their stage. A missing dependency ends the affected node with its exact error.
14
16
  3. Resolve the exact child Skill with `taobao-ai-ops skill source --name SKILL --json`. Read its complete current SKILL.md, load its platform adapter, then follow only the child node's current reference routes. The logical dependencies are `yuce-category-opportunity-report` (method contract `yuce-category-opportunity@2.0`) and `taobao-search-product-form` (imported method `0.1.1`). Their returned artifacts and source hashes are the handoff; resolution or contract failure stops with CAPABILITY_UNAVAILABLE or OUTPUT_CONTRACT_FAILED. Return here at step 4 after the child completes. Naming a Skill alone is not execution.
15
17
  4. Preserve the child's analysis, full HTML and evidence files. Use `taobao-ai-ops workflow plan --run-dir NEW_DIR --node NODE --input WORKBOOK --json` when a durable suite plan is requested; this records a plan and fixed suite/method versions, not business completion. The product node's own stage ledger remains authoritative for its detailed execution.
16
18
  5. For category-to-product handoff, obtain the selected full category path and explicit search query. Use `taobao-ai-ops handoff create --node category-research --input ANALYSIS.json --candidate FULL_PATH --query QUERY --out NEW_HANDOFF.json`. It preserves the selected evidence and its source hash. Request or obtain an authorized search-result workbook before running product research. Category growth retains its category/time grain; it is not a product-growth fact.
17
19
  6. Deliver the complete child result and the current next research question. A handoff with missing input is needs_input; a plan or resource probe is not verified business output.
18
20
 
21
+ ## Project continuity through procli
22
+
23
+ The registered component `procli` owns the exact `project-management` Skill and its live CLI contracts. Resolve it with `taobao-ai-ops skill source --name project-management --json`, read its complete current instructions, capabilities and active-platform adapter, then delegate through `taobao-ai-ops component run procli ...` or `taobao-ai-ops tool run procli ...`. Resolve its live version/capabilities. Contract: project intent plus exact resolved context and optional full research artifacts in; verified task/knowledge results and source-linked next questions out. Resolution, authentication or service failure ends only the affected project operation; report the selected target without switching profiles. Return to main-line step 4 after project reads or step 6 after publication.
24
+
25
+ Tasks organize SOP work, dependencies, responsibility and acceptance; Wiki preserves reusable knowledge across independent tools. Read compiled knowledge through the child's `knowledge index/query` flow; use `--reports` for full evidence tables, with compilation/freshness limits reported. Task metadata is not a substitute for knowledge. A next-stage request should carry the project/task, research question, evidence periods and known gaps rather than requiring the employee to repeat prior conclusions.
26
+
27
+ When the user explicitly authorizes archiving to an exact project/task, prepare the current child's publication bundle, preserving the complete report and its evidence, and use `task publish`: preview, inspect the target and coverage, then publish with the same bundle/key and verify readback. Existing sources require cumulative synthesis with source citations. The child owns DingTalk creation, optional HTML attachment, full report Wiki, cumulative node knowledge and task-card summary; the Agent owns evidence-based meaning. Handle partial/unknown writes only through the child's recovery flow. Ordinary `task update` is a field edit, and publication is separate from submission/reviewer approval. The shell neither copies these business rules into runtime code nor automatically executes every SOP node. New tools can join project workflows through these contracts while retaining independent analysis methods.
28
+
19
29
  ## Execution and branches
20
30
 
21
31
  Component scripts run via `taobao-ai-ops script NODE SCRIPT ...`; supplied Excel does not require platform accounts. Optional platform calls use `taobao-ai-ops tool run TOOL ...` so the shell selects the installed independent component. Accounts, warehouse access and write permissions remain external. The category child's database-consent and additive-import boundaries apply in its NAS route.
22
32
 
23
33
  When a child was installed by the shell, forward its CLI examples through `taobao-ai-ops component run COMPONENT ...`, retaining all remaining arguments. This resolves the actual independent package even when its CLI is not on PATH or another global version exists. Use the shell's unified update entry for shell-managed components; a child's standalone global updater belongs only to independent global installations.
24
34
 
35
+ The shared HTML component is `@petercjl/commerce-ui`. Load `compact-commerce-ui` through named Skill source resolution, then invoke `taobao-ai-ops component run html-report ...` for template discovery, schema, rendering, validation and custom pack lifecycle. Inputs are source evidence and report intent or a live-contract ViewModel; outputs are a new JSON, HTML and validation results. Missing runtime/contract/browser capabilities retain the child's explicit failure boundary. Return to step 4 after reporting. Compatible shared improvements belong in that independent package; adding a component belongs in the shell registry.
36
+
25
37
  The shell registers independent npm packages; each owns its method, resources and release. Ordinary tasks use installed versions. On an explicit install/update request, use `taobao-ai-ops skill install --agent AGENT` or `taobao-ai-ops update install --agent AGENT --yes`; the latter checks both shell and every registered component's stable latest version even when the shell is unchanged. Inspect returned versions and managed Skill state. Registry failure preserves current components; local edits stop synchronization. Missing components return COMPONENT_NOT_INSTALLED and require authorized installation before returning to step 2. Development registrations update through their Git owners and are reported separately. Skill source resolves to each component's own canonical package, not a shell copy.
26
38
 
27
39
  Current node selection and source resolution are deterministic contracts, with method judgment owned by each child Skill. The package manifest is the node registry and shared contracts are maintained in the package's contracts directory. Do not load unrelated node methods at startup.
@@ -17,7 +17,11 @@ export async function inspectComponent(id,root){
17
17
  for(const skill of c.skills){
18
18
  const r=spawnSync(process.execPath,[entry,'skill','source','--json'],{encoding:'utf8',timeout:30000,env:{...process.env,TBCLI_UPDATE_CHECK:'0',SYCMCLI_DISABLE_AUTO_UPDATE:'1'}});
19
19
  if(r.status!==0)throw fail('COMPONENT_SOURCE_FAILED',r.stderr||id);
20
- const result=JSON.parse(r.stdout);const s=result.source||(result.skills||[]).find(s=>s.skill===skill)?.source;
20
+ const envelope=JSON.parse(r.stdout);
21
+ if(envelope.ok===false)throw fail('COMPONENT_SOURCE_FAILED',id, envelope.error);
22
+ const result=envelope.data??envelope;
23
+ if(result.skill&&result.skill!==skill)throw fail('SKILL_IDENTITY_MISMATCH',skill);
24
+ const s=result.source||(result.skills||[]).find(s=>s.skill===skill)?.source;
21
25
  if(!s||!path.resolve(s).startsWith(path.resolve(root)+path.sep))throw fail('INVALID_COMPONENT_SOURCE',skill);
22
26
  const text=await fs.readFile(path.join(s,'SKILL.md'),'utf8');
23
27
  if(!new RegExp(`^name: ${skill}\\s*$`,'m').test(text))throw fail('SKILL_IDENTITY_MISMATCH',skill);
package/src/runtime.mjs CHANGED
@@ -39,7 +39,20 @@ export async function doctor(id,mode='excel'){
39
39
  const children=await Promise.all(n.requires_skills.map(skill=>doctor(skill,mode)));
40
40
  return {ok:checks.every(c=>c.ok)&&children.every(c=>c.ok),package:PACKAGE.name,version:PACKAGE.version,node:n.id,checks,children,native_requirements:children.flatMap(c=>c.native_requirements)};
41
41
  }
42
- if(n.python_imports.length){const python=resolvePython(n.python_imports);checks.push({id:'python',ok:Boolean(python),value:python,required_imports:n.python_imports});}
42
+ if(n.python_imports.length&&n.id!=='html-report'){const python=resolvePython(n.python_imports);checks.push({id:'python',ok:Boolean(python),value:python,required_imports:n.python_imports});}
43
+ if(n.id==='html-report'){
44
+ const record=componentRecord(n.component);
45
+ const result=spawnSync(process.execPath,[record.entry,'doctor','--json'],{encoding:'utf8',timeout:30000,env:pythonEnvironment()});
46
+ let detail;try{detail=JSON.parse(result.stdout||result.stderr);}catch{detail={message:result.stderr||'Unparseable component doctor'};}
47
+ checks.push({id:'html-component-runtime',ok:result.status===0,value:detail});
48
+ }
49
+ if(n.component==='procli'){
50
+ const record=componentRecord(n.component);
51
+ const result=spawnSync(process.execPath,[record.entry,'--version'],{encoding:'utf8',timeout:15000});
52
+ let version;try{const data=JSON.parse(result.stdout);version=(data.data??data).version;}catch{}
53
+ checks.push({id:'procli-runtime',ok:result.status===0&&version===record.version,value:version});
54
+ checks.push({id:'procli-contract',ok:fs.existsSync(path.join(source(n),'capabilities.json'))});
55
+ }
43
56
  if(n.id==='category-research')checks.push({id:'report-runtime',ok:['assets/report-template.html','assets/chart-views.js'].every(p=>fs.existsSync(path.join(source(n),p)))});
44
57
  if(n.id==='product-research'){
45
58
  const componentRequire=createRequire(path.join(componentRecord(n.component).root,'package.json'));
@@ -48,5 +61,5 @@ export async function doctor(id,mode='excel'){
48
61
  }
49
62
  if(!['excel','nas'].includes(mode))throw fail('USAGE','Doctor mode must be excel or nas');
50
63
  if(mode==='nas'&&n.id==='category-research')for(const id of ['tbcli','yccli']){try{const tool=toolEntry(id);const r=spawnSync(tool.command,[...tool.args,'--version'],{encoding:'utf8',timeout:15000,env:{...process.env,TBCLI_UPDATE_CHECK:'0'}});checks.push({id,ok:r.status===0,value:r.stdout?.trim()});}catch(e){checks.push({id,ok:false,message:e.message});}}
51
- return {ok:checks.every(c=>c.ok),package:PACKAGE.name,version:PACKAGE.version,node:n.id,mode,checks,native_requirements:n.native_requirements.map(id=>({id,status:'requires-active-agent-verification'})),service_access:mode==='nas'?'not-probed':'not-required'};
64
+ return {ok:checks.every(c=>c.ok),package:PACKAGE.name,version:PACKAGE.version,node:n.id,mode,checks,native_requirements:n.native_requirements.map(id=>({id,status:'requires-active-agent-verification'})),service_access:mode==='nas'||n.component==='procli'?'not-probed':'not-required'};
52
65
  }
@@ -7,10 +7,23 @@
7
7
  "category-research",
8
8
  "product-research",
9
9
  "tbcli-tools",
10
- "sycmcli-tools"
10
+ "sycmcli-tools",
11
+ "html-report",
12
+ "project-management"
11
13
  ]
12
14
  },
13
15
  "nodes": [
16
+ {
17
+ "id": "html-report",
18
+ "skill": "compact-commerce-ui",
19
+ "component": "html-report",
20
+ "stage": "shared-reporting",
21
+ "method_version": "commerce-ui-template-pack@1",
22
+ "requires_skills": [],
23
+ "python_imports": ["jsonschema"],
24
+ "scripts": [],
25
+ "native_requirements": ["browser.report.inspect"]
26
+ },
14
27
  {
15
28
  "id": "operations",
16
29
  "skill": "taobao-ai-operations",
@@ -18,7 +31,8 @@
18
31
  "method_version": "1.0",
19
32
  "requires_skills": [
20
33
  "yuce-category-opportunity-report",
21
- "taobao-search-product-form"
34
+ "taobao-search-product-form",
35
+ "compact-commerce-ui"
22
36
  ],
23
37
  "python_imports": [],
24
38
  "scripts": [],
@@ -83,6 +97,18 @@
83
97
  ],
84
98
  "component": "product-research"
85
99
  },
100
+ {
101
+ "id": "project-management",
102
+ "skill": "project-management",
103
+ "component": "procli",
104
+ "stage": "shared-project-knowledge",
105
+ "method_version": "procli-task-publish-bundle@1",
106
+ "requires_skills": [],
107
+ "python_imports": [],
108
+ "scripts": [],
109
+ "native_requirements": [],
110
+ "optional_tools": ["dws"]
111
+ },
86
112
  {
87
113
  "id": "tbcli-tools",
88
114
  "skill": "tbcli",
@@ -105,6 +131,16 @@
105
131
  }
106
132
  ],
107
133
  "tools": {
134
+ "procli": {
135
+ "package": "@petercjl/procli",
136
+ "component": "procli",
137
+ "role": "project SOP, task dependencies, research publication and cumulative Agent Wiki"
138
+ },
139
+ "commerce-ui": {
140
+ "package": "@petercjl/commerce-ui",
141
+ "component": "html-report",
142
+ "role": "versioned HTML templates, rendering and validation"
143
+ },
108
144
  "tbcli": {
109
145
  "package": "@petercjl/tbcli",
110
146
  "entry": "scripts/tbcli.mjs",
@@ -138,6 +174,16 @@
138
174
  "source_checkout": "git-managed"
139
175
  },
140
176
  "components": {
177
+ "procli": {
178
+ "package": "@petercjl/procli",
179
+ "bin": "procli",
180
+ "skills": ["project-management"]
181
+ },
182
+ "html-report": {
183
+ "package": "@petercjl/commerce-ui",
184
+ "bin": "commerce-ui",
185
+ "skills": ["compact-commerce-ui"]
186
+ },
141
187
  "category-research": {
142
188
  "package": "@petercjl/yuce-category-opportunity-report",
143
189
  "bin": "yuce-category-research",