bpmax-cli 0.1.44-beta.1 → 0.1.44-beta.3

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 (28) hide show
  1. package/dist/bin.js +114 -2
  2. package/dist/bin.js.map +1 -1
  3. package/package.json +1 -1
  4. package/scripts/install-skills.mjs +98 -0
  5. package/skills/bpmax-api-platform-editor/SKILL.md +1 -1
  6. package/skills/bpmax-console-template-editor/SKILL.md +1 -1
  7. package/skills/bpmax-dataset-field-template-editor/SKILL.md +1 -1
  8. package/skills/bpmax-dataset-template-editor/SKILL.md +1 -1
  9. package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +1 -1
  10. package/skills/bpmax-e2e-flow-test-operator/SKILL.md +25 -3
  11. package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +8 -0
  12. package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +9 -4
  13. package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +25 -0
  14. package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +26 -0
  15. package/skills/bpmax-filter-template-editor/SKILL.md +1 -1
  16. package/skills/bpmax-flow-template-editor/SKILL.md +1 -1
  17. package/skills/bpmax-form-template-editor/SKILL.md +1 -1
  18. package/skills/bpmax-list-template-editor/SKILL.md +1 -1
  19. package/skills/bpmax-memory-protocol/SKILL.md +72 -0
  20. package/skills/bpmax-nav-config-editor/SKILL.md +1 -1
  21. package/skills/bpmax-project-detail-template-editor/SKILL.md +1 -1
  22. package/skills/bpmax-role-editor/SKILL.md +1 -1
  23. package/skills/bpmax-user-mock-operator/SKILL.md +106 -0
  24. package/skills/bpmax-user-mock-operator/agents/openai.yaml +4 -0
  25. package/skills/bpmax-user-mock-operator/scripts/switch_user_identity.py +37 -0
  26. package/skills/bpmax-user-mock-operator/scripts/user_mock_operator_common.py +136 -0
  27. package/skills/bpmax-user-mock-operator/tests/test_user_mock_operator.py +138 -0
  28. package/skills/form-control-library/SKILL.md +1 -1
package/dist/bin.js CHANGED
@@ -206,7 +206,10 @@ var CLI_GOVERNANCE_PATHS = [
206
206
  "/api/cli/audit/start",
207
207
  "/api/cli/audit/finish",
208
208
  "/api/cli/bbs_invocations/start",
209
- "/api/cli/bbs_invocations/finish"
209
+ "/api/cli/bbs_invocations/finish",
210
+ "/api/cli/memory/status",
211
+ "/api/cli/memory/search",
212
+ "/api/cli/memory"
210
213
  ];
211
214
  var CLI_GOVERNANCE_UNSUPPORTED_MESSAGE = "\u5F53\u524D BPMAX \u5E73\u53F0\u7248\u672C\u4E0D\u652F\u6301 CLI \u6CBB\u7406\u80FD\u529B\uFF0C\u8BF7\u5347\u7EA7 huanpingtong-server \u540E\u518D\u4F7F\u7528 bpmax-cli 0.1.42+ \u7684\u8FDC\u7AEF\u4E1A\u52A1\u547D\u4EE4\u3002";
