@nexusclawhq/cli 0.2.4 → 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.
- package/CHANGELOG.md +7 -0
- package/README.md +5 -0
- package/dist/build-info.json +5 -5
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/agent-executable-assets/cli-contract.types.d.ts +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/cognitive-policy.types.d.ts +19 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.d.ts +686 -95
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.js +19426 -18705
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/en-US.js.map +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/index.d.ts +1372 -190
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.d.ts +686 -95
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.js +19467 -18789
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/locales/zh-CN.js.map +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/platform-admin-route-readiness/index.js +2 -11
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/platform-admin-route-readiness/index.js.map +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/package.json +5 -1
- package/dist/nexus-cli/src/cli.js +2 -0
- package/dist/nexus-cli/src/cli.js.map +1 -1
- package/dist/nexus-cli/src/commands/ai/help.test.js +11 -29
- package/dist/nexus-cli/src/commands/ai/help.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/commands.test.js +81 -1
- package/dist/nexus-cli/src/commands/commands.test.js.map +1 -1
- package/dist/nexus-cli/src/commands/employee/deploy.js +35 -9
- package/dist/nexus-cli/src/commands/employee/deploy.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/index.js +2 -0
- package/dist/nexus-cli/src/commands/org/index.js.map +1 -1
- package/dist/nexus-cli/src/commands/org/step-up.d.ts +2 -0
- package/dist/nexus-cli/src/commands/org/step-up.js +75 -0
- package/dist/nexus-cli/src/commands/org/step-up.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/approval.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/approval.js +60 -0
- package/dist/nexus-cli/src/commands/workforce/approval.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/cognition.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/cognition.js +62 -0
- package/dist/nexus-cli/src/commands/workforce/cognition.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/constitution.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/constitution.js +37 -0
- package/dist/nexus-cli/src/commands/workforce/constitution.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/guardrail.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/guardrail.js +67 -0
- package/dist/nexus-cli/src/commands/workforce/guardrail.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/index.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/index.js +43 -0
- package/dist/nexus-cli/src/commands/workforce/index.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/knowledge.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/knowledge.js +143 -0
- package/dist/nexus-cli/src/commands/workforce/knowledge.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/learning.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/learning.js +146 -0
- package/dist/nexus-cli/src/commands/workforce/learning.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/observe.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/observe.js +152 -0
- package/dist/nexus-cli/src/commands/workforce/observe.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/orchestration.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/orchestration.js +199 -0
- package/dist/nexus-cli/src/commands/workforce/orchestration.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/permission.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/permission.js +113 -0
- package/dist/nexus-cli/src/commands/workforce/permission.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/prompt.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/prompt.js +137 -0
- package/dist/nexus-cli/src/commands/workforce/prompt.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/provider.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/provider.js +152 -0
- package/dist/nexus-cli/src/commands/workforce/provider.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/rehearsal.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/rehearsal.js +71 -0
- package/dist/nexus-cli/src/commands/workforce/rehearsal.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/release.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/release.js +24 -0
- package/dist/nexus-cli/src/commands/workforce/release.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/shared.d.ts +8 -0
- package/dist/nexus-cli/src/commands/workforce/shared.js +86 -0
- package/dist/nexus-cli/src/commands/workforce/shared.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/sop.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/sop.js +86 -0
- package/dist/nexus-cli/src/commands/workforce/sop.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/task.d.ts +4 -0
- package/dist/nexus-cli/src/commands/workforce/task.js +67 -0
- package/dist/nexus-cli/src/commands/workforce/task.js.map +1 -0
- package/dist/nexus-cli/src/commands/workforce/test-case.d.ts +2 -0
- package/dist/nexus-cli/src/commands/workforce/test-case.js +121 -0
- package/dist/nexus-cli/src/commands/workforce/test-case.js.map +1 -0
- package/dist/nexus-cli/src/config/platform-seed-registry.json +134 -0
- package/dist/nexus-cli/src/contracts/command-contract.guard.js +25 -2
- package/dist/nexus-cli/src/contracts/command-contract.guard.js.map +1 -1
- package/dist/nexus-cli/src/contracts/command-contract.registry.js +2 -0
- package/dist/nexus-cli/src/contracts/command-contract.registry.js.map +1 -1
- package/dist/nexus-cli/src/contracts/contracts.test.js +40 -54
- package/dist/nexus-cli/src/contracts/contracts.test.js.map +1 -1
- package/dist/nexus-cli/src/contracts/workforce-contracts.d.ts +2 -0
- package/dist/nexus-cli/src/contracts/workforce-contracts.js +175 -0
- package/dist/nexus-cli/src/contracts/workforce-contracts.js.map +1 -0
- package/dist/nexus-cli/src/services/api-client.d.ts +37 -1
- package/dist/nexus-cli/src/services/api-client.js +120 -34
- package/dist/nexus-cli/src/services/api-client.js.map +1 -1
- package/dist/nexus-cli/src/services/api-client.test.js +87 -0
- package/dist/nexus-cli/src/services/api-client.test.js.map +1 -1
- package/dist/nexus-cli/src/services/package-self-containment.js +1 -0
- package/dist/nexus-cli/src/services/package-self-containment.js.map +1 -1
- package/dist/nexus-cli/src/services/step-up-helper.d.ts +43 -0
- package/dist/nexus-cli/src/services/step-up-helper.js +98 -0
- package/dist/nexus-cli/src/services/step-up-helper.js.map +1 -0
- package/dist/nexus-cli/src/services/step-up-helper.test.d.ts +1 -0
- package/dist/nexus-cli/src/services/step-up-helper.test.js +176 -0
- package/dist/nexus-cli/src/services/step-up-helper.test.js.map +1 -0
- package/dist/nexus-cli/src/services/step-up-interactive.d.ts +2 -0
- package/dist/nexus-cli/src/services/step-up-interactive.js +69 -0
- package/dist/nexus-cli/src/services/step-up-interactive.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-cognition-remote.d.ts +27 -0
- package/dist/nexus-cli/src/services/workforce-cognition-remote.js +48 -0
- package/dist/nexus-cli/src/services/workforce-cognition-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-common.d.ts +2 -0
- package/dist/nexus-cli/src/services/workforce-common.js +20 -0
- package/dist/nexus-cli/src/services/workforce-common.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-config-remote.d.ts +127 -0
- package/dist/nexus-cli/src/services/workforce-config-remote.js +205 -0
- package/dist/nexus-cli/src/services/workforce-config-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-distillation-remote.d.ts +118 -0
- package/dist/nexus-cli/src/services/workforce-distillation-remote.js +171 -0
- package/dist/nexus-cli/src/services/workforce-distillation-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.d.ts +105 -0
- package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.js +174 -0
- package/dist/nexus-cli/src/services/workforce-guardrail-knowledge-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-learning-remote.d.ts +131 -0
- package/dist/nexus-cli/src/services/workforce-learning-remote.js +179 -0
- package/dist/nexus-cli/src/services/workforce-learning-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-observe-remote.d.ts +97 -0
- package/dist/nexus-cli/src/services/workforce-observe-remote.js +207 -0
- package/dist/nexus-cli/src/services/workforce-observe-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-ops-remote.d.ts +94 -0
- package/dist/nexus-cli/src/services/workforce-ops-remote.js +176 -0
- package/dist/nexus-cli/src/services/workforce-ops-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-orchestration-remote.d.ts +132 -0
- package/dist/nexus-cli/src/services/workforce-orchestration-remote.js +244 -0
- package/dist/nexus-cli/src/services/workforce-orchestration-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-permission-remote.d.ts +72 -0
- package/dist/nexus-cli/src/services/workforce-permission-remote.js +130 -0
- package/dist/nexus-cli/src/services/workforce-permission-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-provider-remote.d.ts +82 -0
- package/dist/nexus-cli/src/services/workforce-provider-remote.js +129 -0
- package/dist/nexus-cli/src/services/workforce-provider-remote.js.map +1 -0
- package/dist/nexus-cli/src/services/workforce-test-remote.d.ts +85 -0
- package/dist/nexus-cli/src/services/workforce-test-remote.js +134 -0
- package/dist/nexus-cli/src/services/workforce-test-remote.js.map +1 -0
- package/dist/nexus-cli/src/templates/project/template-manifest.json +11 -5
- package/dist/nexus-cli/src/templates/project/templates/base-crm/README.md.tpl +4 -3
- package/dist/nexus-cli/src/templates/project/templates/base-crm/nexus-project.json.tpl +77 -13
- package/dist/nexus-cli/src/templates/project/templates/base-crm/nexus-project.yaml.tpl +68 -0
- package/dist/nexus-cli/src/templates/project/templates/demo-public-channel-store-delivery/README.md.tpl +4 -4
- package/dist/nexus-cli/src/templates/project/templates/demo-public-channel-store-delivery/nexus-project.json.tpl +77 -13
- package/dist/nexus-cli/src/templates/project/templates/demo-public-channel-store-delivery/nexus-project.yaml.tpl +71 -0
- package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/README.md.tpl +4 -4
- 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
- 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
- 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
- package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/nexus-project.json.tpl +61 -7
- package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/nexus-project.yaml.tpl +58 -0
- package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/preview/drill-code-extension-page.html +1 -1
- package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/scripts/build-component.mjs +1 -1
- package/dist/nexus-cli/src/templates/project/templates/drill-code-extension-page/scripts/deploy-drill.mjs +1 -1
- package/dist/nexus-cli/src/templates/project/templates/empty/README.md.tpl +3 -2
- package/dist/nexus-cli/src/templates/project/templates/empty/nexus-project.json.tpl +79 -13
- package/dist/nexus-cli/src/templates/project/templates/empty/nexus-project.yaml.tpl +67 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/agent-instructions/claude.md +6 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/agent-instructions/codex.md +6 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/agent-instructions/generic.md +6 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/agent-instructions/glm-5.2.md +6 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/authoring/code-sdk.d.ts +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/authoring/command-order.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/authoring/flow-node-catalog.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/catalogs/ai-policies.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/catalogs/approval-policies.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/catalogs/connectors.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/catalogs/invokable-units.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/catalogs/objects.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/cli-contract.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/context-lock.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/context-manifest.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/examples/code/minimal-action.cases.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/examples/code/minimal-action.input.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/examples/code/minimal-action.output.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/examples/code/minimal-action.ts +3 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/examples/flow/minimal-manual-flow.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/agent-code-tool-catalog-v1.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/ai-workforce-executable-bundle-v1.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/approval-policy-authoring-catalog-v1.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/code-action-cases-v1.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/code-extension-governance-v2.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/employee-package-v2.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/flow-package-v1.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/flows-payload-v2.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/object-authoring-catalog-v1.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/workforce-bundle-lock-v1.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/workforce-release-evidence-v1.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/workforce-runtime-bindings-v1.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/schemas/workspace-authoring-contract-v1.schema.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/.nexusclaw/context/workspace-contract.json +1 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/README.md.tpl +41 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/nexus-project.json.tpl +86 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/nexus-project.yaml.tpl +61 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/package.json.tpl +25 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/.nexusclaw/scaffold.json +12 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/agent-tools.json +53 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/code/genericLookup.ts +5 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/package.yaml +28 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/schemas/genericLookup.input.schema.json +6 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/schemas/genericLookup.output.schema.json +6 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-action/tests/genericLookup.cases.json +26 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/packages/generic-flow/GenericFollowUp.flow.yaml +10 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/scripts/init-bundle.mjs +25 -0
- package/dist/nexus-cli/src/templates/project/templates/executable-workforce/tsconfig.json.tpl +10 -0
- package/dist/nexus-cli/src/templates/project/templates/industry-education/README.md.tpl +7 -1
- package/dist/nexus-cli/src/templates/project/templates/industry-education/nexus-project.json.tpl +77 -14
- package/dist/nexus-cli/src/templates/project/templates/industry-education/nexus-project.yaml.tpl +69 -0
- package/dist/nexus-cli/src/templates/project/templates/industry-finance/README.md.tpl +7 -1
- package/dist/nexus-cli/src/templates/project/templates/industry-finance/nexus-project.json.tpl +77 -14
- package/dist/nexus-cli/src/templates/project/templates/industry-finance/nexus-project.yaml.tpl +69 -0
- package/dist/nexus-cli/src/templates/project/templates/industry-healthcare/README.md.tpl +7 -1
- package/dist/nexus-cli/src/templates/project/templates/industry-healthcare/nexus-project.json.tpl +77 -14
- package/dist/nexus-cli/src/templates/project/templates/industry-healthcare/nexus-project.yaml.tpl +69 -0
- package/dist/nexus-cli/src/templates/project/templates/industry-partner-cloud/README.md.tpl +4 -4
- package/dist/nexus-cli/src/templates/project/templates/industry-partner-cloud/nexus-project.json.tpl +77 -13
- package/dist/nexus-cli/src/templates/project/templates/industry-partner-cloud/nexus-project.yaml.tpl +69 -0
- package/dist/nexus-cli/src/templates/project/templates/industry-retail/README.md.tpl +7 -1
- package/dist/nexus-cli/src/templates/project/templates/industry-retail/nexus-project.json.tpl +77 -14
- package/dist/nexus-cli/src/templates/project/templates/industry-retail/nexus-project.yaml.tpl +69 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-self-containment.js","sourceRoot":"","sources":["../../../../src/services/package-self-containment.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"package-self-containment.js","sourceRoot":"","sources":["../../../../src/services/package-self-containment.ts"],"names":[],"mappings":";;;;;AAyFA,4DAGC;AAED,oEAyCC;AAuJD,wEAgDC;AA9UD,sDAAyB;AACzB,0DAA6B;AA+C7B,MAAM,wBAAwB,GAAG,kCAAkC,CAAC;AAEpE,MAAM,yBAAyB,GAAG;IAChC,0BAA0B;IAC1B,oCAAoC;IACpC,mCAAmC;CACpC,CAAC;AAEF,SAAS,qBAAqB,CAAC,SAAiB;IAC9C,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,mBAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACjD,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,C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AAI,EAAE,EAClC,MAAM,CACP,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC1B,MAAM;QACN,QAAQ;QACR,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { GraphQLApiError, type MfaFactorView } from './api-client';
|
|
2
|
+
export interface StepUpProof {
|
|
3
|
+
readonly challengeId: string;
|
|
4
|
+
readonly stepUpToken: string;
|
|
5
|
+
readonly expiresAt: Date;
|
|
6
|
+
readonly factorId: string;
|
|
7
|
+
readonly factorType: string;
|
|
8
|
+
readonly action: string;
|
|
9
|
+
}
|
|
10
|
+
export type StepUpCredentialResolver = (input: {
|
|
11
|
+
readonly challengeId: string;
|
|
12
|
+
readonly action: string;
|
|
13
|
+
readonly factors: ReadonlyArray<MfaFactorView>;
|
|
14
|
+
}) => Promise<{
|
|
15
|
+
factorId: string;
|
|
16
|
+
credential: unknown;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function completeStepUpChallenge(options: {
|
|
19
|
+
readonly targetOrg: string;
|
|
20
|
+
readonly challengeId: string;
|
|
21
|
+
readonly action: string;
|
|
22
|
+
readonly resolveCredential: StepUpCredentialResolver;
|
|
23
|
+
}): Promise<StepUpProof>;
|
|
24
|
+
export declare function runWithStepUp<T>(options: {
|
|
25
|
+
readonly targetOrg: string;
|
|
26
|
+
readonly query: string;
|
|
27
|
+
readonly variables: Record<string, unknown>;
|
|
28
|
+
readonly resolveCredential: StepUpCredentialResolver;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
data: T;
|
|
31
|
+
proof: StepUpProof | null;
|
|
32
|
+
}>;
|
|
33
|
+
export declare class StepUpBootstrapError extends Error {
|
|
34
|
+
readonly code: string;
|
|
35
|
+
constructor(code: string, message: string);
|
|
36
|
+
}
|
|
37
|
+
export declare function buildNonInteractiveCredentialResolver(options: {
|
|
38
|
+
readonly factorId?: string;
|
|
39
|
+
readonly factorType?: string;
|
|
40
|
+
readonly credential?: string;
|
|
41
|
+
}): StepUpCredentialResolver;
|
|
42
|
+
export declare function freshIdempotencyKey(): string;
|
|
43
|
+
export { GraphQLApiError };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphQLApiError = exports.StepUpBootstrapError = void 0;
|
|
4
|
+
exports.completeStepUpChallenge = completeStepUpChallenge;
|
|
5
|
+
exports.runWithStepUp = runWithStepUp;
|
|
6
|
+
exports.buildNonInteractiveCredentialResolver = buildNonInteractiveCredentialResolver;
|
|
7
|
+
exports.freshIdempotencyKey = freshIdempotencyKey;
|
|
8
|
+
const node_crypto_1 = require("node:crypto");
|
|
9
|
+
const api_client_1 = require("./api-client");
|
|
10
|
+
Object.defineProperty(exports, "GraphQLApiError", { enumerable: true, get: function () { return api_client_1.GraphQLApiError; } });
|
|
11
|
+
async function completeStepUpChallenge(options) {
|
|
12
|
+
const client = (0, api_client_1.createApiClient)(options.targetOrg);
|
|
13
|
+
const factors = await client.listMfaFactors();
|
|
14
|
+
const verified = factors.filter((factor) => factor.isVerified);
|
|
15
|
+
if (verified.length === 0) {
|
|
16
|
+
throw new StepUpBootstrapError('STEP_UP_NO_VERIFIED_FACTOR', '当前用户没有已验证的 MFA 因素,无法完成 step-up。请先在 UI 注册 TOTP/WebAuthn。');
|
|
17
|
+
}
|
|
18
|
+
const { factorId, credential } = await options.resolveCredential({
|
|
19
|
+
challengeId: options.challengeId,
|
|
20
|
+
action: options.action,
|
|
21
|
+
factors: verified,
|
|
22
|
+
});
|
|
23
|
+
const factor = verified.find((factorRow) => factorRow.id === factorId);
|
|
24
|
+
if (!factor) {
|
|
25
|
+
throw new StepUpBootstrapError('STEP_UP_FACTOR_NOT_FOUND', `factorId ${factorId} 不在当前用户的已验证因素列表中。`);
|
|
26
|
+
}
|
|
27
|
+
const result = await client.stepUpVerify({
|
|
28
|
+
challengeId: options.challengeId,
|
|
29
|
+
factorId,
|
|
30
|
+
factorType: factor.type,
|
|
31
|
+
credential,
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
challengeId: result.challengeId,
|
|
35
|
+
stepUpToken: result.stepUpToken,
|
|
36
|
+
expiresAt: result.expiresAt,
|
|
37
|
+
factorId,
|
|
38
|
+
factorType: factor.type,
|
|
39
|
+
action: options.action,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async function runWithStepUp(options) {
|
|
43
|
+
const client = (0, api_client_1.createApiClient)(options.targetOrg);
|
|
44
|
+
try {
|
|
45
|
+
const data = await client.graphql(options.query, options.variables);
|
|
46
|
+
return { data, proof: null };
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
const requirement = (0, api_client_1.extractStepUpRequirement)(error);
|
|
50
|
+
if (!requirement) {
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
const proof = await completeStepUpChallenge({
|
|
54
|
+
targetOrg: options.targetOrg,
|
|
55
|
+
challengeId: requirement.challengeId,
|
|
56
|
+
action: requirement.action,
|
|
57
|
+
resolveCredential: options.resolveCredential,
|
|
58
|
+
});
|
|
59
|
+
const data = await client.graphqlWithStepUp(options.query, options.variables, proof.stepUpToken);
|
|
60
|
+
return { data, proof };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
class StepUpBootstrapError extends Error {
|
|
64
|
+
constructor(code, message) {
|
|
65
|
+
super(message);
|
|
66
|
+
this.name = 'StepUpBootstrapError';
|
|
67
|
+
this.code = code;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.StepUpBootstrapError = StepUpBootstrapError;
|
|
71
|
+
function buildNonInteractiveCredentialResolver(options) {
|
|
72
|
+
return async ({ factors }) => {
|
|
73
|
+
const wantedType = options.factorType ?? 'totp';
|
|
74
|
+
const credential = options.credential ?? process.env.NEXUS_STEP_UP_CREDENTIAL;
|
|
75
|
+
if (!credential) {
|
|
76
|
+
throw new StepUpBootstrapError('STEP_UP_CREDENTIAL_REQUIRED', '非交互模式下必须通过 --credential 或 NEXUS_STEP_UP_CREDENTIAL 提供 step-up 凭据。');
|
|
77
|
+
}
|
|
78
|
+
let factor;
|
|
79
|
+
if (options.factorId) {
|
|
80
|
+
factor = factors.find((row) => row.id === options.factorId);
|
|
81
|
+
if (!factor) {
|
|
82
|
+
throw new StepUpBootstrapError('STEP_UP_FACTOR_NOT_FOUND', `--factor-id ${options.factorId} 不在已验证因素列表中。`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
factor = factors.find((row) => row.type === wantedType);
|
|
87
|
+
if (!factor) {
|
|
88
|
+
const available = factors.map((row) => `${row.id}(${row.type})`).join(', ');
|
|
89
|
+
throw new StepUpBootstrapError('STEP_UP_FACTOR_TYPE_UNAVAILABLE', `没有类型为 ${wantedType} 的已验证因素。可用: ${available}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return { factorId: factor.id, credential };
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function freshIdempotencyKey() {
|
|
96
|
+
return (0, node_crypto_1.randomUUID)();
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=step-up-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-up-helper.js","sourceRoot":"","sources":["../../../../src/services/step-up-helper.ts"],"names":[],"mappings":";;;AAmDA,0DAyCC;AAmBD,sCA6BC;AA4BD,sFAoCC;AAQD,kDAEC;AAtND,6CAAyC;AAEzC,6CAKsB;AAiNb,gGAnNP,4BAAe,OAmNO;AArKjB,KAAK,UAAU,uBAAuB,CAAC,OAK7C;IACC,MAAM,MAAM,GAAG,IAAA,4BAAe,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC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A6B,EAC7B,mEAAmE,CACpE,CAAC;QACJ,CAAC;QACD,IAAI,MAAiC,CAAC;QACtC,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC5D,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,oBAAoB,CAC5B,0BAA0B,EAC1B,eAAe,OAAO,CAAC,QAAQ,cAAc,CAC9C,CAAC;YACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;YACxD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5E,MAAM,IAAI,oBAAoB,CAC5B,iCAAiC,EACjC,SAAS,UAAU,eAAe,SAAS,EAAE,CAC9C,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC;AAQD,SAAgB,mBAAmB;IACjC,OAAO,IAAA,wBAAU,GAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACjB,MAAM,OAAO,GAAG;gBACd,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,KAAK;gBAC3B,IAAI,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG;gBACpB,OAAO,EAAE,GA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AAC,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,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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AAU,EAAE,OAAO,CAAC,UAAU;QAC9B,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,2BAA2B,CAAC;AAC1C,CAAC"}
|
|
@@ -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"}
|