@nexusclawhq/cli 0.2.3 → 0.3.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.
Files changed (233) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +5 -0
  3. package/dist/build-info.json +5 -5
  4. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/agent-executable-assets/cli-contract.types.d.ts +1 -1
  5. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/cognitive-policy.types.d.ts +19 -1
  6. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.d.ts +686 -95
  7. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.js +19426 -18705
  8. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.js.map +1 -1
  9. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/index.d.ts +1372 -190
  10. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.d.ts +686 -95
  11. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.js +19467 -18789
  12. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.js.map +1 -1
  13. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/platform-admin-route-readiness/index.js +2 -11
  14. package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/platform-admin-route-readiness/index.js.map +1 -1
  15. package/dist/nexus-cli/node_modules/@nexusclaw/shared/package.json +5 -1
  16. package/dist/nexus-cli/src/cli.js +2 -0
  17. package/dist/nexus-cli/src/cli.js.map +1 -1
  18. package/dist/nexus-cli/src/commands/ai/help.test.js +11 -29
  19. package/dist/nexus-cli/src/commands/ai/help.test.js.map +1 -1
  20. package/dist/nexus-cli/src/commands/commands.test.js +81 -1
  21. package/dist/nexus-cli/src/commands/commands.test.js.map +1 -1
  22. package/dist/nexus-cli/src/commands/employee/deploy.js +35 -9
  23. package/dist/nexus-cli/src/commands/employee/deploy.js.map +1 -1
  24. package/dist/nexus-cli/src/commands/org/index.js +2 -0
  25. package/dist/nexus-cli/src/commands/org/index.js.map +1 -1
  26. package/dist/nexus-cli/src/commands/org/login-web.d.ts +7 -0
  27. package/dist/nexus-cli/src/commands/org/login-web.js +31 -4
  28. package/dist/nexus-cli/src/commands/org/login-web.js.map +1 -1
  29. package/dist/nexus-cli/src/commands/org/login-web.test.js +15 -0
  30. package/dist/nexus-cli/src/commands/org/login-web.test.js.map +1 -1
  31. package/dist/nexus-cli/src/commands/org/step-up.d.ts +2 -0
  32. package/dist/nexus-cli/src/commands/org/step-up.js +75 -0
  33. package/dist/nexus-cli/src/commands/org/step-up.js.map +1 -0
  34. package/dist/nexus-cli/src/commands/workforce/approval.d.ts +2 -0
  35. package/dist/nexus-cli/src/commands/workforce/approval.js +60 -0
  36. package/dist/nexus-cli/src/commands/workforce/approval.js.map +1 -0
  37. package/dist/nexus-cli/src/commands/workforce/cognition.d.ts +2 -0
  38. package/dist/nexus-cli/src/commands/workforce/cognition.js +62 -0
  39. package/dist/nexus-cli/src/commands/workforce/cognition.js.map +1 -0
  40. package/dist/nexus-cli/src/commands/workforce/constitution.d.ts +2 -0
  41. package/dist/nexus-cli/src/commands/workforce/constitution.js +37 -0
  42. package/dist/nexus-cli/src/commands/workforce/constitution.js.map +1 -0
  43. package/dist/nexus-cli/src/commands/workforce/guardrail.d.ts +2 -0
  44. package/dist/nexus-cli/src/commands/workforce/guardrail.js +67 -0
  45. package/dist/nexus-cli/src/commands/workforce/guardrail.js.map +1 -0
  46. package/dist/nexus-cli/src/commands/workforce/index.d.ts +2 -0
  47. package/dist/nexus-cli/src/commands/workforce/index.js +43 -0
  48. package/dist/nexus-cli/src/commands/workforce/index.js.map +1 -0
  49. package/dist/nexus-cli/src/commands/workforce/knowledge.d.ts +2 -0
  50. package/dist/nexus-cli/src/commands/workforce/knowledge.js +143 -0
  51. package/dist/nexus-cli/src/commands/workforce/knowledge.js.map +1 -0
  52. package/dist/nexus-cli/src/commands/workforce/learning.d.ts +2 -0
  53. package/dist/nexus-cli/src/commands/workforce/learning.js +146 -0
  54. package/dist/nexus-cli/src/commands/workforce/learning.js.map +1 -0
  55. package/dist/nexus-cli/src/commands/workforce/observe.d.ts +2 -0
  56. package/dist/nexus-cli/src/commands/workforce/observe.js +152 -0
  57. package/dist/nexus-cli/src/commands/workforce/observe.js.map +1 -0
  58. package/dist/nexus-cli/src/commands/workforce/orchestration.d.ts +2 -0
  59. package/dist/nexus-cli/src/commands/workforce/orchestration.js +199 -0
  60. package/dist/nexus-cli/src/commands/workforce/orchestration.js.map +1 -0
  61. package/dist/nexus-cli/src/commands/workforce/permission.d.ts +2 -0
  62. package/dist/nexus-cli/src/commands/workforce/permission.js +113 -0
  63. package/dist/nexus-cli/src/commands/workforce/permission.js.map +1 -0
  64. package/dist/nexus-cli/src/commands/workforce/prompt.d.ts +2 -0
  65. package/dist/nexus-cli/src/commands/workforce/prompt.js +137 -0
  66. package/dist/nexus-cli/src/commands/workforce/prompt.js.map +1 -0
  67. package/dist/nexus-cli/src/commands/workforce/provider.d.ts +2 -0
  68. package/dist/nexus-cli/src/commands/workforce/provider.js +152 -0
  69. package/dist/nexus-cli/src/commands/workforce/provider.js.map +1 -0
  70. package/dist/nexus-cli/src/commands/workforce/rehearsal.d.ts +2 -0
  71. package/dist/nexus-cli/src/commands/workforce/rehearsal.js +71 -0
  72. package/dist/nexus-cli/src/commands/workforce/rehearsal.js.map +1 -0
  73. package/dist/nexus-cli/src/commands/workforce/release.d.ts +2 -0
  74. package/dist/nexus-cli/src/commands/workforce/release.js +24 -0
  75. package/dist/nexus-cli/src/commands/workforce/release.js.map +1 -0
  76. package/dist/nexus-cli/src/commands/workforce/shared.d.ts +8 -0
  77. package/dist/nexus-cli/src/commands/workforce/shared.js +86 -0
  78. package/dist/nexus-cli/src/commands/workforce/shared.js.map +1 -0
  79. package/dist/nexus-cli/src/commands/workforce/sop.d.ts +2 -0
  80. package/dist/nexus-cli/src/commands/workforce/sop.js +86 -0
  81. package/dist/nexus-cli/src/commands/workforce/sop.js.map +1 -0
  82. package/dist/nexus-cli/src/commands/workforce/task.d.ts +4 -0
  83. package/dist/nexus-cli/src/commands/workforce/task.js +67 -0
  84. package/dist/nexus-cli/src/commands/workforce/task.js.map +1 -0
  85. package/dist/nexus-cli/src/commands/workforce/test-case.d.ts +2 -0
  86. package/dist/nexus-cli/src/commands/workforce/test-case.js +121 -0
  87. package/dist/nexus-cli/src/commands/workforce/test-case.js.map +1 -0
  88. package/dist/nexus-cli/src/config/platform-seed-registry.json +134 -0
  89. package/dist/nexus-cli/src/contracts/command-contract.guard.js +25 -2
  90. package/dist/nexus-cli/src/contracts/command-contract.guard.js.map +1 -1
  91. package/dist/nexus-cli/src/contracts/command-contract.registry.js +2 -0
  92. package/dist/nexus-cli/src/contracts/command-contract.registry.js.map +1 -1
  93. package/dist/nexus-cli/src/contracts/contracts.test.js +40 -54
  94. package/dist/nexus-cli/src/contracts/contracts.test.js.map +1 -1
  95. package/dist/nexus-cli/src/contracts/workforce-contracts.d.ts +2 -0
  96. package/dist/nexus-cli/src/contracts/workforce-contracts.js +175 -0
  97. package/dist/nexus-cli/src/contracts/workforce-contracts.js.map +1 -0
  98. package/dist/nexus-cli/src/services/api-client.d.ts +37 -1
  99. package/dist/nexus-cli/src/services/api-client.js +120 -34
  100. package/dist/nexus-cli/src/services/api-client.js.map +1 -1
  101. package/dist/nexus-cli/src/services/api-client.test.js +87 -0
  102. package/dist/nexus-cli/src/services/api-client.test.js.map +1 -1
  103. package/dist/nexus-cli/src/services/package-self-containment.js +1 -0
  104. package/dist/nexus-cli/src/services/package-self-containment.js.map +1 -1
  105. package/dist/nexus-cli/src/services/step-up-helper.d.ts +43 -0
  106. package/dist/nexus-cli/src/services/step-up-helper.js +98 -0
  107. package/dist/nexus-cli/src/services/step-up-helper.js.map +1 -0
  108. package/dist/nexus-cli/src/services/step-up-helper.test.d.ts +1 -0
  109. package/dist/nexus-cli/src/services/step-up-helper.test.js +176 -0
  110. package/dist/nexus-cli/src/services/step-up-helper.test.js.map +1 -0
  111. package/dist/nexus-cli/src/services/step-up-interactive.d.ts +2 -0
  112. package/dist/nexus-cli/src/services/step-up-interactive.js +69 -0
  113. package/dist/nexus-cli/src/services/step-up-interactive.js.map +1 -0
  114. package/dist/nexus-cli/src/services/workforce-cognition-remote.d.ts +27 -0
  115. package/dist/nexus-cli/src/services/workforce-cognition-remote.js +48 -0
  116. package/dist/nexus-cli/src/services/workforce-cognition-remote.js.map +1 -0
  117. package/dist/nexus-cli/src/services/workforce-common.d.ts +2 -0
  118. package/dist/nexus-cli/src/services/workforce-common.js +20 -0
  119. package/dist/nexus-cli/src/services/workforce-common.js.map +1 -0
  120. package/dist/nexus-cli/src/services/workforce-config-remote.d.ts +127 -0
  121. package/dist/nexus-cli/src/services/workforce-config-remote.js +205 -0
  122. package/dist/nexus-cli/src/services/workforce-config-remote.js.map +1 -0
  123. package/dist/nexus-cli/src/services/workforce-distillation-remote.d.ts +118 -0
  124. package/dist/nexus-cli/src/services/workforce-distillation-remote.js +171 -0
  125. package/dist/nexus-cli/src/services/workforce-distillation-remote.js.map +1 -0
  126. package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.d.ts +105 -0
  127. package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.js +174 -0
  128. package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.js.map +1 -0
  129. package/dist/nexus-cli/src/services/workforce-learning-remote.d.ts +131 -0
  130. package/dist/nexus-cli/src/services/workforce-learning-remote.js +179 -0
  131. package/dist/nexus-cli/src/services/workforce-learning-remote.js.map +1 -0
  132. package/dist/nexus-cli/src/services/workforce-observe-remote.d.ts +97 -0
  133. package/dist/nexus-cli/src/services/workforce-observe-remote.js +207 -0
  134. package/dist/nexus-cli/src/services/workforce-observe-remote.js.map +1 -0
  135. package/dist/nexus-cli/src/services/workforce-ops-remote.d.ts +94 -0
  136. package/dist/nexus-cli/src/services/workforce-ops-remote.js +176 -0
  137. package/dist/nexus-cli/src/services/workforce-ops-remote.js.map +1 -0
  138. package/dist/nexus-cli/src/services/workforce-orchestration-remote.d.ts +132 -0
  139. package/dist/nexus-cli/src/services/workforce-orchestration-remote.js +244 -0
  140. package/dist/nexus-cli/src/services/workforce-orchestration-remote.js.map +1 -0
  141. package/dist/nexus-cli/src/services/workforce-permission-remote.d.ts +72 -0
  142. package/dist/nexus-cli/src/services/workforce-permission-remote.js +130 -0
  143. package/dist/nexus-cli/src/services/workforce-permission-remote.js.map +1 -0
  144. package/dist/nexus-cli/src/services/workforce-provider-remote.d.ts +82 -0
  145. package/dist/nexus-cli/src/services/workforce-provider-remote.js +129 -0
  146. package/dist/nexus-cli/src/services/workforce-provider-remote.js.map +1 -0
  147. package/dist/nexus-cli/src/services/workforce-test-remote.d.ts +85 -0
  148. package/dist/nexus-cli/src/services/workforce-test-remote.js +134 -0
  149. package/dist/nexus-cli/src/services/workforce-test-remote.js.map +1 -0
  150. package/dist/nexus-cli/src/templates/project/template-manifest.json +11 -5
  151. package/dist/nexus-cli/src/templates/project/templates/base-crm/README.md.tpl +4 -3
  152. package/dist/nexus-cli/src/templates/project/templates/base-crm/nexus-project.json.tpl +77 -13
  153. package/dist/nexus-cli/src/templates/project/templates/base-crm/nexus-project.yaml.tpl +68 -0
  154. package/dist/nexus-cli/src/templates/project/templates/demo-public-channel-store-delivery/README.md.tpl +4 -4
  155. package/dist/nexus-cli/src/templates/project/templates/demo-public-channel-store-delivery/nexus-project.json.tpl +77 -13
  156. package/dist/nexus-cli/src/templates/project/templates/demo-public-channel-store-delivery/nexus-project.yaml.tpl +71 -0
  157. package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/README.md.tpl +4 -4
  158. package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/nexus-app/main/default/isolated/drill-code-extension-page.manifest.json +63 -0
  159. package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/nexus-app/main/default/nwc/drill-code-extension-page/index.js +70 -0
  160. package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/nexus-app/main/default/tests/drill-code-extension-page.assertions.json +13 -0
  161. package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/nexus-project.json.tpl +61 -7
  162. package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/nexus-project.yaml.tpl +58 -0
  163. package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/preview/drill-code-extension-page.html +1 -1
  164. package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/scripts/build-component.mjs +1 -1
  165. package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/scripts/deploy-drill.mjs +1 -1
  166. package/dist/nexus-cli/src/templates/project/templates/empty/README.md.tpl +3 -2
  167. package/dist/nexus-cli/src/templates/project/templates/empty/nexus-project.json.tpl +79 -13
  168. package/dist/nexus-cli/src/templates/project/templates/empty/nexus-project.yaml.tpl +67 -0
  169. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/agent-instructions/claude.md +6 -0
  170. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/agent-instructions/codex.md +6 -0
  171. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/agent-instructions/generic.md +6 -0
  172. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/agent-instructions/glm-5.2.md +6 -0
  173. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/authoring/code-sdk.d.ts +1 -0
  174. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/authoring/command-order.json +1 -0
  175. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/authoring/flow-node-catalog.json +1 -0
  176. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/catalogs/ai-policies.json +1 -0
  177. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/catalogs/approval-policies.json +1 -0
  178. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/catalogs/connectors.json +1 -0
  179. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/catalogs/invokable-units.json +1 -0
  180. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/catalogs/objects.json +1 -0
  181. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/cli-contract.json +1 -0
  182. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/context-lock.json +1 -0
  183. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/context-manifest.json +1 -0
  184. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/examples/code/minimal-action.cases.json +1 -0
  185. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/examples/code/minimal-action.input.schema.json +1 -0
  186. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/examples/code/minimal-action.output.schema.json +1 -0
  187. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/examples/code/minimal-action.ts +3 -0
  188. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/examples/flow/minimal-manual-flow.json +1 -0
  189. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/agent-code-tool-catalog-v1.schema.json +1 -0
  190. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/ai-workforce-executable-bundle-v1.schema.json +1 -0
  191. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/approval-policy-authoring-catalog-v1.schema.json +1 -0
  192. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/code-action-cases-v1.schema.json +1 -0
  193. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/code-extension-governance-v2.schema.json +1 -0
  194. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/employee-package-v2.schema.json +1 -0
  195. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/flow-package-v1.schema.json +1 -0
  196. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/flows-payload-v2.schema.json +1 -0
  197. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/object-authoring-catalog-v1.schema.json +1 -0
  198. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/workforce-bundle-lock-v1.schema.json +1 -0
  199. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/workforce-release-evidence-v1.schema.json +1 -0
  200. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/workforce-runtime-bindings-v1.schema.json +1 -0
  201. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/workspace-authoring-contract-v1.schema.json +1 -0
  202. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/workspace-contract.json +1 -0
  203. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/README.md.tpl +41 -0
  204. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/nexus-project.json.tpl +86 -0
  205. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/nexus-project.yaml.tpl +61 -0
  206. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/package.json.tpl +25 -0
  207. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/.nexusclaw/scaffold.json +12 -0
  208. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/agent-tools.json +53 -0
  209. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/code/genericLookup.ts +5 -0
  210. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/package.yaml +28 -0
  211. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/schemas/genericLookup.input.schema.json +6 -0
  212. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/schemas/genericLookup.output.schema.json +6 -0
  213. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/tests/genericLookup.cases.json +26 -0
  214. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-flow/GenericFollowUp.flow.yaml +10 -0
  215. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/scripts/init-bundle.mjs +25 -0
  216. package/dist/nexus-cli/src/templates/project/templates/executable-workforce/tsconfig.json.tpl +10 -0
  217. package/dist/nexus-cli/src/templates/project/templates/industry-education/README.md.tpl +7 -1
  218. package/dist/nexus-cli/src/templates/project/templates/industry-education/nexus-project.json.tpl +77 -14
  219. package/dist/nexus-cli/src/templates/project/templates/industry-education/nexus-project.yaml.tpl +69 -0
  220. package/dist/nexus-cli/src/templates/project/templates/industry-finance/README.md.tpl +7 -1
  221. package/dist/nexus-cli/src/templates/project/templates/industry-finance/nexus-project.json.tpl +77 -14
  222. package/dist/nexus-cli/src/templates/project/templates/industry-finance/nexus-project.yaml.tpl +69 -0
  223. package/dist/nexus-cli/src/templates/project/templates/industry-healthcare/README.md.tpl +7 -1
  224. package/dist/nexus-cli/src/templates/project/templates/industry-healthcare/nexus-project.json.tpl +77 -14
  225. package/dist/nexus-cli/src/templates/project/templates/industry-healthcare/nexus-project.yaml.tpl +69 -0
  226. package/dist/nexus-cli/src/templates/project/templates/industry-partner-cloud/README.md.tpl +4 -4
  227. package/dist/nexus-cli/src/templates/project/templates/industry-partner-cloud/nexus-project.json.tpl +77 -13
  228. package/dist/nexus-cli/src/templates/project/templates/industry-partner-cloud/nexus-project.yaml.tpl +69 -0
  229. package/dist/nexus-cli/src/templates/project/templates/industry-retail/README.md.tpl +7 -1
  230. package/dist/nexus-cli/src/templates/project/templates/industry-retail/nexus-project.json.tpl +77 -14
  231. package/dist/nexus-cli/src/templates/project/templates/industry-retail/nexus-project.yaml.tpl +69 -0
  232. package/dist/tsconfig.tsbuildinfo +1 -1
  233. package/package.json +1 -1
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const strict_1 = __importDefault(require("node:assert/strict"));
7
+ const node_http_1 = __importDefault(require("node:http"));
8
+ const node_test_1 = __importDefault(require("node:test"));
9
+ const api_client_1 = require("./api-client");
10
+ const step_up_helper_1 = require("./step-up-helper");
11
+ async function createStepUpMockServer() {
12
+ const requests = [];
13
+ let firstAttempt = true;
14
+ const server = node_http_1.default.createServer((req, res) => {
15
+ let body = '';
16
+ req.on('data', (chunk) => {
17
+ body += chunk.toString();
18
+ });
19
+ req.on('end', () => {
20
+ const request = {
21
+ method: req.method ?? 'GET',
22
+ path: req.url ?? '/',
23
+ headers: req.headers,
24
+ body,
25
+ };
26
+ requests.push(request);
27
+ res.setHeader('Content-Type', 'application/json');
28
+ if (request.method === 'GET' && request.path === '/mfa/factors') {
29
+ res.end(JSON.stringify([
30
+ { id: 'factor-1', type: 'totp', label: 'Authenticator', isVerified: true, isPrimary: true },
31
+ ]));
32
+ return;
33
+ }
34
+ if (request.method === 'POST' && request.path === '/mfa/step-up/verify') {
35
+ const parsed = JSON.parse(body);
36
+ res.end(JSON.stringify({
37
+ challengeId: parsed.challengeId,
38
+ stepUpToken: 'step-up-token-minted',
39
+ expiresAt: '2026-12-31T00:00:00.000Z',
40
+ }));
41
+ return;
42
+ }
43
+ if (request.method === 'POST' && request.path === '/graphql') {
44
+ if (firstAttempt) {
45
+ firstAttempt = false;
46
+ res.end(JSON.stringify({
47
+ errors: [
48
+ {
49
+ message: 'Step-up verification required for action provider_config_admin',
50
+ extensions: {
51
+ code: 'STEP_UP_REQUIRED',
52
+ challengeId: 'challenge-abc-123',
53
+ action: 'provider_config_admin',
54
+ },
55
+ },
56
+ ],
57
+ }));
58
+ return;
59
+ }
60
+ const hasStepUpHeader = request.headers['x-step-up-token'] === 'step-up-token-minted';
61
+ res.end(JSON.stringify({
62
+ data: {
63
+ createProviderConfig: {
64
+ id: 'provider-1',
65
+ providerName: 'openai',
66
+ defaultModel: 'gpt-4',
67
+ success: hasStepUpHeader,
68
+ },
69
+ },
70
+ }));
71
+ return;
72
+ }
73
+ res.statusCode = 404;
74
+ res.end('{}');
75
+ });
76
+ });
77
+ await new Promise((resolve) => server.listen(0, '127.0.0.1', () => resolve()));
78
+ const address = server.address();
79
+ if (!address || typeof address === 'string') {
80
+ throw new Error('Unable to determine server address');
81
+ }
82
+ return {
83
+ baseUrl: `http://127.0.0.1:${address.port}`,
84
+ requests,
85
+ close: () => new Promise((resolve, reject) => {
86
+ server.close((error) => (error ? reject(error) : resolve()));
87
+ }),
88
+ };
89
+ }
90
+ (0, node_test_1.default)('extractStepUpRequirement pulls challengeId + action from a STEP_UP_REQUIRED GraphQL error', () => {
91
+ const error = new api_client_1.GraphQLApiError([
92
+ {
93
+ message: 'Step-up verification required for action provider_config_admin',
94
+ code: 'STEP_UP_REQUIRED',
95
+ challengeId: 'ch-123',
96
+ stepUpAction: 'provider_config_admin',
97
+ },
98
+ ]);
99
+ const requirement = (0, api_client_1.extractStepUpRequirement)(error);
100
+ strict_1.default.deepEqual(requirement, { challengeId: 'ch-123', action: 'provider_config_admin' });
101
+ });
102
+ (0, node_test_1.default)('extractStepUpRequirement returns null for non-step-up errors', () => {
103
+ const error = new api_client_1.GraphQLApiError([
104
+ { message: 'permission denied', code: 'FORBIDDEN' },
105
+ ]);
106
+ strict_1.default.equal((0, api_client_1.extractStepUpRequirement)(error), null);
107
+ });
108
+ (0, node_test_1.default)('extractStepUpRequirement returns null for non-GraphQLApiError inputs', () => {
109
+ strict_1.default.equal((0, api_client_1.extractStepUpRequirement)(new Error('boom')), null);
110
+ strict_1.default.equal((0, api_client_1.extractStepUpRequirement)(null), null);
111
+ strict_1.default.equal((0, api_client_1.extractStepUpRequirement)(undefined), null);
112
+ });
113
+ (0, node_test_1.default)('runWithStepUp rethrows non-step-up errors untouched', async () => {
114
+ let threw = false;
115
+ try {
116
+ await (0, step_up_helper_1.runWithStepUp)({
117
+ targetOrg: 'does-not-exist',
118
+ query: 'mutation { noop }',
119
+ variables: {},
120
+ resolveCredential: async () => ({ factorId: 'x', credential: 'x' }),
121
+ });
122
+ }
123
+ catch (error) {
124
+ threw = true;
125
+ strict_1.default.match(error.message, /TARGET_ORG_CREDENTIAL_REQUIRED|未找到 org 凭据/);
126
+ }
127
+ strict_1.default.ok(threw, 'runWithStepUp must rethrow non-step-up errors');
128
+ });
129
+ (0, node_test_1.default)('runWithStepUp via direct ApiClient: rejects → verify → retries with header', async () => {
130
+ const server = await createStepUpMockServer();
131
+ try {
132
+ const client = new api_client_1.ApiClient(server.baseUrl, 'session-token', 'org-alias');
133
+ const query = 'mutation { createProviderConfig(input: {providerName:"openai"}) { id success } }';
134
+ let retryData = null;
135
+ try {
136
+ await client.graphql(query, {});
137
+ strict_1.default.fail('expected STEP_UP_REQUIRED rejection');
138
+ }
139
+ catch (error) {
140
+ const requirement = (0, api_client_1.extractStepUpRequirement)(error);
141
+ strict_1.default.ok(requirement, 'challengeId should be extractable');
142
+ strict_1.default.equal(requirement.action, 'provider_config_admin');
143
+ const factors = await client.listMfaFactors();
144
+ strict_1.default.equal(factors.length, 1);
145
+ strict_1.default.equal(factors[0].id, 'factor-1');
146
+ const proof = await client.stepUpVerify({
147
+ challengeId: requirement.challengeId,
148
+ factorId: 'factor-1',
149
+ factorType: 'totp',
150
+ credential: '123456',
151
+ });
152
+ strict_1.default.equal(proof.stepUpToken, 'step-up-token-minted');
153
+ retryData = await client.graphqlWithStepUp(query, {}, proof.stepUpToken);
154
+ }
155
+ strict_1.default.ok(retryData, 'retry should succeed');
156
+ strict_1.default.equal(retryData.createProviderConfig.id, 'provider-1');
157
+ strict_1.default.equal(retryData.createProviderConfig.success, true);
158
+ const graphqlRequests = server.requests.filter((r) => r.method === 'POST' && r.path === '/graphql');
159
+ strict_1.default.ok(graphqlRequests.length >= 2, 'two graphql attempts (reject + retry)');
160
+ const retryRequest = graphqlRequests[graphqlRequests.length - 1];
161
+ strict_1.default.equal(retryRequest.headers['x-step-up-token'], 'step-up-token-minted', 'retry must attach the step-up token as a header');
162
+ const verifyRequest = server.requests.find((r) => r.path === '/mfa/step-up/verify');
163
+ strict_1.default.ok(verifyRequest);
164
+ strict_1.default.deepEqual(JSON.parse(verifyRequest.body).sessionType, 'step_up');
165
+ }
166
+ finally {
167
+ await server.close();
168
+ }
169
+ });
170
+ (0, node_test_1.default)('StepUpBootstrapError carries a stable code for exit-code mapping', () => {
171
+ const error = new step_up_helper_1.StepUpBootstrapError('STEP_UP_NO_VERIFIED_FACTOR', 'no factors');
172
+ strict_1.default.equal(error.code, 'STEP_UP_NO_VERIFIED_FACTOR');
173
+ strict_1.default.equal(error.name, 'StepUpBootstrapError');
174
+ strict_1.default.equal(error.message, 'no factors');
175
+ });
176
+ //# sourceMappingURL=step-up-helper.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-up-helper.test.js","sourceRoot":"","sources":["../../../../src/services/step-up-helper.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,0DAA6B;AAC7B,0DAA6B;AAE7B,6CAAoF;AACpF,qDAAuE;AAuBvE,KAAK,UAAU,sBAAsB;IACnC,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,IAAI,YAAY,GAAG,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,mBAAI,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC5C,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YACvB,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,GA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CAAE,CAAC;QAClE,gBAAM,CAAC,KAAK,CACV,YAAY,CAAC,OAAO,CAAC,iBAAiB,CAAC,EACvC,sBAAsB,EACtB,iDAAiD,CAClD,CAAC;QAGF,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,qBAAqB,CAAC,CAAC;QACpF,gBAAM,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;QACzB,gBAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,aAAc,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC3E,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,IAAA,mBAAI,EAAC,kEAAkE,EAAE,GAAG,EAAE;IAC5E,MAAM,KAAK,GAAG,IAAI,qCAAoB,CAAC,4BAA4B,EAAE,YAAY,CAAC,CAAC;IACnF,gBAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;IACvD,gBAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;IACjD,gBAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type StepUpCredentialResolver } from './step-up-helper';
2
+ export declare function buildInteractiveResolver(): StepUpCredentialResolver;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.buildInteractiveResolver = buildInteractiveResolver;
37
+ const readline = __importStar(require("node:readline/promises"));
38
+ const node_process_1 = require("node:process");
39
+ const logger_1 = require("../utils/logger");
40
+ const step_up_helper_1 = require("./step-up-helper");
41
+ function buildInteractiveResolver() {
42
+ return async ({ factors, action }) => {
43
+ const rl = readline.createInterface({ input: node_process_1.stdin, output: node_process_1.stdout });
44
+ try {
45
+ logger_1.logger.info(`step-up 动作: ${action}`);
46
+ logger_1.logger.info('已验证因素:');
47
+ factors.forEach((factor, index) => {
48
+ logger_1.logger.info(` [${index}] ${factor.type} ${factor.label} (${factor.id})`);
49
+ });
50
+ const choiceRaw = await rl.question('选择因素序号: ');
51
+ const choice = Number(choiceRaw);
52
+ const factor = Number.isInteger(choice)
53
+ ? factors[choice]
54
+ : factors.find((row) => row.id === choiceRaw.trim());
55
+ if (!factor) {
56
+ throw new step_up_helper_1.StepUpBootstrapError('STEP_UP_FACTOR_NOT_FOUND', `无效的因素选择: ${choiceRaw}`);
57
+ }
58
+ const credential = (await rl.question('输入凭据(TOTP 码 / 恢复码 / OTP): ')).trim();
59
+ if (!credential) {
60
+ throw new step_up_helper_1.StepUpBootstrapError('STEP_UP_CREDENTIAL_REQUIRED', '凭据不能为空。');
61
+ }
62
+ return { factorId: factor.id, credential };
63
+ }
64
+ finally {
65
+ rl.close();
66
+ }
67
+ };
68
+ }
69
+ //# sourceMappingURL=step-up-interactive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-up-interactive.js","sourceRoot":"","sources":["../../../../src/services/step-up-interactive.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,4DAgCC;AA/CD,iEAAmD;AACnD,+CAAgE;AAEhE,4CAAyC;AAEzC,qDAAuF;AAUvF,SAAgB,wBAAwB;IACtC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QACnC,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAL,oBAAK,EAAE,MAAM,EAAN,qBAAM,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC;YACH,eAAM,CAAC,IAAI,CAAC,eAAe,MAAM,EAAE,CAAC,CAAC;YACrC,eAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtB,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;gBAChC,eAAM,CAAC,IAAI,CAAC,MAAM,KAAK,KAAK,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,KAAK,MAAM,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;YAC9E,CAAC,CAAC,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAChD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;YACjC,MAAM,MAAM,GAA8B,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;gBAChE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;gBACjB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;YACvD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,qCAAoB,CAC5B,0BAA0B,EAC1B,YAAY,SAAS,EAAE,CACxB,CAAC;YACJ,CAAC;YACD,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC5E,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,MAAM,IAAI,qCAAoB,CAC5B,6BAA6B,EAC7B,SAAS,CACV,CAAC;YACJ,CAAC;YACD,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC;QAC7C,CAAC;gBAAS,CAAC;YACT,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ export interface OpportunityResult {
2
+ status: string;
3
+ executionId?: string | null;
4
+ }
5
+ export declare function confirmOpportunityRemote(options: {
6
+ targetOrg: string;
7
+ proposalId: string;
8
+ proposalDigest: string;
9
+ stateFingerprint: string;
10
+ }): Promise<OpportunityResult>;
11
+ export declare function rejectOpportunityRemote(options: {
12
+ targetOrg: string;
13
+ proposalId: string;
14
+ proposalDigest: string;
15
+ reasonCode: string;
16
+ }): Promise<OpportunityResult>;
17
+ export declare function transitionMemoryRemote(options: {
18
+ targetOrg: string;
19
+ memoryItemId: string;
20
+ expectedGeneration: number;
21
+ toStatus: 'active' | 'archived' | 'revoked';
22
+ reasonCode: string;
23
+ idempotencyKey: string;
24
+ }): Promise<{
25
+ status: string;
26
+ revision: number;
27
+ }>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.confirmOpportunityRemote = confirmOpportunityRemote;
4
+ exports.rejectOpportunityRemote = rejectOpportunityRemote;
5
+ exports.transitionMemoryRemote = transitionMemoryRemote;
6
+ const api_client_1 = require("./api-client");
7
+ const CONFIRM_OPPORTUNITY = `
8
+ mutation ConfirmAiWorkforceOpportunity($proposalId: ID!, $proposalDigest: String!, $stateFingerprint: String!) {
9
+ confirmAiWorkforceOpportunity(proposalId: $proposalId, proposalDigest: $proposalDigest, stateFingerprint: $stateFingerprint) { status executionId }
10
+ }`;
11
+ const REJECT_OPPORTUNITY = `
12
+ mutation RejectAiWorkforceOpportunity($proposalId: ID!, $proposalDigest: String!, $reasonCode: String!) {
13
+ rejectAiWorkforceOpportunity(proposalId: $proposalId, proposalDigest: $proposalDigest, reasonCode: $reasonCode) { status executionId }
14
+ }`;
15
+ const TRANSITION_MEMORY = `
16
+ mutation TransitionAiWorkforceMemory($memoryItemId: ID!, $expectedGeneration: Int!, $toStatus: String!, $reasonCode: String!, $idempotencyKey: String!) {
17
+ transitionAiWorkforceMemory(memoryItemId: $memoryItemId, expectedGeneration: $expectedGeneration, toStatus: $toStatus, reasonCode: $reasonCode, idempotencyKey: $idempotencyKey) { status revision }
18
+ }`;
19
+ async function confirmOpportunityRemote(options) {
20
+ const client = (0, api_client_1.createApiClient)(options.targetOrg);
21
+ const data = await client.graphql(CONFIRM_OPPORTUNITY, {
22
+ proposalId: options.proposalId,
23
+ proposalDigest: options.proposalDigest,
24
+ stateFingerprint: options.stateFingerprint,
25
+ });
26
+ return data.confirmAiWorkforceOpportunity;
27
+ }
28
+ async function rejectOpportunityRemote(options) {
29
+ const client = (0, api_client_1.createApiClient)(options.targetOrg);
30
+ const data = await client.graphql(REJECT_OPPORTUNITY, {
31
+ proposalId: options.proposalId,
32
+ proposalDigest: options.proposalDigest,
33
+ reasonCode: options.reasonCode,
34
+ });
35
+ return data.rejectAiWorkforceOpportunity;
36
+ }
37
+ async function transitionMemoryRemote(options) {
38
+ const client = (0, api_client_1.createApiClient)(options.targetOrg);
39
+ const data = await client.graphql(TRANSITION_MEMORY, {
40
+ memoryItemId: options.memoryItemId,
41
+ expectedGeneration: options.expectedGeneration,
42
+ toStatus: options.toStatus,
43
+ reasonCode: options.reasonCode,
44
+ idempotencyKey: options.idempotencyKey,
45
+ });
46
+ return data.transitionAiWorkforceMemory;
47
+ }
48
+ //# sourceMappingURL=workforce-cognition-remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workforce-cognition-remote.js","sourceRoot":"","sources":["../../../../src/services/workforce-cognition-remote.ts"],"names":[],"mappings":";;AA+CA,4DAgBC;AAMD,0DAgBC;AASD,wDAmBC;AAjHD,6CAA+C;AAoB/C,MAAM,mBAAmB,GAAG;;;EAG1B,CAAC;AAEH,MAAM,kBAAkB,GAAG;;;EAGzB,CAAC;AAEH,MAAM,iBAAiB,GAAG;;;EAGxB,CAAC;AAcI,KAAK,UAAU,wBAAwB,CAAC,OAK9C;IACC,MAAM,MAAM,GAAG,IAAA,4BAAe,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B,mBAAmB,EACnB;QACE,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CACF,CAAC;IACF,OAAO,IAAI,CAAC,6BAA6B,CAAC;AAC5C,CAAC;AAMM,KAAK,UAAU,uBAAuB,CAAC,OAK7C;IACC,MAAM,MAAM,GAAG,IAAA,4BAAe,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B,kBAAkB,EAClB;QACE,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CACF,CAAC;IACF,OAAO,IAAI,CAAC,4BAA4B,CAAC;AAC3C,CAAC;AASM,KAAK,UAAU,sBAAsB,CAAC,OAO5C;IACC,MAAM,MAAM,GAAG,IAAA,4BAAe,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAE9B,iBAAiB,EAAE;QACpB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;QAC9C,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,2BAA2B,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function resolveWorkspaceId(targetOrg: string): string;
2
+ export declare function requireNonBlank(value: string | undefined, code: string): string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveWorkspaceId = resolveWorkspaceId;
4
+ exports.requireNonBlank = requireNonBlank;
5
+ const auth_store_1 = require("./auth-store");
6
+ function resolveWorkspaceId(targetOrg) {
7
+ const credential = (0, auth_store_1.loadCredential)(targetOrg);
8
+ if (!credential?.orgId) {
9
+ throw new Error(`TARGET_ORG_CREDENTIAL_REQUIRED: ${targetOrg} 缺少 orgId`);
10
+ }
11
+ return credential.orgId;
12
+ }
13
+ function requireNonBlank(value, code) {
14
+ const trimmed = value?.trim();
15
+ if (!trimmed) {
16
+ throw new Error(code);
17
+ }
18
+ return trimmed;
19
+ }
20
+ //# sourceMappingURL=workforce-common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workforce-common.js","sourceRoot":"","sources":["../../../../src/services/workforce-common.ts"],"names":[],"mappings":";;AAWA,gDAMC;AAGD,0CAMC;AA1BD,6CAA8C;AAW9C,SAAgB,kBAAkB,CAAC,SAAiB;IAClD,MAAM,UAAU,GAAG,IAAA,2BAAc,EAAC,SAAS,CAAC,CAAC;IAC7C,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,mCAAmC,SAAS,WAAW,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,UAAU,CAAC,KAAK,CAAC;AAC1B,CAAC;AAGD,SAAgB,eAAe,CAAC,KAAyB,EAAE,IAAY;IACrE,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,127 @@
1
+ export interface ConstitutionView {
2
+ id: string;
3
+ workspaceId: string;
4
+ content: string;
5
+ versionNumber: number;
6
+ isActive?: boolean;
7
+ publishedAt?: string;
8
+ publishedBy?: string;
9
+ }
10
+ export declare function publishConstitutionRemote(options: {
11
+ targetOrg: string;
12
+ content: string;
13
+ }): Promise<ConstitutionView>;
14
+ export declare function rollbackConstitutionRemote(options: {
15
+ targetOrg: string;
16
+ targetVersionNumber: number;
17
+ }): Promise<ConstitutionView>;
18
+ export declare function getConstitutionRemote(options: {
19
+ targetOrg: string;
20
+ }): Promise<ConstitutionView | null>;
21
+ export declare function listConstitutionVersionsRemote(options: {
22
+ targetOrg: string;
23
+ }): Promise<Array<Pick<ConstitutionView, 'id' | 'versionNumber' | 'content' | 'isActive' | 'publishedAt' | 'publishedBy'>>>;
24
+ export interface PromptStrategyView {
25
+ id: string;
26
+ workspaceId?: string;
27
+ name: string;
28
+ description?: string;
29
+ industry?: string;
30
+ templateOverrides?: unknown;
31
+ isActive?: boolean;
32
+ createdAt?: string;
33
+ }
34
+ export declare function createPromptStrategyRemote(options: {
35
+ targetOrg: string;
36
+ name: string;
37
+ description?: string;
38
+ industry?: string;
39
+ templateOverrides?: unknown;
40
+ }): Promise<PromptStrategyView>;
41
+ export declare function updatePromptStrategyRemote(options: {
42
+ targetOrg: string;
43
+ id: string;
44
+ name?: string;
45
+ description?: string;
46
+ industry?: string;
47
+ templateOverrides?: unknown;
48
+ }): Promise<PromptStrategyView>;
49
+ export declare function activatePromptStrategyRemote(options: {
50
+ targetOrg: string;
51
+ id: string;
52
+ }): Promise<{
53
+ id: string;
54
+ isActive: boolean;
55
+ }>;
56
+ export declare function deactivatePromptStrategyRemote(options: {
57
+ targetOrg: string;
58
+ id: string;
59
+ }): Promise<{
60
+ id: string;
61
+ isActive: boolean;
62
+ }>;
63
+ export declare function deletePromptStrategyRemote(options: {
64
+ targetOrg: string;
65
+ id: string;
66
+ }): Promise<boolean>;
67
+ export interface PromptTemplateView {
68
+ id: string;
69
+ workspaceId?: string;
70
+ scene?: string;
71
+ name: string;
72
+ template: string;
73
+ variables?: unknown;
74
+ modelId?: string;
75
+ modelProvider?: string;
76
+ createdAt?: string;
77
+ versionNumber?: number;
78
+ }
79
+ export declare function createPromptTemplateRemote(options: {
80
+ targetOrg: string;
81
+ scene: string;
82
+ name: string;
83
+ template: string;
84
+ variables?: unknown;
85
+ modelId?: string;
86
+ modelProvider?: string;
87
+ }): Promise<PromptTemplateView>;
88
+ export declare function updatePromptTemplateRemote(options: {
89
+ targetOrg: string;
90
+ id: string;
91
+ name?: string;
92
+ template?: string;
93
+ variables?: unknown;
94
+ modelId?: string;
95
+ modelProvider?: string;
96
+ }): Promise<PromptTemplateView>;
97
+ export declare function rollbackPromptTemplateRemote(options: {
98
+ targetOrg: string;
99
+ id: string;
100
+ versionNumber: number;
101
+ }): Promise<PromptTemplateView>;
102
+ export declare function deletePromptTemplateRemote(options: {
103
+ targetOrg: string;
104
+ id: string;
105
+ }): Promise<boolean>;
106
+ export declare function draftPromptTemplateRemote(options: {
107
+ targetOrg: string;
108
+ intention: string;
109
+ modelId?: string;
110
+ modelProvider?: string;
111
+ }): Promise<{
112
+ template: string;
113
+ variables: unknown;
114
+ model: unknown;
115
+ }>;
116
+ export declare function testPromptRemote(options: {
117
+ targetOrg: string;
118
+ prompt: string;
119
+ temperature?: number;
120
+ modelId?: string;
121
+ modelProvider?: string;
122
+ }): Promise<{
123
+ output: string;
124
+ model: string;
125
+ tokensUsed: number;
126
+ latencyMs: number;
127
+ }>;