212
215
  function toCliGovernanceUnsupportedError(error, fallbackPath) {
@@ -268,6 +271,13 @@ function capabilityForRequest(method, path9) {
268
271
  if (normalizedPath.startsWith("/cli/bbs_invocations/")) {
269
272
  return void 0;
270
273
  }
274
+ if (normalizedMethod === "GET" && normalizedPath === "/cli/memory/status") return "memory.status";
275
+ if (normalizedMethod === "POST" && normalizedPath === "/cli/memory/search") return "memory.search";
276
+ if (normalizedMethod === "GET" && normalizedPath === "/cli/memory") return "memory.list";
277
+ if (normalizedMethod === "POST" && normalizedPath === "/cli/memory") return "memory.add";
278
+ if (normalizedMethod === "GET" && /^\/cli\/memory\/[^/]+$/.test(normalizedPath)) return "memory.get";
279
+ if (normalizedMethod === "PUT" && /^\/cli\/memory\/[^/]+$/.test(normalizedPath)) return "memory.update";
280
+ if (normalizedMethod === "DELETE" && /^\/cli\/memory\/[^/]+$/.test(normalizedPath)) return "memory.delete";
271
281
  if (normalizedMethod === "GET" && normalizedPath === "/user/current") return "user.current";
272
282
  if (normalizedMethod === "GET" && normalizedPath === "/workspace/by_key") return "flow.list";
273
283
  if (normalizedMethod === "GET" && normalizedPath === "/flow/flow_type") return "flow.list";
@@ -372,7 +382,7 @@ function normalizePath2(path9) {
372
382
  // package.json
373
383
  var package_default = {
374
384
  name: "bpmax-cli",
375
- version: "0.1.44-beta.1",
385
+ version: "0.1.44-beta.3",
376
386
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
377
387
  type: "module",
378
388
  bin: {
@@ -4459,6 +4469,7 @@ ${configEnabled ? "" : "> \u5F53\u524D profile \u7684 API Key \u5C1A\u672A\u5F00
4459
4469
  | --- | --- | --- |
4460
4470
  ${rows}
4461
4471
  | \u6700\u65B0\u914D\u7F6E\u540C\u6B65 | \`bpmax-config-latest\` | \`${commandPrefix3} config latest pull ${options.env}\` |
4472
+ | \u957F\u671F\u8BB0\u5FC6 | \`bpmax-memory-protocol\` | \`${commandPrefix3} memory search --scope all --query "<workspace> <flow_type> <task>"\` |
4462
4473
  | \u5B8C\u6574\u914D\u7F6E\u7F16\u6392 | \`bpmax-e2e-flow-config-orchestrator\` | \u6309\u7F16\u6392 Skill \u6267\u884C |
4463
4474
  | \u7AEF\u5230\u7AEF\u56DE\u5F52 | \`bpmax-e2e-flow-test-operator\` | \u6309\u56DE\u5F52 Skill \u6267\u884C |
4464
4475
 
@@ -4487,6 +4498,20 @@ ${commandPrefix3} config <domain> verify --id <id> --expect <work-file> --profil
4487
4498
  ${commandPrefix3} config workspace init ${envArg} --profile ${profileArg} --workspace-dir ${shellQuote3(options.environment.sysconfig_repo_path)} --format json
4488
4499
  ${commandPrefix3} config latest pull ${envArg} --profile ${profileArg} --format json
4489
4500
  \`\`\`
4501
+
4502
+ ## Memory \u4F7F\u7528\u89C4\u5219
4503
+ \u5F00\u59CB\u914D\u7F6E\u3001\u6392\u67E5\u6216\u6D4B\u8BD5\u524D\uFF0C\u5148\u8C03\u7528 \`bpmax-memory-protocol\` \u6216\u76F4\u63A5\u641C\u7D22 BPMAX memory\u3002\u67E5\u8BE2\u8BCD\u81F3\u5C11\u5305\u542B\u4E1A\u52A1\u540D\u3001workspace\u3001flow_type\u3001\u6A21\u677F/\u6570\u636E\u96C6/\u5BF9\u8C61 id \u548C\u76EE\u6807\u52A8\u4F5C\u3002
4504
+
4505
+ \`\`\`bash
4506
+ ${commandPrefix3} memory status --profile ${profileArg} --format json
4507
+ ${commandPrefix3} memory search --profile ${profileArg} --scope all --query "${display(options.environment.workspace || options.profile.workspace)} <flow_type> <task>" --format json
4508
+ \`\`\`
4509
+
4510
+ \u9A8C\u8BC1\u901A\u8FC7\u540E\uFF0C\u53EA\u5199\u53EF\u590D\u7528\u7ED3\u8BBA\uFF1A\`decision\`\u3001\`task_learning\`\u3001\`anti_pattern\`\u3001\`environmental\` \u6216 \`convention\`\u3002\u672A\u5B8C\u6210\u6216\u4E2D\u65AD\u6001\u53EA\u5199 \`session_state\`\u3002\u7981\u6B62\u5199\u5165 API Key\u3001Authorization\u3001token\u3001password\u3001\u9A8C\u8BC1\u7801\u3001\u624B\u673A\u53F7\u3001\u5B8C\u6574 payload \u6216\u5927\u6BB5\u63A5\u53E3\u54CD\u5E94\u3002
4511
+
4512
+ \`\`\`bash
4513
+ ${commandPrefix3} memory add --profile ${profileArg} --scope user --text "<learning>" --metadata '{"type":"task_learning","project_id":"bpmax","workspace":"${display(options.environment.workspace || options.profile.workspace)}"}' --format json
4514
+ \`\`\`
4490
4515
  ${end}
4491
4516
  `;
4492
4517
  }
@@ -5784,6 +5809,85 @@ function registerInitCommand(program2, deps = {}) {
5784
5809
  });
5785
5810
  }
5786
5811
 
5812
+ // src/commands/memory.ts
5813
+ function parseLimit(input, fallback) {
5814
+ const value = Number(input ?? fallback);
5815
+ if (!Number.isInteger(value) || value <= 0 || value > 100) {
5816
+ throw new Error("limit must be an integer between 1 and 100.");
5817
+ }
5818
+ return value;
5819
+ }
5820
+ function normalizeScope(scope, allowAll) {
5821
+ const value = scope || "user";
5822
+ const allowed = allowAll ? ["user", "organization", "all"] : ["user", "organization"];
5823
+ if (!allowed.includes(value)) {
5824
+ throw new Error(`scope must be one of: ${allowed.join(", ")}.`);
5825
+ }
5826
+ return value;
5827
+ }
5828
+ async function parseOptionalJson(input, label) {
5829
+ if (!input) {
5830
+ return void 0;
5831
+ }
5832
+ return parseJsonInput(input, label);
5833
+ }
5834
+ async function memoryRequest(options, method, path9, capability, data, params) {
5835
+ const profile = resolveProfile(await loadConfig(), options.profile);
5836
+ const client = createApiClient(profile);
5837
+ return apiRequest(client, method, path9, {
5838
+ capability,
5839
+ data: redactAuditValue(data),
5840
+ params: params ? redactAuditValue(params) : void 0
5841
+ });
5842
+ }
5843
+ function registerMemoryCommands(program2) {
5844
+ const memory = program2.command("memory").description("Search and write BPMAX agent-scoped memory through the platform proxy");
5845
+ memory.command("status").description("Check BPMAX memory proxy and backend status").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (options) => {
5846
+ const result = await memoryRequest(options, "GET", "/cli/memory/status", "memory.status");
5847
+ printResult(options.format, result);
5848
+ });
5849
+ memory.command("search").description("Search BPMAX memory for the current API-key agent").requiredOption("--query <text>", "Search query").option("--scope <scope>", "Memory scope: user, organization, or all", "user").option("--limit <limit>", "Maximum result count", "10").option("--filters <json>", "Optional JSON filters or @file").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (options) => {
5850
+ const result = await memoryRequest(options, "POST", "/cli/memory/search", "memory.search", {
5851
+ query: options.query,
5852
+ scope: normalizeScope(options.scope, true),
5853
+ limit: parseLimit(options.limit, 10),
5854
+ filters: await parseOptionalJson(options.filters, "--filters")
5855
+ });
5856
+ printResult(options.format, result);
5857
+ });
5858
+ memory.command("add").description("Add BPMAX memory for the current API-key agent").requiredOption("--text <text>", "Memory text").option("--scope <scope>", "Memory scope: user or organization", "user").option("--metadata <json>", "Optional JSON metadata or @file").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (options) => {
5859
+ const result = await memoryRequest(options, "POST", "/cli/memory", "memory.add", {
5860
+ text: options.text,
5861
+ scope: normalizeScope(options.scope, false),
5862
+ metadata: await parseOptionalJson(options.metadata, "--metadata")
5863
+ });
5864
+ printResult(options.format, result);
5865
+ });
5866
+ memory.command("list").description("List BPMAX memory when supported by the platform proxy").option("--scope <scope>", "Memory scope: user, organization, or all", "user").option("--limit <limit>", "Maximum result count", "20").option("--filters <json>", "Optional JSON filters or @file").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (options) => {
5867
+ const result = await memoryRequest(options, "GET", "/cli/memory", "memory.list", void 0, {
5868
+ scope: normalizeScope(options.scope, true),
5869
+ limit: parseLimit(options.limit, 20),
5870
+ filters: options.filters ? JSON.stringify(await parseOptionalJson(options.filters, "--filters")) : void 0
5871
+ });
5872
+ printResult(options.format, result);
5873
+ });
5874
+ memory.command("get <id>").description("Get one BPMAX memory item when supported by the platform proxy").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (id, options) => {
5875
+ const result = await memoryRequest(options, "GET", `/cli/memory/${encodeURIComponent(id)}`, "memory.get");
5876
+ printResult(options.format, result);
5877
+ });
5878
+ memory.command("update <id>").description("Update one BPMAX memory item when supported by the platform proxy").requiredOption("--text <text>", "Replacement memory text").option("--metadata <json>", "Optional JSON metadata or @file").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (id, options) => {
5879
+ const result = await memoryRequest(options, "PUT", `/cli/memory/${encodeURIComponent(id)}`, "memory.update", {
5880
+ text: options.text,
5881
+ metadata: await parseOptionalJson(options.metadata, "--metadata")
5882
+ });
5883
+ printResult(options.format, result);
5884
+ });
5885
+ memory.command("delete <id>").description("Delete one BPMAX memory item when supported by the platform proxy").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (id, options) => {
5886
+ const result = await memoryRequest(options, "DELETE", `/cli/memory/${encodeURIComponent(id)}`, "memory.delete");
5887
+ printResult(options.format, result);
5888
+ });
5889
+ }
5890
+
5787
5891
  // src/core/form-schema.ts
5788
5892
  var FIELD_KEY_NAMES = [
5789
5893
  "key",
@@ -7424,6 +7528,13 @@ var schemaEntries = [
7424
7528
  { name: "config.repository.sync", description: "Run platform sysconfigdiff pullcommit/extract/pushcommit steps.", method: "POST", path: "/api/config_repository/:env?action=sync" },
7425
7529
  { name: "config.latest.pull", description: "Sync latest BPMAX sysconfig repositories for a configured environment.", method: "external", path: "external:sysconfigdiff + git" },
7426
7530
  { name: "config.e2e.run", description: "Run BPMAX config end-to-end validation orchestration.", method: "local+remote", path: "cli:e2e" },
7531
+ { name: "memory.status", description: "Check BPMAX memory backend status.", method: "GET", path: "/api/cli/memory/status" },
7532
+ { name: "memory.search", description: "Search BPMAX memory for the current API-key agent.", method: "POST", path: "/api/cli/memory/search" },
7533
+ { name: "memory.add", description: "Add BPMAX memory for the current API-key agent.", method: "POST", path: "/api/cli/memory" },
7534
+ { name: "memory.list", description: "List BPMAX memory when supported by the platform proxy.", method: "GET", path: "/api/cli/memory" },
7535
+ { name: "memory.get", description: "Get a BPMAX memory item when supported by the platform proxy.", method: "GET", path: "/api/cli/memory/:id" },
7536
+ { name: "memory.update", description: "Update a BPMAX memory item when supported by the platform proxy.", method: "PUT", path: "/api/cli/memory/:id" },
7537
+ { name: "memory.delete", description: "Delete a BPMAX memory item when supported by the platform proxy.", method: "DELETE", path: "/api/cli/memory/:id" },
7427
7538
  { name: "api.raw", description: "Call raw BPMAX API paths allowed by server capability whitelist.", method: "*", path: "/api/*" }
7428
7539
  ];
7429
7540
 
@@ -8633,6 +8744,7 @@ registerSchemaCommands(program);
8633
8744
  registerUserCommands(program);
8634
8745
  registerEsCommands(program);
8635
8746
  registerFlowCommands(program);
8747
+ registerMemoryCommands(program);
8636
8748
  registerProjectCommands(program);
8637
8749
  registerStepCommands(program);
8638
8750
  registerRecipeCommands(program);